Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ MT-multithreading and servers » Why ie cannt catch messages from keyboard and mouse
Why ie cannt catch messages from keyboard and mouse [message #25523] Sat, 27 February 2010 14:16 Go to next message
bauso is currently offline  bauso
Messages: 1
Registered: February 2010
Junior Member
I try to make a wrapper class for Internet Explorer, and, when I use DHCtrl as browser's host window,ie cannt response any messages from keyboard and mouse. It only display the page.But if I use CreateWindowEx to create a window as the host window,ie working properly.Is it because the reasons for the upp's message loop?
  • Attachment: iedemo.rar
    (Size: 957.68KB, Downloaded 351 times)

[Updated on: Sat, 27 February 2010 14:18]

Report message to a moderator

Re: Why ie cannt catch messages from keyboard and mouse [message #25524 is a reply to message #25523] Sat, 27 February 2010 17:41 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
bauso wrote on Sat, 27 February 2010 08:16

I try to make a wrapper class for Internet Explorer, and, when I use DHCtrl as browser's host window,ie cannt response any messages from keyboard and mouse. It only display the page.But if I use CreateWindowEx to create a window as the host window,ie working properly.Is it because the reasons for the upp's message loop?


I believe that I know why (because messages are directed to DHCtrl). It could be fixed by overriding WindowProc.

I would like to help and in fact, I very much like to have such wrapper class in uppsrc. What about posting the source code (package) here? Smile

Mirek
Re: Why ie cannt catch messages from keyboard and mouse [message #25533 is a reply to message #25524] Sun, 28 February 2010 13:01 Go to previous messageGo to next message
jiuzhi is currently offline  jiuzhi
Messages: 10
Registered: October 2009
Promising Member
I had try to overriding WindowProc and send message to ie's document handle,or setfocus to ie's document,but did not work.

Because I just want a control to browse a web page,I only spent a few hours to get this, so it is very simple. Embarassed
  • Attachment: ie.rar
    (Size: 6.94KB, Downloaded 331 times)

[Updated on: Mon, 01 March 2010 16:04]

Report message to a moderator

Re: Why ie cannt catch messages from keyboard and mouse [message #25548 is a reply to message #25533] Mon, 01 March 2010 10:02 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
jiuzhi wrote on Sun, 28 February 2010 07:01

I had try to overriding WindowProc and send message to ie's document handle,or setfocus to ie's document,but did not work.

Because I just want a control to browse a web page,I only spent a few hours to get this, so it is very simple. Embarassed


OK, found it.

The problem is that DHCtrl was originally designed for OpenGL widget - in that case, it was not desirable that widget would eat all event messages. That is why by default, DHCtrl is disabled (so that parent Ctrl can take over message processing, effectively returning it back to DHCtrl, because in U++, message dispatch to child widgets is done by CtrlCore).

So the one simple remedy is to:

	LRESULT hdIECtrl::WindowProc( UINT message, WPARAM wParam, LPARAM lParam )
	{
		switch (message)
		{
		case WM_SIZE:
			wb.doResize();
			break;;
		case WM_CREATE:
			wb.attach(GetHWND());
			EnableWindow(GetHWND(), true);
                        break;
		}

		return DHCtrl::WindowProc(message, wParam, lParam);
	}


Now we have to fix those Heap leaks and we have one quite useful class... (what a pity that right now, there is no Linux counterpart).

Mirek
Re: Why ie cannt catch messages from keyboard and mouse [message #25571 is a reply to message #25548] Mon, 01 March 2010 14:51 Go to previous messageGo to next message
jiuzhi is currently offline  jiuzhi
Messages: 10
Registered: October 2009
Promising Member
luzr wrote on Mon, 01 March 2010 17:02

jiuzhi wrote on Sun, 28 February 2010 07:01

I had try to overriding WindowProc and send message to ie's document handle,or setfocus to ie's document,but did not work.

Because I just want a control to browse a web page,I only spent a few hours to get this, so it is very simple. Embarassed


OK, found it.

The problem is that DHCtrl was originally designed for OpenGL widget - in that case, it was not desirable that widget would eat all event messages. That is why by default, DHCtrl is disabled (so that parent Ctrl can take over message processing, effectively returning it back to DHCtrl, because in U++, message dispatch to child widgets is done by CtrlCore).

So the one simple remedy is to:

	LRESULT hdIECtrl::WindowProc( UINT message, WPARAM wParam, LPARAM lParam )
	{
		switch (message)
		{
		case WM_SIZE:
			wb.doResize();
			break;;
		case WM_CREATE:
			wb.attach(GetHWND());
			EnableWindow(GetHWND(), true);
                        break;
		}

		return DHCtrl::WindowProc(message, wParam, lParam);
	}


Now we have to fix those Heap leaks and we have one quite useful class... (what a pity that right now, there is no Linux counterpart).

Mirek

Thank you,luzr.
A simple solution is really unexpected, I was really very little understanding of Upp.

The heap leaks is on pClientSite.Because it can not work properly, so too lazy to go and change, heihei Very Happy
I had update the attachment on third floor.Also modified in one place:
	long hdWB::attach(HWND hwnd)
	{
		if(hwnd){
			if(m_hwnd && m_hwnd!=hwnd) detach();
		}else return -2;

[Updated on: Mon, 01 March 2010 14:56]

Report message to a moderator

Re: Why ie cannt catch messages from keyboard and mouse [message #25572 is a reply to message #25571] Mon, 01 March 2010 15:06 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
jiuzhi wrote on Mon, 01 March 2010 08:51

luzr wrote on Mon, 01 March 2010 17:02

jiuzhi wrote on Sun, 28 February 2010 07:01

I had try to overriding WindowProc and send message to ie's document handle,or setfocus to ie's document,but did not work.

Because I just want a control to browse a web page,I only spent a few hours to get this, so it is very simple. Embarassed


OK, found it.

The problem is that DHCtrl was originally designed for OpenGL widget - in that case, it was not desirable that widget would eat all event messages. That is why by default, DHCtrl is disabled (so that parent Ctrl can take over message processing, effectively returning it back to DHCtrl, because in U++, message dispatch to child widgets is done by CtrlCore).

So the one simple remedy is to:

	LRESULT hdIECtrl::WindowProc( UINT message, WPARAM wParam, LPARAM lParam )
	{
		switch (message)
		{
		case WM_SIZE:
			wb.doResize();
			break;;
		case WM_CREATE:
			wb.attach(GetHWND());
			EnableWindow(GetHWND(), true);
                        break;
		}

		return DHCtrl::WindowProc(message, wParam, lParam);
	}


Now we have to fix those Heap leaks and we have one quite useful class... (what a pity that right now, there is no Linux counterpart).

Mirek

Thank you,luzr.
A simple solution is really unexpected, I was really very little understanding of Upp.

The heap leaks is on pClientSite.Because it can not work properly, so too lazy to go and change, heihei Very Happy
I had update the attachment on third floor.Also modified in one place:
	long hdWB::attach(HWND hwnd)
	{
		if(hwnd){
			if(m_hwnd && m_hwnd!=hwnd) detach();
		}else return -2;



Actually, I believe that without correct AddRef/Release implemenation, there will be leaks...

Mirek
Re: Why ie cannt catch messages from keyboard and mouse [message #25574 is a reply to message #25572] Mon, 01 March 2010 15:19 Go to previous messageGo to next message
jiuzhi is currently offline  jiuzhi
Messages: 10
Registered: October 2009
Promising Member
luzr wrote on Mon, 01 March 2010 22:06


Actually, I believe that without correct AddRef/Release implemenation, there will be leaks...

Mirek

May not have to, IE is a self-management of these resources, but ie does not release the used memory is an old problem, as if without any solution. If really want to achieve a browser, I think it is better to use webkit

[Updated on: Mon, 01 March 2010 15:20]

Report message to a moderator

Re: Why ie cannt catch messages from keyboard and mouse [message #25576 is a reply to message #25523] Mon, 01 March 2010 16:06 Go to previous messageGo to next message
jiuzhi is currently offline  jiuzhi
Messages: 10
Registered: October 2009
Promising Member
I had add a new function displayHtml
Attachment in the third floor has been updated
Re: Why ie cannt catch messages from keyboard and mouse [message #25591 is a reply to message #25574] Tue, 02 March 2010 19:05 Go to previous message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
jiuzhi wrote on Mon, 01 March 2010 09:19

luzr wrote on Mon, 01 March 2010 22:06


Actually, I believe that without correct AddRef/Release implemenation, there will be leaks...

Mirek

May not have to, IE is a self-management of these resources, but ie does not release the used memory is an old problem, as if without any solution. If really want to achieve a browser, I think it is better to use webkit


True, but IE does not use U++ heap, so any IE leaks remain undetected.

If U++ says leaks, it means such memory was allocated using our new.... Wink
Previous Topic: multi-threading slower than single thread
Next Topic: Exclusion of underline chars in UrlEncode function
Goto Forum:
  


Current Time: Thu Mar 28 15:53:20 CET 2024

Total time taken to generate the page: 0.02099 seconds