Sign in to follow this  
Followers 0
Kurto2021

Customize Message Box

10 posts in this topic

Is there a way to create a message box that I can then say "Execute A", "Execute B", or "Execute C" instead of the default options that a message box gives?

Share this post


Link to post
Share on other sites



See guicreate function and add some buttons...


AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Share this post


Link to post
Share on other sites

Kurto2021,

Look at the ExtMsgBox UDF in my sig. :unsure:

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Melba thanks for the info...seems like it might be beyond my comprehension at this point in time but I am going to try and go through it.

edit

aha....figured out how you are using the other files.....there is an include....I will learn this damn thing

Edited by Kurto2021

Share this post


Link to post
Share on other sites

Kurto2021,

....I will learn this damn thing

You know where I am if you need help. :unsure:

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

I have torn it apart and started to figure it out....I basically shoehorned in your 2 files into my existing code and edited the pick list options and it working as desired. This damn forum amazes me every time.

Thanks

Share this post


Link to post
Share on other sites

Kurto2021,

shoehorned in your 2 files into my existing code

Why not leave it as an include? :unsure:

#include <ExtMsgBox.au3>

_ExtMsgBoxSet(0, 0, 0xFFCCCC, 0x008000)
Switch _ExtMsgBox(0, "Execute A|Execute B|Execute C", "Chooser", "What do you want to execute?")
    Case 1
        MsgBox(0, "Answer", "You pressed A")
    Case 2
        MsgBox(0, "Answer", "You pressed B")
    Case 3
        MsgBox(0, "Answer", "You pressed C")
EndSwitch

Seems simpler that way to me. :>

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

that is pretty much what I did...I just used your files and got it to do what I wanted.....as I go through your files more I will learn more and more.

Share this post


Link to post
Share on other sites

Kurto2021,

It was just that "shoehorned in your 2 files into my existing code" made me think that you had acted differently. :>

Do not hesitate to ask if you have any difficulties following any of the code. :unsure:

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

Is there a way to create a message box that I can then say "Execute A", "Execute B", or "Execute C" instead of the default options that a message box gives?

Hi, Kurto2021

Here is an example using a hook message into the MsgBox so you can use the "Msgbox" instruction, no need to create a Gui and Buttons.

The return ID for Execute A B C will either be 3,4,or 5.

It is not to hard to figure out how it works, go and have some fun with it.

Func Hook_Proc($nCode,$wParam,$lParam)
    Switch $nCode
        Case $HCBT_ACTIVATE
            Local $hIcon=DllCall("user32.dll","hwnd","LoadImage","hwnd",0, _
                                                                 "str",$IconFile, _
                                                                 "int",$IMAGE_ICON, _
                                                                 "int",0, _
                                                                 "int",0, _
                                                                 "int",$LR_LOADFROMFILE)
            DllCall("user32.dll","int","SendDlgItemMessage","hwnd",hWnd($wParam), _
                                                            "int",20, _
                                                            "int",$STM_SETIMAGE, _
                                                            "int",$IMAGE_ICON, _
                                                            "int",$hIcon[0])
            ControlSetText(hWnd($wParam),"",3,"Execute A")
            ControlSetText(hWnd($wParam),"",4,"Execute B")
            ControlSetText(hWnd($wParam),"",5,"Execute C")
        Case Else
            $RET=DllCall("user32.dll","int","CallNextHookEx","hwnd",$hHook[0], _
                                                             "int",$nCode, _
                                                             "int",$wParam, _
                                                             "int",$lParam)
            Return $RET[0]
    EndSwitch
    Return
EndFunc

Global Const $HCBT_ACTIVATE=5
Global Const $STM_SETIMAGE=370
Global Const $IMAGE_ICON=1
Global Const $LR_LOADFROMFILE=16

$IconFile=@ScriptDir&"\crapper.ico"

MsgBox(66,"MsgBox","Regular MsgBox Information")

$hProc=DllCallbackRegister("Hook_Proc","int","int;int;int")
$TID=DllCall("Kernel32.dll","int","GetCurrentThreadId")
$hHook=DllCall("user32.dll","hwnd","SetWindowsHookExA","int",$HCBT_ACTIVATE, _
                                                       "ptr",DllCallbackGetPtr($hProc), _
                                                       "hwnd",0, _
                                                       "int",$TID[0])
MsgBox(66,"Custom MsgBox","MessageBox Text Information")

DllCall("user32.dll","int","UnhookWindowsHookEx","hwnd",$hHook[0])
DllCallbackFree($hProc)

crapper.zip

Edited by xroot

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  
Followers 0