Jump to content

Different version of MsgBox


Recommended Posts

Hi guys, maybe is a stupid question but i don't find anything useful in the guide.

I find on a script this MsgBox:

Posted Image

The script:

MsgBox(270628, "Hey", "I like it!")

I want make a different version of it, like one button, or Stop-sign/Exclamation-point icon, but i don't understand how make a number like 270628, an on the guide there isn't a flag for disable the X button.

Thanks for support

Edited by johnmcloud
Link to comment
Share on other sites

Check out the flags in the Help file.

MsgBox(1 + 48, "Hey", "I like it!")

UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

No guinnes, you don't understand. I want make a version withouth the X botton enabled, like the image and the script. For example, with an Exclamation-point icon, only one button with the X disabled

Thanks

Edited by johnmcloud
Link to comment
Share on other sites

No guinnes, you don't understand.

Pardon me? I provided an example with Yes & No buttons and an exclamation mark, what I didn't address was the disabled close button. So I think I did understand. OK, so perhaps I didn't provide one button but I was hoping you would read the Help file. Edited by guinness

UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

guinnes, maybe my english isn't perfect, sorry for this and I apologize if I offended you. I have read the flag on help file, but don't find anything on close button, and the version posted has the close button disable. I can make a version with close button disable like this?

MsgBox(270628, "Hey", "I like it!")

With, ad example, one button or different icon?

Thanks for your help

Click on casual number, i have make a version with:

Yes-No and information icon

MsgBox(4 + 64, "Hey", "I like it!")

3 buttom ( abort, rentry and ignore ) and information icon

MsgBox(270626, "Hey", "I like it!")

3 button and error icon

MsgBox(270610,"Hey", "I like it!")

Yes-No and error icon

MsgBox(270612,"Hey", "I like it!")

3 button and yellow-mark icon

MsgBox(270642,"Hey", "I like it!")

Yes-No and yellow-mark icon

MsgBox(270644,"Hey", "I like it!")

3 button and exclamation icon

MsgBox(270658,"Hey", "I like it!")

Yes-No and exclamation icon

MsgBox(270660,"Hey", "I like it!")

Yes-No, no icon

MsgBox(270692,"Hey", "I like it!")

3 button, no icon

MsgBox(270674,"Hey", "I like it!")

So there is a way to do this, but i don't know and i can't make random number for ever :)

EDIT I have make number from 270600 to 270699 and i can't find only one button. Please i someone undestand how this number work, post the solution.

Edited by johnmcloud
Link to comment
Share on other sites

It seems like the flags 2 & 4 disable the close button by default.

For $i = 0 To 6
MsgBox($i, "Hey " & $i, "I like it!")
Next

Edit:

Seems like this is what you're looking for:

MsgBox(4 + 32, "Hey", "I like it!")
Edited by KaFu
Link to comment
Share on other sites

Given: 270628

In binary: 1000010000100100100

Is:

(2^18)*1 + = 262144 ( Top-most attribute )

(2^17)*0 +

(2^16)*0 +

(2^15)*0 +

(2^14)*0 +

(2^13)*1 + = 8192 ( Task modal )

(2^12)*0 +

(2^11)*0 +

(2^10)*0 +

(2^9)*0 +

(2^8)*1 + = 256 ( Second button default button )

(2^7)*0 +

(2^6)*0 +

(2^5)*1 + = 32 ( Question mark icon )

(2^4)*0 +

(2^3)*0 +

(2^2)*1 + = 4 ( Yes and no )

(2^1)*0 +

(2^0)*0 +

= 270628(decimal)

So don't see anything special there. Then I tried the same as KaFu: Only flag 4 in your example seems to disable close button.

Edited by Manadar
Link to comment
Share on other sites

Seems like this is what you're looking for:

MsgBox(4 + 32, "Hey", "I like it!")

You are right, i have make random number for nothing :)

A version only with one buttom? Only OK is = 0, how i can do this?

Because:

Only OK button + icon:

MsgBox(64,"Hey", "I like it!")

Add 4 we have two button instead 1

MsgBox(4 + 64,"Hey", "I like it!")

And seems don't work for all version, ad example:

MsgBox(20, "Hey", "I like it!")

With 4 don't work:

MsgBox(4 + 20, "Hey", "I like it!")

Thanks to all

Edited by johnmcloud
Link to comment
Share on other sites

If you're building a flag combo, you have to add up the numbers. I've you want to do it in reverse, you always have to subtract the largest possible value first (also see Manadar example above).

20 = 16 + 4

24 = 16 + 8 ... and 8 is undefined... or it's a 6 + 2 collision, either way no wonder it does not work :)...

