Jump to content

Recommended Posts

Posted

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?

  • Moderators
Posted

Kurto2021,

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

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

  Reveal hidden contents

 

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
  • Moderators
Posted

Kurto2021,

  Quote

....I will learn this damn thing

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

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

  Reveal hidden contents

 

Posted

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

  • Moderators
Posted

Kurto2021,

  Quote

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

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

  Reveal hidden contents

 

Posted

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.

  • Moderators
Posted

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

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

  Reveal hidden contents

 

Posted (edited)

  On 5/17/2011 at 6:25 PM, 'Kurto2021 said:

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

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...