Getting WndProc

This is a discussion on Getting WndProc within the Windows Programming forums, part of the Platform Specific Boards category; I'm trying to get WindowProc from another window, and set my WindowProc to it. I use: Code: LRESULT CALLBACK Proc1(HWND, ...

  1. #1
    Registered User DutchStud's Avatar
    Join Date
    Oct 2001
    Posts
    43

    Question Getting WndProc

    I'm trying to get WindowProc from another window, and set my WindowProc to it. I use:
    Code:
    LRESULT CALLBACK Proc1(HWND, UINT, LPARAM, WPARAM); // or WPARAM, LPARAM, I can't remember what order
    LRESULT CALLBACK Proc2(HWND, UINT, LPARAM, WPARAM);
    ...
    Proc1 = (LRESULT CALLBACK) SetWindowLong(hwnd, SWL_WNDPROC, Proc2);
    but it gives me an LVALUE needed error message. can someone help me out?

  2. #2
    Registered User
    Join Date
    Aug 2001
    Posts
    72
    Code:
    //here is the code to swap it with one from the other window:
    ...
    
    	WNDPROC theOtherWndProc = (WNDPROC)GetWindowLong(hwndOther, GWL_WNDPROC);
    	WNDPROC yourOldWndProc = (WNDPROC)SetWindowLong(hwndYour, GWL_WNDPROC, (DWORD)theOtherWndProc);
    ...
    is it clear?

  3. #3
    Registered User DutchStud's Avatar
    Join Date
    Oct 2001
    Posts
    43

    good...

    ok, that seemed to work, but I'm making it in my WM_CREATE message and I get an Error on case WM_LBUTTONDOWN: (my next message handler) that says "case bypasses initialization of local variable"

  4. #4
    Registered User DutchStud's Avatar
    Join Date
    Oct 2001
    Posts
    43

    retract

    scratch that, i got it to work.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. WndProc Hook - Help
    By Mastadex in forum Windows Programming
    Replies: 0
    Last Post: 05-15-2006, 03:13 PM
  2. my wndProc is out of scope
    By Raison in forum Windows Programming
    Replies: 35
    Last Post: 06-25-2004, 07:23 AM
  3. deriving a class with a wndproc
    By bennyandthejets in forum Windows Programming
    Replies: 1
    Last Post: 01-04-2003, 06:31 PM
  4. WNDPROC type
    By Garfield in forum Windows Programming
    Replies: 5
    Last Post: 01-17-2002, 09:32 PM
  5. Putting WndProc into a class?
    By Eber Kain in forum Windows Programming
    Replies: 3
    Last Post: 12-13-2001, 05:46 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21