dcsimg


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3
  1. #1
    Join Date
    Aug 2004
    Posts
    43,023

    Run-time Compile ????

    [Originally posted by Camilo]

    Hi! I'm searching for a way to allow the user change certain text that is within the executable file, and then recompile the program with the new text and send this program by email. Have you seen those messagemates? I want to do somehing similar to that.

    Any help would be GREATLY appreciated!!!

  2. #2
    Join Date
    Aug 2004
    Posts
    43,023

    Re:Run-time Compile ????

    [Originally posted by Andrea Batina]

    You can change the text in your program using Hex Editor or you can make a language file.

    Andrea Batina

  3. #3
    Join Date
    Aug 2004
    Posts
    43,023

    Re:Run-time Compile ????

    [Originally posted by neophile]

    Append it to the end of the executable and have your program look for it at the end of itself. Write your program to look at the last byte of itself. If this is zero, this means it's blank.... any other value will tell you that it has been modified.

    Here's some code I threw together based on some tests I did plus some stuff I read (I would have never come across this if it wasn't for you... thanks=):

    Public Function ReadMyText() As String
    Dim fn As Integer
    Dim bLen As Byte
    fn = FreeFile
    Open App.Path & "\" & App.EXEName & ".exe" For Binary Access Read As fn
    Get fn, LOF(fn), bLen
    If bLen > 0 Then
    ReadMyText = Space(bLen)
    Get fn, LOF(fn) - bLen, ReadMyText
    End If
    Close fn
    End Function

    Public Sub CreateNewCopy(ByVal NewName As String, Optional ByVal Text As String)
    Dim fn As Integer
    Dim lSize As Long
    Dim bCopy() As Byte
    Dim bLen As Byte
    If LCase(App.EXEName) <> LCase(NewName) And NewName <> "" Then
    lSize = FileLen(App.Path & "\" & App.EXEName & ".exe")
    fn = FreeFile
    Open App.Path & "\" & App.EXEName & ".exe" For Binary Access Read As fn
    Get fn, lSize, bLen
    If bLen = 0 Then
    ReDim bCopy(lSize - 1) As Byte
    Else
    ReDim bCopy(lSize - bLen - 2) As Byte
    End If
    Get fn, 1, bCopy
    Close fn
    fn = FreeFile
    Open App.Path & "\" & NewName & ".exe" For Binary Access Write As fn
    Put fn, , bCopy
    bLen = Len(Text)
    If bLen > 0 Then
    Put fn, , CByte(0)
    Put fn, , Text
    Put fn, , bLen
    End If
    Close fn
    End If
    End Sub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center