Jump to content

msgbox - new hwnd param not working ?


Recommended Posts

the (relative) new hwnd param in predesigned dialog boxes (like msgbox) is supposed to define the position of the dialog (not centered, as before).

at least, i thought that. it works for FileOpenDialog, but not for MsgBox. see example.

$gui=GUICreate("msgbox question", 200,200,Default,20)
$m=GUICtrlCreateButton("MsgBox", 20,20)
$f=GUICtrlCreateButton("FileOpenDialog", 20,60)
GUISetState()
Do
    $msg=GUIGetMsg()
    If $msg=$m Then MsgBox(0,"","not placed",0,$gui)
    If $msg=$f Then FileOpenDialog("placed",@SystemDir,"All (*.*)",7,"",$gui)
Until $msg=-3

or what else is the sense of the hwnd param in msgbox ?

thx j. :)

Spoiler

I actively support Wikileaks | Freedom for Julian Assange ! | Defend freedom of speech ! | Fight censorship ! | I will not silence.OixB7.jpgDon't forget this IP: 213.251.145.96

 

Link to comment
Share on other sites

the (relative) new hwnd param in predesigned dialog boxes (like msgbox) is supposed to define the position of the dialog (not centered, as before).

at least, i thought that. it works for FileOpenDialog, but not for MsgBox. see example.

$gui=GUICreate("msgbox question", 200,200,Default,20)
$m=GUICtrlCreateButton("MsgBox", 20,20)
$f=GUICtrlCreateButton("FileOpenDialog", 20,60)
GUISetState()
Do
    $msg=GUIGetMsg()
    If $msg=$m Then MsgBox(0,"","not placed",0,$gui)
    If $msg=$f Then FileOpenDialog("placed",@SystemDir,"All (*.*)",7,"",$gui)
Until $msg=-3

or what else is the sense of the hwnd param in msgbox ?

thx j. :)

As I understand it, the hwnd parameter is to specify the parent of the dialog not the position. Suppose you have 2 windows and a dialog appears, and you want to destroy one window. If the dialog has the wrong parent then it will be destroyed as well.

If you want to position the fileopen dialog then I have a way to do that somewhere. It would work for a msgBox as well I suppose but it has the disadvantage that it only moves it after it was created so you see a slight flicker initially.

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

..... It would work for a msgBox as well I suppose but it has the disadvantage that it only moves it after it was created so you see a slight flicker initially.

Here is an example of such message box function, the movement of the msgbox is almost not visible:

Global $a_MsgBox_Move_Data[5]

_MsgBoxEx(64, "_MsgBoxEx Example", "MsgBox with Left/Top parameters support.", 350, 0)

Func _MsgBoxEx($iFlag, $sTitle, $sText, $iLeft=Default, $iTop=Default, $iTimeOut=Default, $hWnd=Default)
    $a_MsgBox_Move_Data[0] = $sTitle
    
    If $iLeft <> -1 Or $iTop <> -1 Then
        Local $h_CallBack_Proc = DllCallbackRegister("__MsgBox_Move_Handler", "none", "hwnd;int;int;dword")
        
        Local $a_hTimer = DllCall("user32.dll", "int", "SetTimer", _
            "hwnd", 0, _ ;$hWnd
            "int", TimerInit(), _
            "int", 0, _ ;$iTime
            "ptr", DllCallbackGetPtr($h_CallBack_Proc))
        
        $a_MsgBox_Move_Data[1] = $h_CallBack_Proc
        $a_MsgBox_Move_Data[2] = $a_hTimer[0]
        $a_MsgBox_Move_Data[3] = $iLeft
        $a_MsgBox_Move_Data[4] = $iTop
    EndIf
    
    MsgBox($iFlag, $sTitle, $sText, $iTimeOut, $hWnd)
EndFunc

