Sign in to follow this  
Followers 0
Igtenio

Working "About Box" eluding me

4 posts in this topic

How exactly would I go about adding an About Box to an application?

I'm making a small app to help remove WFP-Protected Files. I got basically the entire thing down, but this stupid About Box. First, I tried using the MsgBox function, but it didn't do what I wanted it to, so I decided to try using the GUICreate command and various others. What I did was link the About button to pop up an About Box. Not hard. But inevitably, one of three things happen.

A) The About Box opens, can be closed, but it prevents the other buttons from doing anything. Even if you move the box out of the way, the buttons don't do anything.

B) The About Box opens, but can't be closed. But the rest of the buttons continue to function. You can even open more About Boxes, you just can't close them.

C) The About Box doesn't open at all. The rest of the buttons keep functioning, however.

Can anyone either give me some code to make a reliable box, or tell me whether the MsgBox function allows more indepth editing(Multiple lines, etc)? Or even if there's just a plain easier way?

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

How exactly would I go about adding an About Box to an application?

I'm making a small app to help remove WFP-Protected Files. I got basically the entire thing down, but this stupid About Box. First, I tried using the MsgBox function, but it didn't do what I wanted it to, so I decided to try using the GUICreate command and various others. What I did was link the About button to pop up an About Box. Not hard. But inevitably, one of three things happen.

A) The About Box opens, can be closed, but it prevents the other buttons from doing anything. Even if you move the box out of the way, the buttons don't do anything.

:) The About Box opens, but can't be closed. But the rest of the buttons continue to function. You can even open more About Boxes, you just can't close them.

C) The About Box doesn't open at all. The rest of the buttons keep functioning, however.

Can anyone either give me some code to make a reliable box, or tell me whether the MsgBox function allows more indepth editing(Multiple lines, etc)? Or even if there's just a plain easier way?

Case $Msg = $Hm_2
         About()

Func About()
   $About_Gui = GUICreate ('About ' & $Ttl, 250, 160, -1, -1, 0x00400000)
   GUISetCoord (5, 5)
   $Abt_Label = GUICtrlCreateLabel ("Text Here", 3, -1, 190, 100, 1)
   $Abt_Ok_Btn = GUICtrlCreateButton ('OK', -140, 0, 60, 20)
   GUISwitch ($About_Gui)
   GUISetState ()
   While 1
      $Msg = GUIGetMsg ()
      If $Msg = $Abt_Ok_Btn Then
         GUIDelete ()
         GUISwitch ($Main_Gui)
         GUISetState ()
         ExitLoop
      EndIf
   Wend
EndFunc  ;<==> About()

This was done with relative positioning so you if you are using absolute then chanje the X, Y, W and H values.

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

$Gui = GUICreate("Title", 392, 316)
$Button = GUICtrlCreateButton("About", 120, 130, 140, 40)
GUISetState(@SW_SHOW)
While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = -3
            ExitLoop
        Case $msg = $Button
            AboutBox()
    EndSelect
WEnd
Exit
Func AboutBox()
    DllCall("shell32.dll", "int", "ShellAbout", "hwnd", $Gui, "str", "My Product Name", "str", "ShellAbout example", "long", 0)
EndFunc

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Case $Msg = $Hm_2
         About()

Func About()
   $About_Gui = GUICreate ('About ' & $Ttl, 250, 160, -1, -1, 0x00400000)
   GUISetCoord (5, 5)
   $Abt_Label = GUICtrlCreateLabel ("Text Here", 3, -1, 190, 100, 1)
   $Abt_Ok_Btn = GUICtrlCreateButton ('OK', -140, 0, 60, 20)
   GUISwitch ($About_Gui)
   GUISetState ()
   While 1
      $Msg = GUIGetMsg ()
      If $Msg = $Abt_Ok_Btn Then
         GUIDelete ()
         GUISwitch ($Main_Gui)
         GUISetState ()
         ExitLoop
      EndIf
   Wend
EndFunc;<==> About()

This was done with relative positioning so you if you are using absolute then chanje the X, Y, W and H values.

Thank you so much, that works great.

One more question...

I implemented your code into my application, but the button created by;

$Abt_Ok_Btn = GUICtrlCreateButton ('OK', -140, 0, 60, 20)

Apparently has issues being "All-Clickable", if you get my drift. Sometimes you have to click on the very edge(On the shading, actually), while other times it'll only work if you click on the right half of the button itself.

Any way to fix that? I couldn't find anything immediately wrong which would cause it, since I just ripped out the code I was using and put yours' into place. And I've already repositioned it in the window so it isn't on the edge.

Edit: Gah, nevermind, just had to change the size of the GUICtrtCreateLabel function. >< I apologize, I've been having an off-day.

Edited by Igtenio

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