Jump to content
odaylton

Conceptual Doubt GUIRegisterMsg

Recommended Posts

odaylton

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

Share this post


Link to post
Share on other sites
TheDcoder

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 :)

  • Like 2

AutoIt.4.Life Clubrooms - Life is like a Donut (secret key)

Spoiler

My contributions to the AutoIt Community

If I have hurt or offended you in anyway, Please accept my apologies, I never (regardless of the situation) mean to do that to anybody!!!

3fHNZJ.gif

PLEASE JOIN ##AutoIt AND HELP THE IRC AUTOIT COMMUNITY!

Share this post


Link to post
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

×