Jump to content

Problem with image on buttons


Orion122
 Share

Recommended Posts

#include <GUIConstantsEx.au3> 
#include <ButtonConstants.au3> 
#include <WindowsConstants.au3>    

GUICreate("Toolbar", 250, 250) 
GUISetState() 
$b=GUICtrlCreateButton("", 10, 170, 100, 70, $BS_ICON) 
GUICtrlSetImage($b, @DesktopDir & "\mozilla-firefox1.jpg", 1)
while 1     
sleep(1000) 
WEnd

When I run script the button is clear, without image. I tried with "shell32.dll" as filename and it works. I didn't make a func attached to button and other script parts cuz i discovered this problem and focused to solve it. Please help. I have Vista Home Premium

post-53552-12554531654769_thumb.jpg

Edited by Orion122
Link to comment
Share on other sites

#include <GUIConstantsEx.au3> 
#include <ButtonConstants.au3> 
#include <WindowsConstants.au3>  

Opt("GUIOnEventMode", 1)  

FileInstall("C:\Users\MARCIN\Desktop\mozilla-firefox1.jpg", "C:\Users\MARCIN\Desktop\mozilla-firefox1")   

GUICreate("Toolbar", 250, 250) 
GUISetState() 
$b=GUICtrlCreateButton("MOZILLA", 10, 170, 100, 70, $BS_BITMAP) 
GUICtrlSetImage($b, "C:\Users\MARCIN\Desktop\mozilla-firefox1") 
GUISetOnEvent($GUI_EVENT_CLOSE, "close")
  
while 1     
sleep(1000) 
WEnd   

func close()    
Exit 
EndFunc

I tried to write smth like this. I'm only reading about UDF. I'd be very thankful if u wrote here working script, ofc it's not na problem for u. I'm new in programming. Path to jpg is: C:\Users\MARCIN\Desktop\mozilla-firefox1

Link to comment
Share on other sites

#include <GUIConstantsEx.au3>
#include <ButtonConstants.au3> 
#include <WindowsConstants.au3>  

Opt("GUIOnEventMode", 1)  

FileInstall("C:\Users\MARCIN\Desktop\mozilla-firefox1.jpg", @TempDir & "\mozilla-firefox1.jpg")   

GUICreate("Toolbar", 250, 250) 
GUISetOnEvent($GUI_EVENT_CLOSE, "close")
$b=GUICtrlCreateButton("MOZILLA", 10, 170, 100, 70, $BS_BITMAP) 
GUICtrlSetImage($b, @TempDir & "\mozilla-firefox1.jpg") 
GUISetState() 
  
while 1     
 sleep(1000) 
WEnd   

func close()    
 Exit 
EndFunc

Edited by Zedna
Link to comment
Share on other sites

Should I use @TempDir? I have this file on desktop so maybe @DesktopDir? I covered it to bmp and launched ur script and it don't work. Maybe my comp  is haunted :)

Try it without FileInstall() first to see base concept is working.

#include <GUIConstantsEx.au3>
#include <ButtonConstants.au3> 
#include <WindowsConstants.au3>  

Opt("GUIOnEventMode", 1)  

;~ FileInstall("C:\Users\MARCIN\Desktop\mozilla-firefox1.bmp", @TempDir & "\mozilla-firefox1.bmp")   

GUICreate("Toolbar", 250, 250) 
GUISetOnEvent($GUI_EVENT_CLOSE, "close")
$b=GUICtrlCreateButton("MOZILLA", 10, 170, 100, 70, $BS_BITMAP) 
;~ GUICtrlSetImage($b, @TempDir & "\mozilla-firefox1.bmp") 
GUICtrlSetImage($b, "C:\Users\MARCIN\Desktop\mozilla-firefox1.bmp") 
GUISetState() 
  
while 1     
 sleep(1000) 
WEnd   

func close()    
 Exit 
EndFunc
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

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...