Sign in to follow this  
Followers 0
Angel

MsgBoxes are sometimes "hidden"

11 posts in this topic

Hi,

I've been having a problem with message boxes for a while and I hope that you guys have a work around or at least know the reason for the problem.

What happens is that I use MsgBox to open a message box (usually from some callback function on a GUI made using event mode). From time to time (not always, but fairly often) the message box does not appear so the GUI seems to be "hung". But in reality it is just waiting for the user to click the message box.

The message box is actually there, but it is not shown on the windows task bar and it is not brought to the forefront when it is created. You can use Alt+TAB to "go to it", at which point it is brought to the forefront AND it appears on the taskbar.

I have not been able to reproduce this problem on a reliable manner, but it happens from time to time. It is rare enough that I often forget about it so when it happens I do not remember to check if there is a message box. But it is common enough to be pretty annoying as it makes programs seem to be "stuck".

So, is there any reason why this could be happening? Is there some way to avoid it? Does anyone else see this problem? BTW, I've seen this is different machines, and I am fairly sure that some of them were Windows2K boxes (and it also happens on my development box, which has Windows XP).

One extra detail is that my GUI code normally has the following sleep loop in then:

While 1
  Sleep(100)
WEnd

I think that it does not matter, but maybe the sleep period is too short?

Any ideas? This is terribly annoying!

Thanks,

Angel

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Hi,

why this could be happening?

I guesing that the string in MsgBox is to long...

I had the same problem a while ago, but i realized that this was caused by large strings (the text can not be displayed on currect screen resolution).

Edited by MsCreatoR

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Share this post


Link to post
Share on other sites

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Hi,

I've been having a problem with message boxes for a while and I hope that you guys have a work around or at least know the reason for the problem.

What happens is that I use MsgBox to open a message box (usually from some callback function on a GUI made using event mode). From time to time (not always, but fairly often) the message box does not appear so the GUI seems to be "hung". But in reality it is just waiting for the user to click the message box.

The message box is actually there, but it is not shown on the windows task bar and it is not brought to the forefront when it is created. You can use Alt+TAB to "go to it", at which point it is brought to the forefront AND it appears on the taskbar.

I have not been able to reproduce this problem on a reliable manner, but it happens from time to time. It is rare enough that I often forget about it so when it happens I do not remember to check if there is a message box. But it is common enough to be pretty annoying as it makes programs seem to be "stuck".

So, is there any reason why this could be happening? Is there some way to avoid it? Does anyone else see this problem? BTW, I've seen this is different machines, and I am fairly sure that some of them were Windows2K boxes (and it also happens on my development box, which has Windows XP).

One extra detail is that my GUI code normally has the following sleep loop in then:

While 1
  Sleep(100)
WEnd

I think that it does not matter, but maybe the sleep period is too short?

Any ideas? This is terribly annoying!

Thanks,

Angel

This could also be a problem with the type of msgbox you use (What flags).

Is it System, Application or Task modal? Is the OnTop flag set?

MsgBox(262144, "TEST","This is some text") should always appear on top and in the taskbar

Edit: insert a very important word

Edited by GEOSoft

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites

This is kind of a rediculous thread... You've posted no re-creation script, and as you can see from previous posts before mine, there is nothing but assumptions left on your issue.


Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites

This is kind of a rediculous thread... You've posted no re-creation script, and as you can see from previous posts before mine, there is nothing but assumptions left on your issue.

SmOke_N, I wish I could have posted a recreation script. Everytime this has happened the problem was on a script too complicated to post here. By too complicated I mean that it would not run on a PC without the right software installed, as I am automating some custom software that we use at work.

The only extra information that I can add is that there is one particular message box that seems to have this problem:

MsgBox(64,"Check-Out result",$sResult)

So the only flag I use is the "information icon" flag.

Also, _sometimes_ the message box _is_ shown on the windows task-bar. It just is not brought to the forefront (which is almost equally annoying).

I will try using some of the "modal" flags. However I still do not understand why a message box would not be brought to the front upon creation. That is basically the only thing that I would expect from it!

Angel

Share this post


Link to post
Share on other sites

I put the OnTop attribute on almost every Msgbox I add.

Use OK: 0x40000.

Use OK & Cancel: 0x40001.

Use Stop: 0x40010.

Use 2nd button: 0x40100.

Use System: 0x41000

See how each digit in the hex value changes. Easier then decimal flags IMO and you know to start with 0x40000 for OnTop. Knowing the multiple attributes set by combining hex flags is easier to interpret when you read the script later. Just some friendly advice. :)

Share this post


Link to post
Share on other sites

I put the OnTop attribute on almost every Msgbox I add.

Use OK: 0x40000.

Use OK & Cancel: 0x40001.

Use Stop: 0x40010.

Use 2nd button: 0x40100.

Use System: 0x41000

See how each digit in the hex value changes. Easier then decimal flags IMO and you know to start with 0x40000 for OnTop. Knowing the multiple attributes set by combining hex flags is easier to interpret when you read the script later. Just some friendly advice. :)

I agree and just recently changed the default state of On Top chkbox in the PX MsgBox builder to 1 for Where the MsgBox Type is AutoIt. I'll probably do the same for the other types but I want to look into it a little deeper.

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites

There does not seem to be any way, but is there possible to force a message box to be on top of the current application only?

That is, if you select a different application, the message box would not be on top, but as soon as you bring the autoit application to focus, the message box would come to the forefront. Is that possible?

Otherwise, what is the difference between "System Modal" and "Task Modal"?

Share this post


Link to post
Share on other sites

is there possible to force a message box to be on top of the current application only?

Using Hwnd:

$hWnd = WinGetHandle(WinGetTitle(""))

_MsgBox(64, "Test", "This MsgBox is a child of last active window", $hWnd)

Func _MsgBox($MsgBoxType, $MsgBoxTitle, $MsgBoxText, $hwnd)
    $Return = DllCall ("user32.dll", "int", "MessageBox", "hwnd", $hwnd, "str", $MsgBoxText, "str", $MsgBoxTitle, "int", $MsgBoxType)
    Return $Return[0]
EndFunc

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

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