Jump to content

Simple question, difficult answer?


Recommended Posts

Hello autoitscripters!

I've searched and searched, without finding what I'm looking for.

I want my GUI to display a simple MsgBox - Just like notepad does it, when you wanna close it, without saving your changes.

I don't want my MsgBox to be displayed in the taskbar along with my GUI. - Like it does by diffault.

Is there a solution?

Thanks in advance.

- crz

Steffen "crz" Jorgensenwww.crz.dkcrz@crz.dk

Link to comment
Share on other sites

I did a quick search for you. You could try using this code:

$window = WinGetHandle("MsgBox title")
$newParent = WinGetHandle("Program Manager")

DllCall("user32.dll", "hwnd", "SetParent", "hwnd", $window, "hwnd", $newParent)

Substitute "MsgBox title" for the title of your message box.

Though I'm sure there's an easier way.

Edit: doesn't seem to work on MsgBox...

Edited by faire
Link to comment
Share on other sites

I did a quick search for you. You could try using this code:

$window = WinGetHandle("MsgBox title")
$newParent = WinGetHandle("Program Manager")

DllCall("user32.dll", "hwnd", "SetParent", "hwnd", $window, "hwnd", $newParent)

Substitute "MsgBox title" for the title of your message box.

Though I'm sure there's an easier way.

Edit: doesn't seem to work on MsgBox...

While the MsgBox() is up, your script is blocked, so the script can't modify it's own MsgBox(). There are ways around this, where you launch a separate process for the MsgBox(), but they are kind of ugly. Better to just create a custom MsgBox GUI of your own.

:)

P.S. As Siao pointed out, you can make the MsgBox() a child of your main GUI by providing the $hWND option, and it doesn't show on the taskbar. It still blocks the script while it's up, though.

Edited by PsaltyDS
Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

Damn, how I hate topics like these.

In latest version of AutoIt, parent window parameter was added to MsgBox(), FileSelectFolder(), FileOpenDialog(), FileSaveDialog(). It's documented both in changelog and corresponding helpfile articles. Case closed.

Edited by Siao

"be smart, drink your wine"

Link to comment
Share on other sites

@Siao

Wauw, I didn't actually miss that. I saw it many trys, searches, topics and replys ago. But it didn't change a thing adding the GUI handle to the MsgBox's parent parameter.

Now I get it.

I didn't add the "timeout" parameter, that lies just before it. So it probably ignored me adding the GUIs handle.

Sick!!

Thanks.

Steffen "crz" Jorgensenwww.crz.dkcrz@crz.dk

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...