Func __MsgBox_Move_Handler($hWnd, $nMsg, $iIDTimer, $dwTime)
    If $a_MsgBox_Move_Data[1] > 0 Then DllCallBackFree($a_MsgBox_Move_Data[1])
    DllCall("user32.dll", "int", "KillTimer", "hwnd", 0, "int", $a_MsgBox_Move_Data[2])
    
    Local $iOld_Opt_WWD = Opt("WinWaitDelay", 0)
    
    WinWait("[CLASS:#32770;TITLE:" & $a_MsgBox_Move_Data[0] & "]")
    WinMove("[CLASS:#32770;TITLE:" & $a_MsgBox_Move_Data[0] & "]", "", $a_MsgBox_Move_Data[3], $a_MsgBox_Move_Data[4])
    
    Opt("WinWaitDelay", $iOld_Opt_WWD)
    
    $a_MsgBox_Move_Data[0] = 0
    $a_MsgBox_Move_Data[1] = 0
    $a_MsgBox_Move_Data[2] = 0
    $a_MsgBox_Move_Data[3] = 0
EndFunc

:)

Edited by MrCreatoR

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Link to comment
Share on other sites

As I understand it, the hwnd parameter is to specify the parent of the dialog not the position. Suppose you have 2 windows and a dialog appears, and you want to destroy one window. If the dialog has the wrong parent then it will be destroyed as well.

it is not possible to destroy a window during dialog. script is paused. (?) :)

on the other hand, FileOpenDialog moves from screen 0,0 to client 0,0 with hwnd. so this is not a coincidence, and analog to this MsgBox ought to do the same. maybe a bug ?

Edit:

(btw: thx, there are much more simple solutions to move a msgbox, but this is not the question.) :o

Edited by jennico
Spoiler

I actively support Wikileaks | Freedom for Julian Assange ! | Defend freedom of speech ! | Fight censorship ! | I will not silence.OixB7.jpgDon't forget this IP: 213.251.145.96

 

Link to comment
Share on other sites

There is also a hook by ProgAndy: xMsgBox

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Link to comment
Share on other sites

Here is an example of such message box function, the movement of the msgbox is almost not visible:

Global $a_MsgBox_Move_Data[5]

_MsgBoxEx(64, "_MsgBoxEx Example", "MsgBox with Left/Top parameters support.", 350, 0)

Func _MsgBoxEx($iFlag, $sTitle, $sText, $iLeft=Default, $iTop=Default, $iTimeOut=Default, $hWnd=Default)
    $a_MsgBox_Move_Data[0] = $sTitle
    
    If $iLeft <> -1 Or $iTop <> -1 Then
        Local $h_CallBack_Proc = DllCallbackRegister("__MsgBox_Move_Handler", "none", "hwnd;int;int;dword")
        
        Local $a_hTimer = DllCall("user32.dll", "int", "SetTimer", _
            "hwnd", 0, _ ;$hWnd
            "int", TimerInit(), _
            "int", 0, _ ;$iTime
            "ptr", DllCallbackGetPtr($h_CallBack_Proc))
        
        $a_MsgBox_Move_Data[1] = $h_CallBack_Proc
        $a_MsgBox_Move_Data[2] = $a_hTimer[0]
        $a_MsgBox_Move_Data[3] = $iLeft
        $a_MsgBox_Move_Data[4] = $iTop
    EndIf
    
    MsgBox($iFlag, $sTitle, $sText, $iTimeOut, $hWnd)
EndFunc

Func __MsgBox_Move_Handler($hWnd, $nMsg, $iIDTimer, $dwTime)
    If $a_MsgBox_Move_Data[1] > 0 Then DllCallBackFree($a_MsgBox_Move_Data[1])
    DllCall("user32.dll", "int", "KillTimer", "hwnd", 0, "int", $a_MsgBox_Move_Data[2])
    
    Local $iOld_Opt_WWD = Opt("WinWaitDelay", 0)
    
    WinWait("[CLASS:#32770;TITLE:" & $a_MsgBox_Move_Data[0] & "]")
    WinMove("[CLASS:#32770;TITLE:" & $a_MsgBox_Move_Data[0] & "]", "", $a_MsgBox_Move_Data[3], $a_MsgBox_Move_Data[4])
    
    Opt("WinWaitDelay", $iOld_Opt_WWD)
    
    $a_MsgBox_Move_Data[0] = 0
    $a_MsgBox_Move_Data[1] = 0
    $a_MsgBox_Move_Data[2] = 0
    $a_MsgBox_Move_Data[3] = 0
EndFunc

:)

Nicely done MrCreator.

Here is the example I was thinking of, which I did because FileSaveDialog doesn't return the extension so you don't know what the user wanted. (When, for example, they choose *.doc from the list and type in the name of the file without the extension.)

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <timers.au3>
#Region used for FileSaveDialog shifting
Global $MovedFileSaveDialog
#EndRegion used for FileSaveDialog shifting


