SetWindowLong not working 
Author Message
 SetWindowLong not working

I have been trying to use SetWindowLong to subclass a window.

//thewnd is a defined HWND
//lpProc is a defined LONG
g_OldWindowProc = GetWindowProc(thewnd,GWL_WNDPROC);
long worked = SetWindowLong(thewnd,GWL_WNDPROC,lpProc);

But of course it doesn't work.  When I debug it, it says g_OldWindowProc gets
set to the Window Proc, but then SetWindowLong doesn't change the procedure.

lpProc is actually pointing at a procedure in a DLL, because I heard that you
can't subclass unless you stick your procedure in a DLL.  But it still isn't
working. =/

Can anyone help?

**AKBishop**

..still resisting the Computer {*filter*}s Anonymous meetings



Sat, 20 Jan 2001 03:00:00 GMT  
 SetWindowLong not working

Quote:
>I have been trying to use SetWindowLong to subclass a window.

>//thewnd is a defined HWND
>//lpProc is a defined LONG
>g_OldWindowProc = GetWindowProc(thewnd,GWL_WNDPROC);
>long worked = SetWindowLong(thewnd,GWL_WNDPROC,lpProc);

>But of course it doesn't work.  When I debug it, it says g_OldWindowProc gets
>set to the Window Proc, but then SetWindowLong doesn't change the procedure.

Is the window owned by your process? It won't work if it isn't.

There's an article on MSDN titled "Safe Subclassing in Win32", , that
you might want to have a look at for more details on subclassing
windows.

Dave
----
Address is altered to discourage junk mail.
Please post responses to the newsgroup thread,
there's no need for follow up email copies.



Mon, 22 Jan 2001 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. C++/ATL/ADO - Intellisense not working (statement completion options) not working

2. this code works on SGI does not work on linux

3. CMap Lookup not working (at least I cannot get it to work)

4. Program not work at release mode but work at debug mode

5. GetPrivateProfileSectionNames not working in 98 or ME but does work in 2000

6. Window NT BitMap Works Windows95 BitMap Does not Work

7. Not operator NOT working (!)

8. Setting not Null field to ""(empty string) does not work with CRecordset

9. CFile not working properly, can't figure out why (last message not sent properly)

10. Setting not Null field to ""(empty string) does not work with CRecordset

11. Web Service Not Working -- Namespace not found

12. Q: SetWindowLong/GetWindowLong calls for ActiveX IE control

 

 
Powered by phpBB® Forum Software