Sign in to follow this  
Followers 0
CalonMerc

FileInstall and GUI questions

14 posts in this topic

If FileExists(@ProgramFilesDir & "\W7VRadio\") Then
    If NOT FileExists(@ProgramFilesDir & "\W7VRadio\RadioBG.png") Then
        FileInstall("C:\Users\Calon\Pictures\vdjneg.png", @TempDir & "\RadioBG.png")
        FileMove(@TempDir & "\RadioBG.png", @ProgramFilesDir & "\W7VRadio\RadioBG.png")
        FileDelete(@TempDir & "\RadioBG.png")
    Else
        DirCreate(@ProgramFilesDir & "\W7VRadio\")
        FileInstall("C:\Users\Calon\Pictures\vdjneg.png", @TempDir & "\RadioBG.png")
        FileMove(@TempDir & "\RadioBG.png", @ProgramFilesDir & "\W7VRadio\RadioBG.png")
        FileDelete(@TempDir & "\RadioBG.png")
    EndIf
EndIf

My main question, is how can something basically the same as above be accomplished? This does not work and I don't know how to make it work. I am figuring that FileInstall cannot be within an IF or something, but I don't know.

Opt("GUIOnEventMode", 1)
$GUI = GUICreate("Win7Vista Radio", 300, 40, (@DesktopWidth - 315) / 2, (@DesktopHeight - 100) / 2, -1, BitOR($WS_POPUP, $WS_VISIBLE))
$BGPic = GUICtrlCreatePic(@ProgramFilesDir & "\W7VRadio\RadioBG.png",0,0)
$SongName = GUICtrlCreateLabel("Artist" & @CRLF & "Name", 60, 7, 150, 26)
$Volume = GUICtrlCreateSlider(200, 10, 100, 20)
GUICtrlSetData($Volume, 100)
$Play = GUICtrlCreateButton("Play", 10, 10, 40, 20)
$VolLevel = 100
GUISetOnEvent($GUI_EVENT_CLOSE, "Quit")
GUICtrlSetOnEvent($Play, "Play")

Is this the correct way to call up the image used earlier to be used as a background?

Share this post


Link to post
Share on other sites



GUICtrlCreatePic() not work with PNG images. Use Icons.au3 to resolve this problem.

#Include <Icons.au3>

Opt("GUIOnEventMode", 1)

$GUI = GUICreate("Win7Vista Radio", 300, 40, (@DesktopWidth - 315) / 2, (@DesktopHeight - 100) / 2, $WS_POPUP)
$BGPic = GUICtrlCreatePic("", 0, 0, (@DesktopWidth - 315) / 2, (@DesktopHeight - 100) / 2)
GUICtrlSetState(-1, $GUI_DISABLE)
_SetImage($BGPic, @ProgramFilesDir & "\W7VRadio\RadioBG.png")
$SongName = GUICtrlCreateLabel("Artist" & @CRLF & "Name", 60, 7, 150, 26)
$Volume = GUICtrlCreateSlider(200, 10, 100, 20)
GUICtrlSetData($Volume, 100)
$Play = GUICtrlCreateButton("Play", 10, 10, 40, 20)
$VolLevel = 100
GUISetOnEvent($GUI_EVENT_CLOSE, "Quit")
GUICtrlSetOnEvent($Play, "Play")
GUISetState()

But in this case it's easier save PNG as BMP and use it.

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

If FileExists(@ProgramFilesDir & "\W7VRadio\") Then
    If NOT FileExists(@ProgramFilesDir & "\W7VRadio\RadioBG.png") Then
        FileInstall("C:\Users\Calon\Pictures\vdjneg.png", @TempDir & "\RadioBG.bmp")
        FileMove(@TempDir & "\RadioBG.bmp", @ProgramFilesDir & "\W7VRadio\RadioBG.bmp")
        FileDelete(@TempDir & "\RadioBG.bmp")
    Else
        DirCreate(@ProgramFilesDir & "\W7VRadio\")
        FileInstall("C:\Users\Calon\Pictures\vdjneg.png", @TempDir & "\RadioBG.bmp")
        FileMove(@TempDir & "\RadioBG.bmp", @ProgramFilesDir & "\W7VRadio\RadioBG.bmp")
        FileDelete(@TempDir & "\RadioBG.bmp")
    EndIf
EndIf

Could I do this? the above source doesn't work to create the DIR or to move anything to it.

I created the dir manually, and it moved the file to it. Now I will try deleting it and seeing what happens.

Edited by CalonMerc

Share this post


Link to post
Share on other sites

I would have edited my post, but it won't let me edit it again.

I fixed the FileInstall part, I had messed up the first If statement.

But now, I get this in the folder (displayed from Windows).

This is the GUI that the picture is supposed to be the background of:

And this is the GUI source code I have currently:

$GUI = GUICreate("Win7Vista Radio", 300, 40, (@DesktopWidth - 315) / 2, (@DesktopHeight - 100) / 2, -1)
$BGPic = GUICtrlCreatePic(@ProgramFilesDir & "\W7VRadio\RadioBG.bmp",0,0)
$SongName = GUICtrlCreateLabel("Artist" & @CRLF & "Name", 60, 7, 150, 26)
$Volume = GUICtrlCreateSlider(200, 10, 100, 20)
GUICtrlSetData($Volume, 100)
$Play = GUICtrlCreateButton("Play", 10, 10, 40, 20)
$VolLevel = 100
GUISetOnEvent($GUI_EVENT_CLOSE, "Quit")
GUICtrlSetOnEvent($Play, "Play")

Share this post


Link to post
Share on other sites

I could try that, but I moved the pic from the tempdir to the programsdirectory. And shouldn't it work fine, I know the file is where I am calling it from. But might the locked file form prevent it from being used?

Share this post


Link to post
Share on other sites

Sorry, I am not sure how to work with that "locked file".... 8(

... someone will come along who knows what to do... 8)

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

Well, thanks for trying. I can't figure anything about the locked file.. it's NOT read-only.. I just tried to take ownership of the file, and the locked icon went away. How would I do that for a user's computer?

It was in a file conversion of mine, how do I make the GUIctrls have transparent backgrounds?

Edit: I got my label to have a transparent background (was in the help file), but how do I make a slider and a button be transparent? I want the button to still look like a button, just showing the image behind it.

Edited by CalonMerc

Share this post


Link to post
Share on other sites

I've been searching the forums now for about 3 hours straight to no avail. If anyone knows a quick way to make buttons and sliders transparent, please inform me. I tried a UDF that made them transparent, but moved them up a lot.

Share this post


Link to post
Share on other sites

I've been searching the forums now for about 3 hours straight to no avail. If anyone knows a quick way to make buttons and sliders transparent, please inform me. I tried a UDF that made them transparent, but moved them up a lot.

Not only that, but it did make the entire control transparent, I'm wanting just the background.

Share this post


Link to post
Share on other sites

Does anyone know a solution to this?

Share this post


Link to post
Share on other sites

Below your label or other you can put:

GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)

and it becomes transparent

i dont know if its your question

Bye

Share this post


Link to post
Share on other sites

I've tried that, but it doesn't work for the slider.

Share this post


Link to post
Share on other sites

Does anyone have any kind of solution to offer? I can't figure this out.

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