Jump to content

Recommended Posts

Posted

I thought I'd post this over in this forum because it looks like it's going to be something I can only do from AutoIt and not the activex control.

I am trying to override the minimum width and height for an external window (IE7 browser window set to "about:blank"). Searching through the forums gave me what I have now, but for some reason _WINAPI_SetWindowLong() is returning 0 (failure). I have checked that the handle to the window is found correctly, but can't figure out why it can't get the address of the old window message handler.

Here is what I have:

#include <GUIConstants.au3>
#include <WinAPI.au3>
#include <WindowsConstants.au3>

Global $wProcNew, $wProcOld, $wndptr
$wndptr = WinGetHandle("[TITLE:Blank Page - Windows Internet Explorer; CLASS:IEFrame]")
$wProcNew = DllCallbackRegister("_MsgProc","uint","hwnd;uint;wparam;lparam")
$wProcOld = _WinAPI_SetWindowLong($wndptr, -4, DllCallbackGetPtr($wProcNew))
MsgBox(0, $wProcOld, $wProcOld)

Func _MsgProc($hWnd, $Msg, $wParam, $lParam)
    Switch $Msg
        Case 0x24; WM_GETMINMAX
            Local $minmaxinfo = DllStructCreate("int;int;int;int;int;int;int;int;int;int", $lParam)
            DllStructSetData($minmaxinfo, 7, 20); min width
            DllStructSetData($minmaxinfo, 8, 20); min height
        Return 0
    EndSwitch
    Return _WinAPI_CallWindowProc($wProcOld, $hWnd, $Msg, $wParam, $lParam)
EndFunc

GUICreate("Testing", 150, 150, -1, -1, BitOR($GUI_SS_DEFAULT_GUI, $WS_SIZEBOX))
GUISetState(@SW_SHOW)

While 1
    $msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
Wend

_WinAPI_SetWindowLong($wndptr, -4, $wProcOld)
DllCallbackFree($wProcNew)
Exit

Note: The testing GUI is just to make sure my window message handler is still in effect.

Posted (edited)

Ok, I have tried other windows besides IE7's (e.g. notepad and command prompt) and I get the same result, 0 is returned from _WINAPI_SetWindowLong(). :P

EDIT: I just read this (under the mention of GWL_WNDPROC). Looks like this won't be possible?

Perhaps there's a better way to attack the problem? IE6 and prior work just fine as they don't have a minimum size, but IE7 has a minimum width of 250 and minimum height of 100. :):P I'm trying to use IE (minus the chrome) as an easy way to create an informational popup. Thus far I was able to do it all in WSH no problem (using CSS and such to easily customize colors and things). However, IE7 has turned out to be a whole other thing :D

EDIT 2: Eureka! I got the results I wanted by using a different approach. Instead of all of the above, I simply called _WINAPI_SetWindowPos with the SWP_NOSENDCHANGING flag. Now if only WinMove allowed you to specify flags like _WINAPI_SetWindowPos, then I could get away with using just the ActiveX component.

Edited by mscdex

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
×
×
  • Create New...