Link to home
Start Free TrialLog in
Avatar of mrcool4444
mrcool4444

asked on

Password

Is there anyway to make a password that is saved into the program?  I know how to make a external file and put a password in there, but I would rather like to put it in the programs.  Please help me!
Avatar of wongchun
wongchun

You can try to use "SaveSetting" to store the password in the run-time of the program.

And then use "GetSetting" to get back the password.

OR

If the password is fixed, you can hardcode in the coding.
You can save information to the end of an EXE file without affecting the execution of the EXE.  For example, lets say you have an 80 character string... Open the EXE in append mode and then write the string...

This example gets the 80 character string back out of itself while the EXE is running:

        'THIS CONSTANT MUST BE CHANGE TO THE SIZE
        'OF THE ATTACHED BUFFER IN BYTES
        Const AttachedBufferSize = 80
         
        Dim MySelfFnum As Long
        Dim MySelfExe As String
        Dim MySelfSize As Long
        Dim lByte As Byte
        Dim AttachedBuffer As String
         
        'BUILD THE PATH TO MYSELF
        MySelfExe = App.Path
        If Not Right$(MySelfExe, 1) = "\" Then MySelfExe = MySelfExe + "\"
        MySelfExe = MySelfExe + App.EXEName + ".EXE"
         
        'GET A FREE FILENUMBER TO OPEN MYSELF AND OPEN MYSELF
        MySelfFnum = FreeFile
        Open MySelfExe For Binary Access Read As MySelfFnum
         
         
        'FIND THE START OF THE ATTACHED BUFFER
        MySelfSize = LOF(MySelfFnum)
        Seek MySelfFnum, MySelfSize - AttachedBufferSize + 1
         
        'EXTRACT THE ATTACHED BUFFER
        AttachedBuffer = ""
        Do
            Get #MySelfFnum, , lByte
            If EOF(MySelfFnum) = True Then Exit Do
            AttachedBuffer = AttachedBuffer + Chr$(lByte)
        Loop
         
        'CLOSE THE EXE
        Close MySelfFnum
       
        'SHOW THE ATTACHED BUFFER IN A MSGBOX
        MsgBox AttachedBuffer




Cheers!
Avatar of mrcool4444

ASKER

No, this isn't what I want.  What I want is something that asks the user for a password and when they type in the correct password, they go into my app.  On the same screen that you type the password there would be a change password button.  When you click it, it opens another form and asks for the old password and then the new one.  I would like it to write this stuff in the exe.   I know how to do this but just it writing to a file!
ASKER CERTIFIED SOLUTION
Avatar of danelroisman
danelroisman

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial