@Ward, How to use SetWindowLongPtrW in Nim ? This is my Wndproc signature 
    
    
    proc RED_WndProc*(hwnd: HWND, message: UINT, wParam: WPARAM, lParam: 
LPARAM): LRESULT {.stdcall} =
    
    
    Run

And this the call site; 
    
    
    OldWndProc = SetWindowLongPtrW(result, GWLP_WNDPROC, RED_WndProc)
    
    
    Run

When using function name as it is, the result is this - Error: type mismatch: 
got <HWND, int literal(-4), proc (hwnd: HWND, message: UINT, wParam: WPARAM, 
lParam: LPARAM): LRESULT{.stdcall, locks: <unknown>.}>

Then i tried with this 
    
    
    OldWndProc = SetWindowLongPtrW(result, GWLP_WNDPROC, 
cast[LONG](RED_WndProc))
    
    
    Run

And the result is - Error: type mismatch: got <LONG_PTR> but expected 'WNDPROC 
= proc (P1: HWND, P2: UINT, P3: WPARAM, P4: LPARAM): LRESULT{.stdcall.}'

Then i tried with this - 
    
    
    OldWndProc = SetWindowLongPtrW(result, GWLP_WNDPROC, 
cast[WNDPROC](RED_WndProc))
    
    
    Run

Error: type mismatch: got <HWND, int literal(-4), WNDPROC> but expected one of:

proc SetWindowLongPtrW(hWnd: HWND; nIndex: int32; dwNewLong: LONG_PTR): LONG_PTR
    first type mismatch at position: 3 required type: LONG_PTR but expression 
'cast[WNDPROC](RED_WndProc)' is of type: WNDPROC

Reply via email to