Author Topic: MSGHANDLER / CMDHANDLER  (Read 540 times)

Robert

  • Hero Member
  • *****
  • Posts: 1314
    • View Profile
MSGHANDLER / CMDHANDLER
« on: April 21, 2024, 02:50:25 PM »
Hi MrBCX:

Vic McClung's MSGHANDLER / CMDHANDLER procedures need an update to handle returns, if they occur, from 64 bit SendMessage functions.

Sendmessage function has this syntax

Code: [Select]
LRESULT SendMessage(
  [in] HWND   hWnd,
  [in] UINT   Msg,
  [in] WPARAM wParam,
  [in] LPARAM lParam
);

  LRESULT is declared in WinDef.h as
 
Code: [Select]
   typedef LONG_PTR LRESULT;   
   and LONG_PTR is declared in BaseTsd.h as
   
Code: [Select]
   #if defined(_WIN64)
     typedef __int64 LONG_PTR;
   #else
     typedef long LONG_PTR;
   #endif
   

therefore Vic's BCX code

Code: [Select]
  SUB ProcessMsgHandler
    ' MSGHANDLER procedure or CMDHANDLER procedure
    FastLexer(Src$, ", ()", "")
    Src$ = "FUNCTION " + Stk$[2] + " OPTIONAL (hWnd AS HWND, wParam AS WPARAM, lParam AS LPARAM, LReturn AS LONG=0) AS LONG"
    Inject(Src$)
    Src$ = ""
  END SUB ' ProcessMsgHandler
 

  should be altered to
 
Code: [Select]
  SUB ProcessMsgHandler
    ' MSGHANDLER procedure or CMDHANDLER procedure
    FastLexer(Src$, ", ()", "")
    Src$ = "FUNCTION " + Stk$[2] + " OPTIONAL (hWnd AS HWND, wParam AS WPARAM, lParam AS LPARAM, LReturn AS LRESULT=0) AS LRESULT"
    Inject(Src$)
    Src$ = ""
  END SUB ' ProcessMsgHandler
 


MrBcx

  • Administrator
  • Hero Member
  • *****
  • Posts: 2476
    • View Profile
Re: MSGHANDLER / CMDHANDLER
« Reply #1 on: April 21, 2024, 05:36:58 PM »
Thanks Robert ... I've applied your update to 809.

There's more work for me to do on 809 when I can get to it.