Thread: Getting WndProc

  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, 07:31 PM
  4. WNDPROC type
    By Garfield in forum Windows Programming
    Replies: 5
    Last Post: 01-17-2002, 10:32 PM
  5. Putting WndProc into a class?
    By Eber Kain in forum Windows Programming
    Replies: 3
    Last Post: 12-13-2001, 06:46 PM