The GUI is missing mouse events

Ask for help, how to use AHK_H, etc.
arcticir
Posts: 543
Joined: 17 Nov 2013, 11:32

The GUI is missing mouse events

31 Jul 2017, 03:56

If the GUI uses the "-Caption" parameter, its GDI control will not be able to respond to mouse events.

Code: Select all

img:="D:\2a96558f30074646a6e18da7cb46408c.(960_1200).jpg"

OnMessage(0x0200, func("WM_MOUSEMOVE"))
(gui:=GuiCreate("-Caption")).OnEvent("Close","ExitApp")
gui.BackColor:=0x3f627f
k:=GuiCreate("+E0x80000 0x10000000 +Parent" gui.hwnd)

GdiplusStartup(getvar(pToken:=0),(si:=Struct("UINT GdiplusVersion;PTR DebugEventCallback;BOOL SuppressBackgroundThread;BOOL SuppressExternalCodecs",{GdiplusVersion:1}))[])
GdipCreateBitmapFromFile(&img,getvar(pBitmap:=0))
GdipGetImageDimension(pBitmap, getvar(width:=0), getvar(height:=0))
width:=Cast("Uint",width,"Float")
height:=Cast("Uint",height,"Float")
_W:=width*0.5
_H:=height*0.5
BITMAPINFOHEADER:="DWORD biSize;LONG biWidth;LONG biHeight;WORD biPlanes;WORD biBitCount;DWORD biCompression;DWORD biSizeImage;LONG biXPelsPerMeter;LONG biYPelsPerMeter;DWORD biClrUsed;DWORD biClrImportant;"
bi:=Struct(BITMAPINFOHEADER,{biSize:sizeof(BITMAPINFOHEADER),biWidth:_W,biHeight:_H,biPlanes:1,biBitCount:32})
hbm := CreateDIBSection( hdc:=GetDC(), bi[]),ReleaseDC(0,hdc)
hdc := CreateCompatibleDC(),obm := SelectObject(hdc, hbm)
GdipCreateFromHDC(hdc,getvar(G:=0)),GdipSetInterpolationMode(G, 7)
GdipDrawImageRectRectI(G,pBitmap,0,0,_W,_H,0,0,width,height,2)
pt:=Struct("x,y")
pt.x:=0,pt.y:=0
UpdateLayeredWindow(k.hwnd,0,pt[],getvar(temp1:=_W|_H<<32),hdc, getvar(temp2:=0),0,getvar(temp3:=255<<16|1<<24),2)
gui.show("w" _W " h" _H+50)
Return

WM_MOUSEMOVE(w,l,m,h){
	static i:=1
	ct(i++ "`t" h "`n")
}

ct(s){
	static stdout
	Return WriteConsole(stdout?stdout:(AttachConsole(-1),AllocConsole(),stdout:=GetStdHandle(-11)),&s,StrLen(s),0)
}
HotKeyIt
Posts: 1697
Joined: 29 Sep 2013, 18:35
Contact:

Re: The GUI is missing mouse events

31 Jul 2017, 17:28

Looks fine for me when I add a ToolTip for example, not sure about WriteConsole code:

Code: Select all

WM_MOUSEMOVE(w,l,m,h){
	static i:=1
    ToolTip A_TickCount
	ct(i++ "`t" h "`n")
}
arcticir
Posts: 543
Joined: 17 Nov 2013, 11:32

Re: The GUI is missing mouse events

31 Jul 2017, 20:21

Will the picture trigger a prompt?

WIN8 64 AHK32/64

Image
arcticir
Posts: 543
Joined: 17 Nov 2013, 11:32

Re: The GUI is missing mouse events

01 Aug 2017, 00:20

Another problem, unable to create this WINAPI function:

Code: Select all

name_size := 1255
VarSetCapacity(name, name_size )
GetModuleFileNameExW(ProcessExist(),0, &name, name_size )
MsgBox name

Code: Select all

Error:  Call to nonexistent function.

Specifically: GetModuleFileNameExW(ProcessExist(),0, &name, name_size )

	Line#
	001: name_size := 1255
	002: VarSetCapacity(name, name_size )
--->	003: GetModuleFileNameExW(ProcessExist(),0, &name, name_size )
	004: MsgBox name
	005: Exit
HotKeyIt
Posts: 1697
Joined: 29 Sep 2013, 18:35
Contact:

Re: The GUI is missing mouse events

06 Aug 2017, 16:02

With regards to gui you need -Caption: k:=GuiCreate("+E0x80000 0x10000000 -Caption +Parent" gui.hwnd).

GetModuleFileNameExW is not included in winapi because it is in different modules depending on windows version and I had no code to determine whether it is in psapi or kernel32, there are a few of these functions.
Probably I can try to implement that it first tries to load from kernel32 and when it fails from psapi but I am not sure.
arcticir
Posts: 543
Joined: 17 Nov 2013, 11:32

Re: The GUI is missing mouse events

06 Aug 2017, 22:21

thank you very much.

Return to “Ask For Help”

Who is online

Users browsing this forum: No registered users and 3 guests