Jump to content

Recommended Posts

Posted

First, thanks to Xenogis for helping me a couple of days ago, I didn't want to bump an old topic. :)

Next, I'm trying to load images onto the screen. This is my code (well, it's the example actually :D):

#include <GUIConstants.au3>
GUICreate("My GUI picture",350,300,-1,-1,$WS_SIZEBOX+$WS_SYSMENU) ; will create a dialog box that when displayed is centered

GUISetBkColor (0xE0FFFF)
$n=GUICtrlCreatePic("pic.png",50,50, 200,50)

GUISetState ()

; Run the GUI until the dialog is closed
While 1
    $msg = GUIGetMsg()
   
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
Wend

It loads .bmp, .gif and .jpg, but .png won't work. I've read in other posts that it's possible for AutoIt to load them, so I'm wondering why they don't. I've attached an example file for which doesn't work.

I'm using the latest AutoIt+, but it also didn't work in the stable version (3.1).

Tnx in advance :D

Posted

hello,

Yes, GUICtrlCreatePic seem's not working with png.

But I have seen in a topic, a dll ( cwebpage.dll ), which allow to create windows with some html code.

I have modified your code :

#include <GUIConstants.au3>

$gui=GUICreate("My GUI picture",350,300,-1,-1,$WS_SIZEBOX+$WS_SYSMENU) ; will create a dialog box that when displayed is centered

GUISetBkColor (0xE0FFFF)

$pic=@WorkingDir&"\pic.png"

$dll = DLLOpen("cwebpage.dll")

DLLCall($dll,"long","EmbedBrowserObject","hwnd",$gui)

$a='<BODY scroll=no bgcolor="#E0FFFF"><img src="'&$pic&'" style="position:absolute;left:100;top:100;width:100;height:100"></BODY>'

DLLCall($dll,"long","DisplayHTMLStr","hwnd",$gui,"str",$a)

GUISetState ()

; Run the GUI until the dialog is closed

While 1

$msg = GUIGetMsg()

If $msg = $GUI_EVENT_CLOSE Then ExitLoop

Wend

but, be careful, the name of the picture must be between 2 Quotes " " I hope it'll help youcwebpage.dll


            
        

        

        
            

    
        

        
            
        
    

        
    

    
    

    

                    
                    
                        
                    
                    
                

                    

                    
                    






    

    

    
        
            
                


    
        
    

                
                
                    
                        

                    
                
            
        
        
            
                


sarkar112
            
            
                Posted 
                
            
        
    
    
        


sarkar112
            
        
        
            
                
                    


    
        
    

                    
                    
                        

                    
                
            
            
                Active Members
                
            
            
                
                    
                        
                            
                                
                            
                                 27
                            
                                
                            
                        
                        
                    
                
            
            
                

            
        
    
    
        



    
        
            
                
                    
                    
                    
                    
                    
                
            
            
                
                    
                    
                        
                        
                        
                        
                        
                        
                            
                                
                            
                            
                            
                            
                            
                            
                        
                    
                
                
            
        

        
           
           Posted 
           
            
            
                
                
            
        
    

    

    

    
        
        
            Since, it was posted in this topic lots of people are using cwebpage.dll for creating unique scripts.


            
        

        

        
    

    
    

    

                    
                    
                        
                    
                    
                

                    

                    
                    






    

    

    
        
            
                


    
        
    

                
                
                    
                        

                    
                
            
        
        
            
                


Nanaki
            
            
                Posted 
                
            
        
    
    
        


Nanaki
            
        
        
            
                
                    


    
        
    

                    
                    
                        

                    
                
            
            
                Active Members
                
            
            
                
                    
                        
                            
                                
                            
                                 58
                            
                                
                            
                        
                        
                    
                
            
            
                

            
        
    
    
        



    
        
            
                
                    
                        Author
                    
                    
                    
                    
                    
                
            
            
                
                    
                    
                        
                        
                        
                        
                        
                        
                            
                                
                            
                            
                            
                            
                            
                            
                        
                    
                
                
            
        

        
           
           Posted 
           
            
            
                
                
            
        
    

    

    

    
        
        
            
