Preventing or hiding the Blitz3d console window?

Blitz3D Forums/Blitz3D Programming/Preventing or hiding the Blitz3d console window?

Greetings all,

I've written a small program in Blitz3d that simply changes the current desktop wallpaper to a random image stored in a specified directory (passed to the program via the command line).

Whenever the program is executed, a console window displays briefly on the screen.
How can I prevent this console window from appearing?

Here is the code:

; RXPWALL V0.1
; 
; (Windows XP only)
;
; * Randomly selects an image file from a specified directory (passed via the command line)
;   and sets it as the desktop background.
; 
; Useage example (if compiled to an .exe called 'rxpwall'):
;   rxpwall c:\mypicturefolder
;
; (Best to create a shortcut on your desktop or in your Startup folder)
;
; Thanks to Eikon for the API information: 
; (http://www.blitzbasic.com/codearcs/codearcs.php?code=1185)
;
; To compile with Blitz3d create a text file called 'user32.decls' in the Blitz3d userlibs
; directory and include the following two lines (minus the opening semi-colons):
;
; .lib "user32.dll"
; api_SystemParametersInfo% (uAction%, uParam%, lpvParam$, fuWinIni%) : "SystemParametersInfoA"
;
; (Note: the API call only works with .BMP files, not .JPG, .PNG, etc?)

Const SETDESKWALLPAPER% = 20
Const UPDATEINIFILE% = 1 	
Const SENDWININICHANGE% = 2	

Type tImageFile
  Field Path$
End Type

Global ImageFiles.tImageFile
Global Folder$ = CommandLine$()
If Right$(Folder$, 1) <> "" Then Folder$ = Folder$ + ""

Global FC

SeedRnd(MilliSecs())

FC = fnReadFiles(Folder$)

If FC > 0 Then fnSetBackground(Rand(1, FC))

For t.tImageFile = Each tImageFile
  Delete t
Next

End

Function fnReadFiles%(f$)

  dir = ReadDir(f$)
  If dir = 0 Then Return 0

  count = 0
  Repeat 

    file$ = NextFile(dir)
    If file$ = "" Then 
      Exit
    Else
      t$ = Right$(file$, 4)
      If t$ = ".jpg" Or t$ = ".bmp" Or t$=".png" Then 
        count = count + 1
        ImageFiles = New tImageFile
        ImageFiles\Path$ = file$
      EndIf
    EndIf

  Forever

  CloseDir dirFolder

  Return count

End Function

Function fnSetBackground(r)

  Local fnam$

  ImageFiles.tImageFile = First tImageFile

  For n = 1 To r - 1
    ImageFiles = After(ImageFiles)
  Next

  img = LoadImage(Folder$ + ImageFiles\Path$)
  fnam$ = Folder$ + "_rxpwall_.bmp"
  result = SaveImage(img, fnam$)
  FreeImage img

  If result <> 0 Then
    api_SystemParametersInfo(SETDESKWALLPAPER%, 0, fnam$, (UPDATEINIFILE% Or SENDWININICHANGE%))
  EndIf

End Function


This has been solved a while back.

Read through this thread.
http://www.blitzbasic.com/Community/posts.php?topic=37093#407919

Ah, thanks for the link Phil74. Halo's little BlitzEXEHacker worked a treat.

I thought I *did* a decent search of the forums - obviously I did not!

Thanks again...

haha.. i must've posted that link about 10 times so far to ppl asking :)