From: B.S on
Hi all. I am trying to write some thing like hot key and i need to get
WM_CHAR from desktop window. the window name is "Progman". to get it
i used this code:

FARPROC DeskWndProc;
DeskWndProc = (FARPROC)SetWindowLong(DeskWnd, GWL_WNDPROC, (DWORD)
DeskProc);
SetWindowLong(DeskWnd, GWL_WNDPROC, (DWORD) DeskWndProc);

but it doesn't work.

Pleas help.
From: Friedel Jantzen on
Am Mon, 2 Nov 2009 04:23:52 -0800 (PST) schrieb B.S:

> Hi all. I am trying to write some thing like hot key

You cannot use RegisterHotKey in your app?

> and i need to get
> WM_CHAR from desktop window. the window name is "Progman". to get it
> i used this code:
>
> FARPROC DeskWndProc;
> DeskWndProc = (FARPROC)SetWindowLong(DeskWnd, GWL_WNDPROC, (DWORD)
> DeskProc);
> SetWindowLong(DeskWnd, GWL_WNDPROC, (DWORD) DeskWndProc);
>
> but it doesn't work.
>
> Pleas help.

See "Subclassing".
Is it really necessary for you to subclass Progman?
Perhaps a keyboard hook could do it, if you cannot use RegisterHotKey.

Regards,
Friedel
From: B.S on
i'm trying this but it doesn't working.

WNDPROC DeskWndProc;
DeskWndProc = (WNDPROC)GetWindowLongPtr(DeskWnd,GWLP_WNDPROC);
SetWindowLongPtr(DeskWnd,GWLP_WNDPROC,(LONG_PTR) DeskProc);
From: Friedel Jantzen on
Am Mon, 2 Nov 2009 11:05:29 -0800 (PST) schrieb B.S:

> i'm trying this but it doesn't working.
>
> WNDPROC DeskWndProc;
> DeskWndProc = (WNDPROC)GetWindowLongPtr(DeskWnd,GWLP_WNDPROC);
> SetWindowLongPtr(DeskWnd,GWLP_WNDPROC,(LONG_PTR) DeskProc);

Subclassing and its limits:
http://msdn.microsoft.com/en-us/library/ms997565.aspx
HTH,
Friedel