Results 1 to 6 of 6

Thread: Replace Splash Screen Image

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2000
    Location
    Auckland, NZ
    Posts
    411

    How about a none technical solution?

    There is no doubt a way to do what you are trying to do, but in the meantime, here is an all-vb method for you.

    To Test:
    On a Form with a picturebox and a command button, add the following code.

    1) Edit the code to point to an image file you want to use
    2) Compile the code and note the exe byte size.
    3) Edit the code and change the offset value in the SaveSpashImage Sub
    4) Compile the code again
    5) Copy the exe to another name like Tester.exe
    6) Run Tester.exe and hit the append button.
    7) Run Project1 and observe your splash image is present when the form loads.

    Code:
    Option Explicit
    
    
    Private Sub SaveSplashImage()
      Dim f, offset As Long
      Dim picFile, exeFile As String
      ' this is the file to use as the splash image
      picFile = "d:\!dev\bitmaps\snslogo-sm.jpg"
      
      ' this is the exe file you already have
      exeFile = "d:\!dev\vb-world\SaveSplashImage\Project1.exe"
      
      ' this is the known length of the exe file
      offset = 20480
      'offset = 24576
      
      ' dim an array of bytes that will hold the image
      ReDim bytes(FileLen(picFile)) As Byte
      
      
      f = FreeFile
      Open picFile For Binary As #f
        ' read the image
        Get #f, , bytes
      Close #f
      
      f = FreeFile
      Open exeFile For Binary As #f
        ' write the image
        Put #f, offset, bytes
      Close #f
      
    End Sub
    Private Sub GetSplashImage()
      Dim f, offset As Long
      Dim picFile, exeFile As String
      ' this is a temporary file
      picFile = "c:\tmp.jpg"
      
      ' this is the exe that is running
      exeFile = App.Path & "\" & App.EXEName & ".exe"
      
      ' this is the known length of the exe
      offset = 20480
      
      ' byte array to store the image
      ReDim bytes(FileLen(exeFile) - offset) As Byte
      
      f = FreeFile
      Open exeFile For Binary As #f
        ' read the image
        Get #f, offset, bytes
      Close #f
      
      f = FreeFile
      Open picFile For Binary As #f
        ' save the image as a tmp file
        Put #f, , bytes
      Close #f
        
      On Error Resume Next
      ' use vb to read the image
      Set Picture1.Picture = LoadPicture(picFile)
      
      ' kill the tmp file
      Kill picFile
      
      On Error GoTo 0
    End Sub
    
    
    Private Sub Command1_Click()
      SaveSplashImage
    End Sub
    
    Private Sub Form_Load()
      GetSplashImage
    End Sub
    Hope it is useful
    Paul Lewis

  2. #2
    Member
    Join Date
    Sep 2000
    Posts
    51

    Mmmmm

    Well maybe I dont understand what you want to do but wouldnt it be waaaaay more simple to get the program to load a .bmp that isnt in the exe. Just get your other program to change that bitmap. If there's text not in the bitmap, just put the company name in a textfile read by the program.
    Oro?

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2000
    Location
    Auckland, NZ
    Posts
    411

    That would be too easy

    Dark Rain,

    I think that would make it too easy for non System Integrators to modify the bitmap. Presumably there is a sound marketing reason for mct wanting to give this feature only to certified users of his product.

    Cheers
    Paul Lewis

  4. #4
    Member
    Join Date
    Sep 2000
    Posts
    51

    Oooops

    Well I didnt think it was important non sys-user couldnt modify it. Well you can always change the extension of the .bmp to I dont know, .rsc or say it's a .gif while it's a bmp. The average user wont know.
    Oro?

  5. #5

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2000
    Location
    Auckland, NZ
    Posts
    411

    True enough

    Another technique is to add a sequence of bytes to the start of the image file which your program strips off. This is what I do in an app where jpegs are being stored and retrieved from VB in an Access DB.

    The advantage of Dark Rain's idea is that at least this way your application will remain the same size regardless of what bitmap is used.

    Cheers
    Paul Lewis

  6. #6
    Guest
    Change the Splash Screen? Easy!

    All you have to do (and not even API) is make a bitmap and place it as 256 colors with the name logo.sys in the Windows Folder.

    If you want to find the winfolder, use GetWinPathDir (or something like that, I can't remember well).

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width