Just add up the numbers you want to define the properties, only one per category.

0 + 64 + 256 + 4096 + 262144

Edited by KaFu
Link to comment
Share on other sites

Fun challenge.

Took code from here and here:

; =============================================================================
;  MsgBoxEx And InputBoxEx Examples
;  Purpose: Custom Buttons Of System Dialog
;  Author: Ward
; =============================================================================

#Include <winapi.au3>
#include <guimenu.au3>

MsgBoxEx("Ok", 0, "MsgBoxEx", "Test")

Func MsgBoxEx($CustomButton, $Flag, $Title, $Text, $Timeout = 0, $Hwnd = 0)
    Assign("MsgBoxEx:CustomButton", $CustomButton, 2)
    Local $CBT_ProcCB = DllCallbackRegister("MsgBoxEx_CBT_Proc", "long", "int;hwnd;lparam")
    Local $CBT_Hook = _WinAPI_SetWindowsHookEx($WH_CBT, DllCallbackGetPtr($CBT_ProcCB), 0, _WinAPI_GetCurrentThreadId())
    Local $Ret = MsgBox($Flag, $Title, $Text, $Timeout, $Hwnd)
    Local $Error = @Error
    _WinAPI_UnhookWindowsHookEx($CBT_Hook)
    DllCallbackFree($CBT_ProcCB)
    Assign("MsgBoxEx:CustomButton", 0, 2)
    Return SetError($Error, 0, $Ret)
EndFunc

Func MsgBoxEx_CBT_Proc($nCode, $wParam, $lParam)
    If $nCode = 5 Then ; HCBT_ACTIVATE
_GUICtrlMenu_EnableMenuItem(_GUICtrlMenu_GetSystemMenu($wParam), $SC_CLOSE, 1, False)
        Local $CustomButton = StringSplit(Eval("MsgBoxEx:CustomButton"), "|")
        For $i = 1 To $CustomButton[0]
            ControlSetText($wParam, "", $i, $CustomButton[$i])
        Next
    EndIf
    Return _WinAPI_CallNextHookEx(0, $nCode, $wParam, $lParam)
EndFunc
Edited by Manadar
Link to comment
Share on other sites

"Tidied" a bit ............

#Include <WinAPI.au3>
#include <GuiMenu.au3>

MsgBoxEx(64, "MsgBoxEx", "Test", 0, 0, 1)

Func MsgBoxEx($Flag, $Title, $Text, $Timeout = 0, $Hwnd = 0, $DisableX = 0)
    Assign("MsgBoxEx:DisableX", $DisableX, 2)
    Local $CBT_ProcCB = DllCallbackRegister("MsgBoxEx_CBT_Proc", "long", "int;hwnd;lparam")
    Local $CBT_Hook = _WinAPI_SetWindowsHookEx($WH_CBT, DllCallbackGetPtr($CBT_ProcCB), 0, _WinAPI_GetCurrentThreadId())
    Local $Ret = MsgBox($Flag, $Title, $Text, $Timeout, $Hwnd)
    Local $Error = @Error
    _WinAPI_UnhookWindowsHookEx($CBT_Hook)
    DllCallbackFree($CBT_ProcCB)
    Assign("MsgBoxEx:CustomButton", 0, 2)
    Return SetError($Error, 0, $Ret)
EndFunc

Func MsgBoxEx_CBT_Proc($nCode, $wParam, $lParam)
    If $nCode = 5 And Eval("MsgBoxEx:DisableX") Then ; HCBT_ACTIVATE
_GUICtrlMenu_EnableMenuItem(_GUICtrlMenu_GetSystemMenu($wParam), $SC_CLOSE, 1, False)
    EndIf
    Return _WinAPI_CallNextHookEx(0, $nCode, $wParam, $lParam)
EndFunc
Link to comment
Share on other sites

I have check it out over 10000 combination of MsgBox with this script:

While 1
    For $i = 10000 to 00001 Step -1
        MsgBox($i, $i, $i)
        Sleep(10)
    Next
    ExitLoop
WEnd

The result is:

