Jump to content

Conceptual Doubt GUIRegisterMsg


odaylton
 Share

Recommended Posts

When we use:

    GUIRegisterMsg($WM_COMMAND, "WM_COMMAND")
    GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")

We create functions for the events, ok

In several examples used we have several ways of doing the same thing and would like to know the differences in performace question or if there is a real reason to use each one of them:

;Case 1
    $hWndFrom = $lParam
    $iIDFrom = BitAND($wParam, 0xFFFF) ; Low Word
    $iCode = BitShift($wParam, 16) ; Hi Word

;or
;Case2
    $tNMHDR = DllStructCreate($tagNMHDR, $lParam)
    $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))
    $iIDFrom = DllStructGetData($tNMHDR, "IDFrom")
    $iCode = DllStructGetData($tNMHDR, "Code")
    
;or
;Case 3

$iIDFrom = _WinAPI_LoWord ($iwParam)
$iCode = _WinAPI_HiWord ($iwParam)

in my opinion Case 1 would be the fastest and most efficient way, if someone can show the advantages and disadvantages of each of them please ...

and possible errors in 32 or 64 bits

Link to comment
Share on other sites

Hello @odaylton, while I am not qualified to speak about the specifics about window GUI messages, I can offer you some general advice:

Case 1: It would be most efficient as you are using AutoIt's native Bit operation functions

Case 2: This would actually be more relevant since the NHMDR tag (structure) is designed to contain information about a message, but how efficient or safe it is depends on how the struct is populated...

Case 3: I think this would be your safest option if you want to get the Hi and Low words, as it is a direct call to the Windows API

Take my advice with a pinch of salt :)

EasyCodeIt - A cross-platform AutoIt implementation - Fund the development! (GitHub will double your donations for a limited time)

DcodingTheWeb Forum - Follow for updates and Join for discussion

Link to comment
Share on other sites

  • 4 weeks later...
On 09/11/2018 at 2:33 AM, TheDcoder said:

Hello @odaylton, while I am not qualified to speak about the specifics about window GUI messages, I can offer you some general advice:

Case 1: It would be most efficient as you are using AutoIt's native Bit operation functions

Case 2: This would actually be more relevant since the NHMDR tag (structure) is designed to contain information about a message, but how efficient or safe it is depends on how the struct is populated...

Case 3: I think this would be your safest option if you want to get the Hi and Low words, as it is a direct call to the Windows API

Take my advice with a pinch of salt :)

thanks for the info and I think these details should be more standardized in the help files.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...