#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form3", 413, 298, 98, 469)
$Button1 = GUICtrlCreateButton("Button1", 144, 24, 75, 25, 0)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
            
            MsgBox(262144,"filename = " & SaveWithExt("something",$Form1), 'Notice extension is added even though' & @CR & "you possibly didn't give type it in the name.")
    EndSwitch
WEnd
Func SaveWithExt($ftext, $hGui)
    ConsoleWrite("in save with ext" & @CRLF)
    Local $File, $t
    Local $AutoItexePath = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\AutoIt v3\AutoIt", "InstallDir")
    Global $type = "unknown";, $rectype = False
    $MovedFileSaveDialog = MouseGetPos()
    Local $tfs = _Timer_SetTimer($hGui, 60, "checkext")

    $File = FileSaveDialog("Save SCratchPad text", "", "Text files (*.txt)|Doc files (*.doc)|Any file (*.*)")
    _Timer_KillTimer($hGui, $tfs)
;the user might type in a file name but not the extension, and select the extension fron the list
;in this case $File doesn't have the extension and we don't know which one,if any, was chosen
;checkext tells us what happened.
    If $File = '' Then Return ''
    
    If StringInStr($File, '.') = 0 Then
        If $type = "unknown" Then
            $type = InputBox("Please give extension required", "extension ?")
            If $type = '' Then Return ''
            If StringInStr($type, '.') Then
                $type = '.' & StringRight($type, StringLen($type) - StringInStr($type, '.'))
            EndIf
        EndIf
        
        $File = $File & $type
    EndIf
    
;ConsoleWrite("File full path is " & $File & @CRLF)
    $hf = FileOpen($File, 2)
    FileWrite($hf, $ftext)
    FileClose($hf)
    Return $File
EndFunc  ;==>SaveWithExt

Func checkext($a, $b, $c, $d)
    Local $t, $doc, $any, $txt
    
    If Not WinExists("Save SCratchPad text", "") Then Return
    
    If IsArray($MovedFileSaveDialog) Then
        WinMove("Save SCratchPad text", "", $MovedFileSaveDialog[0] - 100, $MovedFileSaveDialog[1] - 100)
        $MovedFileSaveDialog = 0
    EndIf
    $t = WinGetText("Save SCratchPad text", "");,"[CLASS:Combo3;instance:3]")
    $txt = StringInStr($t, "*.txt")
    $doc = StringInStr($t, "*.doc")
    $any = StringInStr($t, "*.*")

    If $txt And Not $doc And Not $any Then $type = ".txt"
    If Not $txt And Not $any And $doc Then $type = ".doc"
    If Not $txt And Not $doc And $any Then $type = ".*"

EndFunc  ;==>checkext
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

PLEASE STOP IT !

this is not about it ! did any of you read my question ????

edit: or try my example script ?

Edited by jennico
Spoiler

I actively support Wikileaks | Freedom for Julian Assange ! | Defend freedom of speech ! | Fight censorship ! | I will not silence.OixB7.jpgDon't forget this IP: 213.251.145.96

 

Link to comment
Share on other sites

Have you even noticed, that FileSaveDialog moves to 0,0 client position with hwnd param ?

btw: _ChooseColor (though udf) does the same.

Spoiler

I actively support Wikileaks | Freedom for Julian Assange ! | Defend freedom of speech ! | Fight censorship ! | I will not silence.OixB7.jpgDon't forget this IP: 213.251.145.96

 

Link to comment
Share on other sites

Have you even noticed, that FileSaveDialog moves to 0,0 client position with hwnd param ?

No. I'll try it.

But if I was wrong when I gave my understanding in my first post why didn't you just say so?

EDIT:

Yes you're right. I had obviously misunderstood that feature, so my method is a bit of an overkill!

I agree it doesn't work for a MsgBox but it isn't obvious to me that it is supposed to change the position, it's just to specify the parent.

In which case MrCreator's contribution was directly relevant in helping you with a solution to your problem as far as I can see, and your silly "stop it" was just, well, silly.

Edited by martin
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

on the other hand, FileOpenDialog moves from screen 0,0 to client 0,0 with hwnd. so this is not a coincidence, and analog to this MsgBox ought to do the same. maybe a bug ?

