Jump to content
Sign in to follow this  
stev379

Top most attribute

Recommended Posts

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!

Share this post


Link to post
Share on other sites

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()

Share this post


Link to post
Share on other sites

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! :lmao:

Share this post


Link to post
Share on other sites

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 by stev379

Share this post


Link to post
Share on other sites

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()

WEnd

EndFunc; Main()

Share this post


Link to post
Share on other sites

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 by stev379

Share this post


Link to post
Share on other sites

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!

Share this post


Link to post
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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...