; Question-mark icon
MsgBox(270628, "MsgBox", "Test"); Yes - No
MsgBox(97828, "MsgBox", "Test") ; Yes - No - ?
MsgBox(3618, "MsgBox", "Test")  ; Abort - Retry - Ignore
MsgBox(97826, "MsgBox", "Test") ; Abort - Retry - Ignore - ?
;No Icon
MsgBox(270692, "MsgBox", "Test"); Yes - No
MsgBox(98052, "MsgBox", "Test") ; Yes - No - ?
MsgBox(27066, "MsgBox", "Test") ; Abort - Retry - Ignore
MsgBox(98050, "MsgBox", "Test") ; Abort - Retry - Ignore - ?
; Exclamation-point icon
MsgBox(270660, "MsgBox", "Test"); Yes - No
MsgBox(97860, "MsgBox", "Test") ; Yes - No - ?
MsgBox(270658, "MsgBox", "Test"); Abort - Retry - Ignore
MsgBox(98114, "MsgBox", "Test") ; Abort - Retry - Ignore - ?
; Exclamation-point yellow icon
MsgBox(270644, "MsgBox", "Test"); Yes - No
MsgBox(97844, "MsgBox", "Test") ; Yes - No - ?
MsgBox(270642, "MsgBox", "Test"); Abort - Retry - Ignore
MsgBox(97842, "MsgBox", "Test") ; Abort - Retry - Ignore - ?
; Stop-sign icon
MsgBox(270612, "MsgBox", "Test"); Yes - No
MsgBox(98068, "MsgBox", "Test") ; Yes - No - ?
MsgBox(270610, "MsgBox", "Test"); Abort - Retry - Ignore
MsgBox(98066, "MsgBox", "Test") ; Abort - Retry - Ignore - ?

So seems there isn't a way to have a single button or the OK-Cancel combination by the MsgBox of Autoit with the X disabled ( excluding UDF or the solution by Manadar ). It's right?

Edited by johnmcloud
Link to comment
Share on other sites

So seems there isn't a way to have a single button or the OK-Cancel combination by the MsgBox of Autoit with the X disabled ( excluding UDF or the solution by Manadar ). It's right?

There is no mention of disabling the X button in the MsgBox documentation. Also, instead of creating 10E3 message boxes to find what you're looking for, try adding the values in the first column of the table shown below together in a way to create combinations of the desired effects listed in the second column. It's called the help file and it is your friend.

For instance, if you want the "Yes and No" button, the question mark icon, the NO button highlighted, and the MsgBox set to appear on top of all other windows, then you take the 4 from the Button-related Result, the 32 from the Icon-related Result, the 256 from the Default-related Result, and 262144 from the Miscellaneous-related Result and add them together. 4 + 32 + 256 + 262144 = 262436. Which is what you put into the flag position of the MsgBox command.

The flag parameter can be a combination of the following values:

The flag parameter can be a combination of the following values:

decimal flag    Button-related Result
0              OK button
1              OK and Cancel
2              Abort, Retry, and Ignore
3              Yes, No, and Cancel
4              Yes and No
5              Retry and Cancel
6              ** Cancel, Try Again, Continue

decimal flag    Icon-related Result
0              (No icon)
16            Stop-sign icon
32            Question-mark icon
48            Exclamation-point icon
64            Information-sign icon consisting of an 'i' in a circle

decimal flag    Default-related Result
0              First button is default button
256          Second button is default button
512          Third button is default button

decimal flag    Modality-related Result
0              Application
4096            System modal (dialog has an icon)
8192            Task modal

decimal flag    Miscellaneous-related Result
0              (nothing else special)
262144        MsgBox has top-most attribute set
524288        title and text are right-justified

Whenever someone says "pls" because it's shorter than "please", I say "no" because it's shorter than "yes".

Link to comment
Share on other sites

Yes JohnQSmith, i see the help and i see there is no mention to disable the X flag, but there is a possibility to do that.

Your example work in this case ( for the X flag disable ):

MsgBox(4+32+256+262144, "Test", "Test")

But not in this case

MsgBox(1+32+256+262144, "Test", "Test")

I think there isn't another possibilty for disabled flag.

However, have make this thread only for academic purpose :)

Edited by johnmcloud
Link to comment
Share on other sites

Yes JohnQSmith, i see the help and i see there is no mention to disable the X flag, but there is a possibility to do that.

Your example work in this case ( for the X flag ):

MsgBox(4+32+256+262144, "Test", "Test")

But not in this case

MsgBox(1+32+256+262144, "Test", "Test")

However, have make this thread only for academic purpose

johnmcloud, you have been presented the answer to your question in several posts by several different people.

The disabling of the X button is the result of codes 2 and 4.

Link to comment
Share on other sites

johnmcloud, you have been presented the answer to your question in several posts by several different people.

The disabling of the X button is the result of codes 2 and 4.

Understood, so you can confirm there isn't other way to do the X disabled for other MsgBox, in addition to those I have already posted ( by "normal" autoit, obviously )

Edited by johnmcloud
Link to comment
Share on other sites

  • Moderators

Why do you need some "other way" when you've clearly been presented the answer?

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

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

×
×
  • Create New...