It's not a bug, its more likely that this is a feature in FileOpenDialog :)

Here is another example, the first message box is centered on the parent GUI:

Global $a_MsgBox_Move_Data[6]

$hGUI = GUICreate("Parent GUI")

GUISetState()

_MsgBoxEx(64, "_MsgBoxEx Example", "MsgBox with Left/Top parameters support - Parent GUI Usage.", -1, -1, 0, $hGUI)

GUIDelete($hGUI)

_MsgBoxEx(64, "_MsgBoxEx Example", "MsgBox with Left/Top parameters support - Time Parameter Usage.", 300, -1, 3)

Func _MsgBoxEx($iFlag, $sTitle, $sText, $iLeft=Default, $iTop=Default, $iTimeOut=Default, $hWnd=Default)
    $a_MsgBox_Move_Data[0] = $sTitle
    
    ;If ($iLeft <> -1 And $iLeft <> Default) Or ($iTop <> -1 And $iTop <> Default) Then
        Local $h_CallBack_Proc = DllCallbackRegister("__MsgBox_Move_Handler", "none", "hwnd;int;int;dword")
        
        Local $a_hTimer = DllCall("user32.dll", "int", "SetTimer", _
            "hwnd", 0, _ ;$hWnd
            "int", TimerInit(), _
            "int", 0, _ ;$iTime
            "ptr", DllCallbackGetPtr($h_CallBack_Proc))
        
        $a_MsgBox_Move_Data[1] = $h_CallBack_Proc
        $a_MsgBox_Move_Data[2] = $a_hTimer[0]
        $a_MsgBox_Move_Data[3] = $iLeft
        $a_MsgBox_Move_Data[4] = $iTop
        $a_MsgBox_Move_Data[5] = $hWnd
    ;EndIf
    
    MsgBox($iFlag, $sTitle, $sText, $iTimeOut, $hWnd)
EndFunc

Func __MsgBox_Move_Handler($hWnd, $nMsg, $iIDTimer, $dwTime)
    If $a_MsgBox_Move_Data[1] > 0 Then DllCallBackFree($a_MsgBox_Move_Data[1])
    DllCall("user32.dll", "int", "KillTimer", "hwnd", 0, "int", $a_MsgBox_Move_Data[2])
    
    Local $iOld_Opt_WWD = Opt("WinWaitDelay", 0)
    
    Local $iLeft = $a_MsgBox_Move_Data[3], $iTop = $a_MsgBox_Move_Data[4]
    
    WinWait("[CLASS:#32770;TITLE:" & $a_MsgBox_Move_Data[0] & "]")
    
    If ($iLeft <> -1 And $iLeft <> Default) Or ($iTop <> -1 And $iTop <> Default) Then
        WinMove("[CLASS:#32770;TITLE:" & $a_MsgBox_Move_Data[0] & "]", "", $iLeft, $iTop)
    ElseIf IsHWnd($a_MsgBox_Move_Data[5]) Then
        Local $aParent_Pos = WinGetPos($a_MsgBox_Move_Data[5])
        Local $aMB_Pos = WinGetPos("[CLASS:#32770;TITLE:" & $a_MsgBox_Move_Data[0] & "]")
        
        $iX_Pos = $aParent_Pos[0] + ($aParent_Pos[2]/2) - ($aMB_Pos[2] / 2)
        $iY_Pos = $aParent_Pos[1] + ($aParent_Pos[3]/2) - ($aMB_Pos[3] / 2)
        
        WinMove("[CLASS:#32770;TITLE:" & $a_MsgBox_Move_Data[0] & "]", "", $iX_Pos, $iY_Pos)
    EndIf
    
    Opt("WinWaitDelay", $iOld_Opt_WWD)
    
    $a_MsgBox_Move_Data[0] = 0
    $a_MsgBox_Move_Data[1] = 0
    $a_MsgBox_Move_Data[2] = 0
    $a_MsgBox_Move_Data[3] = 0
    $a_MsgBox_Move_Data[4] = 0
    $a_MsgBox_Move_Data[5] = 0
EndFunc

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Link to comment
Share on other sites

@martin:

QUOTE (jennico @ Jan 4 2009, 04:49 PM)

Have you even noticed, that FileSaveDialog moves to 0,0 client position with hwnd param ?

