 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
kimbledon
Joined: 28 Sep 2007 Posts: 26
|
Posted: Sat Nov 03, 2007 1:11 pm Post subject: MsgBox function |
|
|
Test the code and you will notice the difference
The script should create 2 same msgboxes but my own function doesn't work.
Does someone know why?
| Code: |
MsgBox("Hello!", "Some message", 4)
MsgBox, 4, Hello!, Some message
; BUTTONS:
;0 = OK (default)
;1 = OK/CANCEL
;2 = Abort/Retry/Ignore
;3 = Yes/No/Cancel
;4 = Yes/No
;5 = Retry/Cancel
; ICONS:
;0 = No Icon(default)
;1 = Hand (stop/error)
;2 = Question
;3 = Exclamation
;4 = Asterisk (info)
; OPTIONS:
;4096 = System modal (OnTop)
;1048576 = Right-To-Left Text
;Look from AHK helpfile for more
MsgBox(title, message, button = 0, icon = 0, option = 0)
{
if (button < 0 || button > 5)
button = 0
if (icon < 0 || icon > 4)
icon = 0
if (option <> 4096 && option <> 1048576)
option = 0
if (title = )
title = %A_Space%
if icon = 1
icon = 16
if icon = 2
icon = 32
if icon = 3
icon = 48
if icon = 4
icon = 64
msgboxoptions := button+icon+option
MsgBox, %msgboxoptions%, %title%, %message%,
}
|
Thanks!  |
|
| Back to top |
|
 |
garry
Joined: 19 Apr 2005 Posts: 1186 Location: switzerland
|
|
| Back to top |
|
 |
RGF Guest
|
Posted: Sat Nov 03, 2007 1:28 pm Post subject: Re: MsgBox function |
|
|
| Help file wrote: | This parameter (msgbox's options) will not be recognized if it contains an expression or a variable reference such as %option%. Instead, use a literal numeric value.
|
|
|
| Back to top |
|
 |
kimbledon
Joined: 28 Sep 2007 Posts: 26
|
Posted: Sat Nov 03, 2007 1:32 pm Post subject: |
|
|
Thanks for your fast replies!
garry:
Thanks for the script, it's great but I would need to create msgbox
without creating another .ahk file and running it
RGF:
I didn't see that in the help file
Maybe I should use the dllcall |
|
| Back to top |
|
 |
kimbledon
Joined: 28 Sep 2007 Posts: 26
|
Posted: Sat Nov 03, 2007 1:38 pm Post subject: |
|
|
I just replaced the built-in msgbox command in the function with this:
| Code: |
DllCall("MessageBox", "int", "0", "str", message, "str", title , "int", msgboxoptions)
|
|
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|