antai Posted November 18 Share Posted November 18 Can I specify where the MsgBox appears on the screen? It appears at the center both x and y. Can I let it appear in the top of the screen? Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted November 18 Moderators Share Posted November 18 antai, Take a look at my ExtMsgBox UDF (link is in my sig - it allows you to specify the location of the dialog, as well as its colour, font, button text, etc, etc, etc. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Nine Posted Monday at 12:19 PM Share Posted Monday at 12:19 PM (edited) Another way : #include <Constants.au3> #include <WinAPISysWin.au3> Global $sTitle, $iPosX, $iPosY Local $iRet = MsgBoxEx($MB_OKCANCEL, "Test", "Text here", 200, 60) ConsoleWrite("Test response " & $iRet & @CRLF) $iRet = MsgBoxEx($MB_YESNO, "New Test", "New text here", 300, 0) ConsoleWrite("New Test response " & $iRet & @CRLF) Func MsgBoxEx($iFlag, $sWin, $sText, $iX, $iY) Local $hTimerProc = DllCallbackRegister(TimerProc, 'none', 'hwnd;uint;uint_ptr;dword') Local $iTimerID = _WinAPI_SetTimer(0, 0, 10, DllCallbackGetPtr($hTimerProc)) $sTitle = $sWin $iPosX = $iX $iPosY = $iY Local $iResp = MsgBox($iFlag, $sWin, $sText) DllCallbackFree($hTimerProc) Return $iResp EndFunc ;==>MsgBoxEx Func TimerProc($hWnd, $iMsg, $iTimerID, $iTime) If WinActive($sTitle) Then _WinAPI_KillTimer(0, $iTimerID) WinMove($sTitle, "", $iPosX, $iPosY) EndIf EndFunc ;==>_TimerProc Edited Monday at 07:37 PM by Nine better code mLipok 1 “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
Danyfirex Posted Monday at 02:19 PM Share Posted Monday at 02:19 PM Hello, Another alternative. expandcollapse popup#include <WinAPIProc.au3> #include <WinAPI.au3> #include <GUIConstants.au3> Global $hGUI = GUICreate("GUI") Global $idbtnOK = GUICtrlCreateButton("OK", 310, 370, 85, 25) GUISetState(@SW_SHOW, $hGUI) GUIRegisterMsg(_WinAPI_RegisterWindowMessage('SHELLHOOK'), 'WM_SHELLHOOK') _WinAPI_RegisterShellHookWindow($hGUI) Local $nMsg = 0 While 1 $nMsg = GUIGetMsg() Select Case $nMsg = $GUI_EVENT_CLOSE ExitLoop Case $nMsg = $idbtnOK _MsgBox(0, "", "Hello I'm an AutoIt Msgbox at Default Position :-)") _MsgBox(0, "", "Hello I'm an AutoIt Msgbox at 10,10 Position :-)", 10, 10) _MsgBox(0, "", "Hello I'm an AutoIt Msgbox at " & @DesktopWidth - 300 & "," & @DesktopHeight - 300 & " Position :-)", @DesktopWidth - 300, @DesktopHeight - 300) _MsgBox(0, "", "Hello I'm an AutoIt Msgbox at 0,0 Position :-)", 0, 0) EndSelect WEnd _WinAPI_DeregisterShellHookWindow($hGUI) Exit Func _MsgBoxPostition($X = Default, $Y = Default) Local Static $aPos[] = [Default, Default] If $X = Default Or $Y = Default Then Return $aPos EndIf $aPos[0] = $X $aPos[1] = $Y EndFunc ;==>_MsgBoxPostition Func _MsgBox($iFlag, $Title, $Text, $X = Default, $Y = Default, $iTimeout = Default, $hWnd = Default) _MsgBoxPostition($X, $Y) MsgBox($iFlag, $Title, $Text, $iTimeout, $hWnd) EndFunc ;==>_MsgBox Func WM_SHELLHOOK($hWnd, $iMsg, $wParam, $lParam) #forceref $iMsg Switch $wParam Case $HSHELL_WINDOWCREATED If WinGetProcess($lParam) = @AutoItPID And _WinAPI_GetClassName($lParam) = "#32770" Then Local $aPos = _MsgBoxPostition() If $aPos[0] <> Default And $aPos[1] <> Default Then WinMove($lParam, "", $aPos[0], $aPos[1]) EndIf EndIf EndSwitch EndFunc ;==>WM_SHELLHOOK Saludos mLipok 1 Danysys.com AutoIt... UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut Link to comment Share on other sites More sharing options...
argumentum Posted Monday at 06:49 PM Share Posted Monday at 06:49 PM MsgBox_Extn() UDF for MsgBox() move/position and/or click button delay. Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now