stev379 Posted February 28, 2005 Share Posted February 28, 2005 In references to MsgBoxes...I've used 262144 so the MsgBox has the top-most attribute set.This works well to keep the box on top, but you're still able to input text into the main GUI. None of the buttons on the main GUI will function which is great.Some apps have Msgboxes that flash a little when you try to interact with the main GUI to draw your attention to the MsgBox. Is there a way to do this with AutoIT? Thanks! Link to comment Share on other sites More sharing options...
Valik Posted February 28, 2005 Share Posted February 28, 2005 You mean like this? #include <GUIConstants.au3> Main() Func Main() Local $hWnd = GUICreate("Parent") GUISetState() DllCall("user32.dll", "int", "MessageBoxA", "hwnd", $hWnd, "str", "Test", "str", "Test", "int", 262144) While WinExists($hWnd) Local $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then GUIDelete() WEnd EndFunc; Main() Link to comment Share on other sites More sharing options...
stev379 Posted March 2, 2005 Author Share Posted March 2, 2005 You mean like this?#include <GUIConstants.au3> Main() Func Main() Local $hWnd = GUICreate("Parent") GUISetState() DllCall("user32.dll", "int", "MessageBoxA", "hwnd", $hWnd, "str", "Test", "str", "Test", "int", 262144) While WinExists($hWnd) Local $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then GUIDelete() WEnd EndFunc; Main()<{POST_SNAPBACK}>Thanks to both for the suggestions and to Valik for the example!Exactly what was needed! Link to comment Share on other sites More sharing options...
stev379 Posted March 2, 2005 Author Share Posted March 2, 2005 (edited) I've reached a point where I need to have Yes and No buttons on a message box. What would the code be to set yes/no buttons and what would the return value be of each? Thanks!! Edited March 2, 2005 by stev379 Link to comment Share on other sites More sharing options...
stev379 Posted March 3, 2005 Author Share Posted March 3, 2005 add 4 (i think)#include <GUIConstants.au3> Main() Func Main() Local $hWnd = GUICreate("Parent") GUISetState() $ret = DllCall("user32.dll", "int", "MessageBoxA", "hwnd", $hWnd, "str", "Test", "str", "Test", "int", 262148) ToolTip($ret[0]) While WinExists($hWnd) Local $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then GUIDelete() WEnd EndFunc; Main()tooltip shows the value...Lar.<{POST_SNAPBACK}>Thanks!That does create the yes/ buttons and the ToolTip returns the same values as MsgBox does (Y=7 N=6). But clicking Yes or will not kick of the message box (or do anything else I base on it's return value. Any idea what I may done wrong?My test:#include <GUIConstants.au3>Main()Func Main() Local $hWnd = GUICreate("Parent") GUISetState() $Delete_VERIFY = DllCall("user32.dll", "int", "MessageBoxA", "hwnd", $hWnd, "str", "TEXT", "str", "TITLE", "int", 262148) ToolTip($Delete_VERIFY[0]) If $Delete_VERIFY = ("7") Then DllCall("user32.dll", "int", "MessageBoxA", "hwnd", $hWnd, "str", "nothing has been deleted.", "str", "TITLE", "int", 262144) ;MsgBox(0, "Delete Cancel ", "Delete cancelled, " "nothing has been deleted.") ElseIf $Delete_VERIFY = ("6") Then DllCall("user32.dll", "int", "MessageBoxA", "hwnd", $hWnd, "str", "Deleted.", "str", "TITLE", "int", 262144) ;MsgBox(0, "Delete verified ", "Delete verfied. Deleted") EndIf While WinExists($hWnd) Local $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then GUIDelete() WEndEndFunc; Main() Link to comment Share on other sites More sharing options...
Valik Posted March 3, 2005 Share Posted March 3, 2005 Study the return value of DllCall in the documentation. Link to comment Share on other sites More sharing options...
stev379 Posted March 4, 2005 Author Share Posted March 4, 2005 (edited) Study the return value of DllCall in the documentation.<{POST_SNAPBACK}>Hi Valik, I've been studying the return values of DllCall and researched the internet as well. I'm falling short somewhere. In the example below if I use a regular MsgBox the returns work and key is deleted. If I use DllCall, nothing happens besides the DllCall messagebox going away. The main GUI stays open and nothing is deleted nor is either MsgBox to confirm Yes or No displayed. It's as though the if statement never gets entered when using Dll Call. I've also tried with case statements and get the same result. I'm sure it's something simple I'm just missing.Any suggestions? Case $msg = $button_delete And $keypath <> "" And $valuename = "" $Delete_VERIFY = DllCall("user32.dll", "int", "MessageBoxA", "hwnd", $Main, "str", "Are you sure you want to delete the key " & _ $keypath & ".", "str", "Confirm Delete", "int", 262148) ;$Delete_VERIFY = Msgbox(4, "Confirm Delete", "Are you sure you want to delete the key " & $keypath & ".") Select Case $Delete_VERIFY = "7" MsgBox(0, "Delete Cancel ", "Delete cancelled, " & chr(13) & $keypath & " has not been deleted.") Case $Delete_VERIFY = "6" ;delete key RegDelete($keypath) MsgBox(0, "Delete verified ", "Delete verfied. " & chr(13) & $keypath " has been deleted.") Edited March 4, 2005 by stev379 Link to comment Share on other sites More sharing options...
stev379 Posted March 4, 2005 Author Share Posted March 4, 2005 DLLCall returns an array... so $Delete_VERIFY is invalid... try using $Delete_VERIFY[0]Lar.<{POST_SNAPBACK}>Sweet! That did it.Thank you both Larry and Valik! 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