Jump to content

FileInstall and GUI questions


Recommended Posts

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?

Link to comment
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.

Link to comment
Share on other sites

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
Link to comment
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")
Link to comment
Share on other sites

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
Link to comment
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.
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...