Thanks, I'll try it out soon. 

Does this mean animated GIF and transparent images are also supported? 


            
        

        

        
    

    
    

    

                    
                    
                        
                    
                    
                

                    

                    
                    






    

    

    
        
            
                


    
        
    

                
                
                    
                        

                    
                
            
        
        
            
                


Nanaki
            
            
                Posted 
                
            
        
    
    
        


Nanaki
            
        
        
            
                
                    


    
        
    

                    
                    
                        

                    
                
            
            
                Active Members
                
            
            
                
                    
                        
                            
                                
                            
                                 58
                            
                                
                            
                        
                        
                    
                
            
            
                

            
        
    
    
        



    
        
            
                
                    
                        Author
                    
                    
                    
                    
                    
                
            
            
                
                    
                    
                        
                        
                        
                        
                        
                        
                            
                                
                            
                            
                            
                            
                            
                            
                        
                    
                
                
            
        

        
           
           Posted 
           
            
            
                
                    (edited)
                
                
            
        
    

    

    

    
        
        
            
Thanks, it worked! Just a couple of questions tho 

Alright, I created this script:

; ---Options---

#include <GUIConstants.au3>
#include <image_get_size.au3>
#NoTrayIcon
FileInstall("cwebpage.dll", @TempDir & "\cwebpage.dll")

Global $textlabel="Label text", $file=@WorkingDir&"\pic.png", $size, $label, $dll, $gui
HotKeySet("{ESC}", "Terminate")

; ---Determine image size---

$size=_ImageGetSize($file)
Invoeren()

; ---The window itself---

Func Invoeren()
$gui=GUICreate("This is the requested picture", $size[0], $size[1], -1, -1, $WS_POPUP+$WS_BORDER, $WS_EX_TOPMOST)
GUISetBkColor(0xFFFFFF)
$dll=DLLOpen(@TempDir & "\cwebpage.dll")
DLLCall($dll,"long","EmbedBrowserObject","hwnd",$gui)
$url='<BODY scroll=no bgcolor="#FFFFFF"><img src="'&$file&'" style="position:absolute;left:0;top:0;width:"&$size[0]&";height:"&$size[1]&"></BODY>'
DLLCall($dll,"long","DisplayHTMLStr","hwnd",$gui,"str",$url)
$label=GUICtrlCreateLabel($textlabel, 0, 0, $size[0], $size[1], $SS_CENTER+$SS_CENTERIMAGE)
GUICtrlSetColor($label, 0xFFFFFF)
GUICtrlSetFont($label, -1, -1, -1, "Verdana")
GUISetState (@SW_SHOW)
While 1
    $msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
Wend
Terminate()
EndFunc

; ---Exit script---

Func Terminate()
    DLLCall($dll,"long","UnEmbedBrowserObject","hwnd",$gui)
    DLLClose($dll)
    FileDelete (@TempDir & "\cwebpage.dll")
    Exit
EndFunc

Now, it determines the height and length of "size.png" and shows it on the screen, with no white space around it. So far, so good.

But when I try to put a label on top of it (in this case "label text") it also works, but only now and then. Half of the time it show, the other half it doesn't. Any idea on how to fix this?

The same problem occurs with Animated GIF's, with the only difference the text is never shown, not once.

Second, can real transparency be achieved? I tried creating the window with WS_EX_LAYERED but then it doesn't show the "webpage" anymore. :/

Tnx!

Edited by Nanaki
Posted

This is getting complicated. :)

@ Larry: what do you mean with "information"? I have no problem displaying the pictures, nor determining the size. My problem is when I try to put a Label Control on top of it, it doesn't always appear. :/

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...