Sign in to follow this  
Followers 0
tehon3299

Warning Box with image

6 posts in this topic

I need to create a "warning" window that displays a message, only has the OK button and also has an image at the top of the warning box. Does anyone have any examples of this or point me in the right direction??

Thanks!

Share this post


Link to post
Share on other sites



What sort of image? Or do you need a msgbox w/ image?

MsgBox(BitOR(262144,48),"Warning..Warning..",  "Danger Will Robinson")

Share this post


Link to post
Share on other sites

It is a gif image. It can be either a MsgBox or a GUI message box. I just cant figure out how to create an image embedded in a message box.

Share this post


Link to post
Share on other sites

you cant place an image in a message box, however you can on the GUI

GUICtrlCreatePic

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

an example using an icon

#include <GuiConstants.au3>
GUICreate("Warning", 200, 230, -1, -1, $WS_DLGFRAME, $WS_EX_TOPMOST)
GUISetBkColor(0xffff00)
GUISetFont(11, 690)
GUICtrlCreateIcon("C:\WINDOWS\system32\DSKQUOUI.DLL", 4, 10, 10)
$LABEL_1 = GUICtrlCreateLabel(" Remove", 10, 55, 180, 20)
GUICtrlSetBkColor(-1, 0xffffff)
$LABEL_2 = GUICtrlCreateLabel(" Example", 10, 85, 180, 20)
GUICtrlSetBkColor(-1, 0xffffff)
GUICtrlCreateLabel("Are you sure ?", 50, 120, 105, 20)
$YES = GUICtrlCreateButton("Yes", 10, 160, 80, 25)
$CANC = GUICtrlCreateButton("Cancel", 110, 160, 80, 25)
GUISetState()
While 1
    $MSG = GUIGetMsg()
    Select
        Case $MSG = $CANC
            Exit
        Case $MSG = $YES
            Exit
    EndSelect
WEnd
Edited by pecloe

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

Unfortunatly none of the pic commands work with Animated .gifs.

However there are workarounds. Your msgbox will have to be made in a gui, and your .gif converted to .avi (in this example)

.Ani cursors will animate but I have had little luck with converting animated .gif to .Ani (AniTuner seems to do nothing but crash for animated .gif's I have used. Instead I use Avi4Bmp along with IrfanView to get the height and width information for use in Avi4Bmp.

1. get height and width of your animated .gif from the Image>information menu in Irfanview or similar program.

2. start Avi4Bmp and select your animated .gif and choose "save image", then choose .bmp(default)

3.In Avi4Bmp choose "convert back" and set the height and width to the info you got in irfranview or other program.

4.Set the number of frames, I usually skip the last frame as it is a black blank frame, in this case I used 3 out of 4 possible frames.

5.set your fps (frames per second), in this example for this 3 frame animation I chose 5fps but it is a little on the fast side(season to taste)

6.choose "convert back to .Avi" and choose a file name. It will prompt you if you have cut any frames (in this case 3 out of 4) that this image contains less frames than image can contain, Press yes to proceed anyway.

7. choose "Full Frames (uncompressed)" -this is the default

now use this .Avi in place of any .gif animation

see attached zip for demo code.

http://www.autoitscript.com/fileman/index.php?act=list&op=get&target=MsgDemo.zip

http://www.autoitscript.com/fileman/users/Coffee/screenshot.jpg

Edit: forgot to add extended @0x00000008 ($WS_EX_TOPMOST) MsgDemo.zip updated.

Edited by Coffee

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