No. I'll try it.

But if I was wrong when I gave my understanding in my first post why didn't you just say so?

but i did it. see post 4 . and that's why i added an example script. :) Edited by jennico
Spoiler

I actively support Wikileaks | Freedom for Julian Assange ! | Defend freedom of speech ! | Fight censorship ! | I will not silence.OixB7.jpgDon't forget this IP: 213.251.145.96

 

Link to comment
Share on other sites

@MrCreatoR :

It's not a bug, its more likely that this is a feature in FileOpenDialog

no. because all dialogs work like that. try _ChooseColor, _ChooseFont, FileSaveDialog, InputBox .... Edited by jennico
Spoiler

I actively support Wikileaks | Freedom for Julian Assange ! | Defend freedom of speech ! | Fight censorship ! | I will not silence.OixB7.jpgDon't forget this IP: 213.251.145.96

 

Link to comment
Share on other sites

@martin:

but i did it. see post 4 . and that's why i added an example script. :)

Oh yes. Apologies I somehow missed that.

(BTW, I think it is possible to destroy the parent when displaying a MsgBox, in the same way that you can move it of course.)

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

no. it can only be destroyed when the messagebox unlocks it. you can't even abort a gui with the trayexit when a dialog is open. only taskmanager can do it.

so, ........ what is that hwnd param for in MsgBox ? i can't find it documented.

Spoiler

I actively support Wikileaks | Freedom for Julian Assange ! | Defend freedom of speech ! | Fight censorship ! | I will not silence.OixB7.jpgDon't forget this IP: 213.251.145.96

 

Link to comment
Share on other sites

@MrCreatoR :

no. because all dialogs work like that. try _ChooseColor, _ChooseFont, FileSaveDialog, InputBox ....

That is probably not due to AutoIt but |Windows.

$gui=GUICreate("msgbox question", 200,200,Default,20)
$m=GUICtrlCreateButton("MsgBox", 20,20)
$f=GUICtrlCreateButton("FileOpenDialog", 20,60)
GUISetState()

$text = DllStructCreate("char[80]")
dllstructsetdata($text,1,"something")
$title = DllStructCreate("char[80]")
DllStructSetData($title,1,"the title")
Do
    $msg=GUIGetMsg()
    If $msg=$m Then dllcall("user32","int","MessageBox","hwnd",$gui,"ptr",DllStructGetPtr($text),"ptr",DllStructGetPtr($title),"int",1)
    If $msg=$f Then FileOpenDialog("placed",@SystemDir,"All (*.*)",7,"",$gui)
Until $msg=-3
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

well okay.

once i noticed that param i noticed that all dialogs moved that way to the parent. that param was added at the same time to the dialogs, as well as to messagbox. so i logically assumed that msgbox should react the same way.

but it does not. so the two questions are: could it be a bug - and - what is that param in msgbox for ?

that*s what i wanted to know.

i would find it very helpful if msgbox moves to the parent window automatically, better not to 0,0 client, but to center of client.

j.

edit: but you know that your dll messagebox is not the same as it is called by "MsgBox" ? i want to say, the "MsgBox" function does not do this dll call. it works different.

Edited by jennico
Spoiler

I actively support Wikileaks | Freedom for Julian Assange ! | Defend freedom of speech ! | Fight censorship ! | I will not silence.OixB7.jpgDon't forget this IP: 213.251.145.96

 

Link to comment
Share on other sites

I think you are correct martin, it's a quirk of the windows api. One of many I might add. As another example I see you still use *.* however the windows api actually sees that as *, it doesn't recognize the dot.

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

in this case, GeoSoft, help fille should be updated.

FileSaveDialog

--------------------------------------------------------------------------------

Initiates a Save File Dialog.

FileSaveDialog ( "title", "init dir", "filter" [, options [, "default name" [, hwnd]]] )

Parameters

title Title text of the Dialog GUI.

init dir Initial directory selected in the GUI file tree.

filter File type single filter such as "All (*.*)" or "Text files (*.txt)" or multiple filter groups such as "All (*.*)|Text files (*.txt)" (See Remarks).

Spoiler

I actively support Wikileaks | Freedom for Julian Assange ! | Defend freedom of speech ! | Fight censorship ! | I will not silence.OixB7.jpgDon't forget this IP: 213.251.145.96

 

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...