0x0233 - (WM_DROPFILES) with Internet Explorer

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
A_User
Posts: 36
Joined: 21 Aug 2017, 01:15

0x0233 - (WM_DROPFILES) with Internet Explorer

21 Aug 2017, 02:17

Hi,

It seems posting/sending a message, 0x0233, does not work with Internet Explorer.

By doing a web search, I found this (https://answers.microsoft.com/en-us/win ... bf5?auth=1)) and this (https://stackoverflow.com/questions/144 ... pplication). They say use ChangeWindowMessageFilterEx or ChangeWindowMessageFilter.

But it does not seem to do anything. Is there anybody who has succeeded in doing this?

Code: Select all

DllCall("ChangeWindowMessageFilter", uint, 0x49, uint, 1) ; WM_COPYGLOBALDATA
DllCall("ChangeWindowMessageFilter", uint, 0x4A, uint, 1) ; WM_COPYDATA
DllCall("ChangeWindowMessageFilter", uint, 0x233, uint, 1) ; WM_DROPFILES 

hWndIE     := "...IE Window..." ; replace this with an IE window handle
image_path := "C:\...\Public\Pictures\Sample Pictures\Chrysanthemum.jpg" ; replace this with your image
PostMessage, 0x233, HDrop( image_path ), 0,, % "ahk_id " hWndIE

; This works
; PostMessage, 0x233, HDrop( image_path ), 0,, % "ahk_class Notepad"

HDrop(fnames,x=0,y=0) 
{
 	characterSize := A_IsUnicode ? 2 : 1
   fns:=RegExReplace(fnames,"\n$")
   fns:=RegExReplace(fns,"^\n")
   hDrop:=DllCall("GlobalAlloc","UInt",0x42,"UInt",20+(StrLen(fns)*characterSize)+characterSize*2)
   p:=DllCall("GlobalLock","UInt",hDrop)
   NumPut(20, p+0)  ;offset
   NumPut(x,  p+4)  ;pt.x
   NumPut(y,  p+8)  ;pt.y
   NumPut(0,  p+12) ;fNC
   NumPut(A_IsUnicode ? 1 : 0,  p+16) ;fWide

   p2:=p+20
   Loop,Parse,fns,`n,`r
   {
      DllCall("RtlMoveMemory","UInt",p2,"Str",A_LoopField,"UInt",StrLen(A_LoopField)*characterSize)
      p2+=StrLen(A_LoopField)*characterSize + characterSize
   }
   DllCall("GlobalUnlock","UInt",hDrop)
   Return hDrop
}

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: mikeyww and 317 guests