Question regarding "Ptr" and "UPtr" and "Int" and "Uint"

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
GEOVAN
Posts: 182
Joined: 03 Mar 2022, 11:12

Question regarding "Ptr" and "UPtr" and "Int" and "Uint"

Post by GEOVAN » 12 May 2024, 13:06

Question regarding "Ptr" and "UPtr" and "Int" and "Uint"
From my reading i understand that the best to use is the "Ptr", because it covers all the rest ("UPtr" and "Int" and "Uint")

For example purposes, lets consider the following function:

Code: Select all

ImageToClipboard(Filename)
{
    hbm := DllCall("LoadImage","uint",0,"str",Filename,"uint",0,"int",0,"int",0,"uint",0x10)
    if !hbm
      return
    DllCall("OpenClipboard","uint",0)
    DllCall("EmptyClipboard")
    ; Place the data on the clipboard. CF_BITMAP=0x2
    if !DllCall("SetClipboardData","uint",0x2,"uint",hbm)
DllCall("DeleteObject","uint",hbm)
    DllCall("CloseClipboard")
}

Now, lets focus in the following line in the above code:

Code: Select all

DllCall("DeleteObject","uint",hbm)

This line can be substitute with the following:

Code: Select all

DllCall( "DeleteObject", "Ptr", hbm )
Am i understand it correct please?

Return to “Ask for Help (v1)”