Results 1 to 31 of 31

Thread: [RESOLVED] How to make a login form please?

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Nov 2005
    Posts
    185

    Resolved [RESOLVED] How to make a login form please?

    Dear Experts,

    Has anyone know the code how to make a login form which the scenario like this...for an example, if I click words.exe, it will show up the pop up form to fill login and password before the .exe file opened...otherwise, it wont open...

    Thank you very much for your kind helps...

    Jennifer

  2. #2
    Fanatic Member lerroux's Avatar
    Join Date
    Nov 2005
    Location
    Welcome to the darkside... we have cookies
    Posts
    646

    Re: How to make a login form please?

    first, you have to construct a login form then make that form your startup form then make the code so that your main form wont show until you input the correct login information
    WARNING: Excessive coding is dangerous to your health... if symptoms persist insult your doctor...

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Nov 2005
    Posts
    185

    Re: How to make a login form please?

    Quote Originally Posted by lerroux
    then make that form your startup form
    What do you mean by this please..???..for instance, I only would like to show this login form for Microsoft Words only....

    Please explain to me more....

    Thank you very much..

    Jennifer

  4. #4
    Hyperactive Member
    Join Date
    Oct 2005
    Posts
    294

    Re: How to make a login form please?

    Use WinRAR, RAR them and password the RAR.

  5. #5
    Fanatic Member lerroux's Avatar
    Join Date
    Nov 2005
    Location
    Welcome to the darkside... we have cookies
    Posts
    646

    Re: How to make a login form please?

    you mean you want to make login forms for another app? like winword?
    WARNING: Excessive coding is dangerous to your health... if symptoms persist insult your doctor...

  6. #6

    Thread Starter
    Addicted Member
    Join Date
    Nov 2005
    Posts
    185

    Re: How to make a login form please?

    Yes...what I mean is to make a login form for any kind of .exe files...my question is, I dont know how to put this form into the start up...Would you please explain to how..???

    Thanks a lot...

  7. #7
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: How to make a login form please?

    You could rename the word.exe to something that you only know, and then name your app word.exe, so that all shortcuts point to your app. Then, if they log in correctly, you would shell (and possibly pass along command$) the word.exe that had been renamed. You would also have to mimic the command$ if the user decided to just right click on a document and select PRINT only.

    The other option, would be to write your own explorer, but that would be a lot of work. It'd be worth it if you want to control other apps as well.

    If you have XP Pro, you could password protect the WORD folder, so that only the correct user could access the files.

    Because word interacts with so many things, it might be a better idea to just include it for a particular user. Others wouldn't have it on thier menu, and you could configure Outlook to not use word for them, for instance.

  8. #8

    Thread Starter
    Addicted Member
    Join Date
    Nov 2005
    Posts
    185

    Re: How to make a login form please?

    Hi,

    Thanks for all of your inputs...But, I would like to make it a login form using vb...and I really need the code please...????

    Thanks,

  9. #9
    Frenzied Member Jmacp's Avatar
    Join Date
    Jul 2003
    Location
    UK
    Posts
    1,959

    Re: How to make a login form please?

    Depends on how secure you need it. There would be loads of ways to get around for an app like word. One way to do it would be to use a file packer and pack your app and the exe into one file, when run your app would open first with the login form... if the details are put in wrong then dont unpack the exe etc.. winrar with a password is the same idea.

  10. #10

    Thread Starter
    Addicted Member
    Join Date
    Nov 2005
    Posts
    185

    Re: How to make a login form please?

    How about like this...

    On the desktop, when you double click on the .exe file, let say words.exe...then before it open, it will show first the pop up window form for login and password...if the username and password are correct, then it will call the "word.exe" file otherwise if it is wrong, it will close the form and wont open the word.exe.....

    What is the code behind this login form created by VB please..???

    Thanks,

  11. #11
    Frenzied Member Jmacp's Avatar
    Join Date
    Jul 2003
    Location
    UK
    Posts
    1,959

    Re: How to make a login form please?

    VB Code:
    1. Private Sub Command1_Click()
    2.     If text1.Text = "password" Then
    3.         Shell "c:\program files\words.exe"
    4.     Else
    5.         MsgBox "wrong password"
    6.     End If
    7. End Sub

  12. #12
    Addicted Member
    Join Date
    Jan 2006
    Location
    PUNE
    Posts
    222

    Re: How to make a login form please?

    Hi This is Code for Login Form

    Option Explicit
    Public rstat As String, delstr As String, Rowflag As String, Flag As String
    Private Sub cmdCancel_Click()
    cbousername = ""
    txtPassword = ""
    cboworkgroup = ""
    cboworkgroup.SetFocus
    End Sub
    Private Sub cmdclose_Click()
    Unload Me
    'MDImain.Picture1.Visible = True
    'MDImain.idea.Visible = True
    End Sub


    Private Sub cmdOK_Click()
    Dim CnDb As New ADODB.Connection
    Set CnDb = New ADODB.Connection
    CnDb.Open "Provider = Microsoft.Jet.OleDB.4.0;Data Source = C:\Program Files\Microsoft Visual Studio\VB98\Prepaid Management System\Login.mdb"

    Dim rsUser As ADODB.Recordset
    Dim sSQL As String
    Set rsUser = New ADODB.Recordset

    sSQL = "Select * From Userlogin Where User_name = '" & cbousername.Text & "' And User_password = '" & txtPassword.Text & "' And Workgroup = '" & cboworkgroup.Text & "'"
    rsUser.Open sSQL, CnDb
    If rsUser.EOF Then
    MsgBox " Password Entered is Invalid.......Try again!!!!", vbOKCancel
    txtPassword = ""
    txtPassword.SetFocus
    Else
    Frmlogin.Hide
    'MDImain.Picture1.Visible = True
    'MDImain.idea.Visible = True
    ' MDImain.Toolbar1.Enabled = True
    MDImain.StatusBar1.Panels(3).Text = cbousername.Text
    MDImain.StatusBar1.Panels(4).Text = cboworkgroup.Text
    Call MsgBox("Welcome to World of Prepaid... ", vbOKOnly + vbInformation + vbApplicationModal + vbDefaultButton1, "Welcome")

    End If
    End Sub
    Attached Files Attached Files

  13. #13

    Thread Starter
    Addicted Member
    Join Date
    Nov 2005
    Posts
    185

    Re: How to make a login form please?

    Quote Originally Posted by Jmacp
    VB Code:
    1. Private Sub Command1_Click()
    2.     If text1.Text = "password" Then
    3.         Shell "c:\program files\words.exe"
    4.     Else
    5.         MsgBox "wrong password"
    6.     End If
    7. End Sub
    Hi,

    It works..!!!...Thanks a lot...BUT, I have two questions:

    1. How to make the password fonts as star or dot (like usual symbol of password)..??

    2. How to make it like this: when I double click on WINWORD.exe it will show up this form first before opening WINWORD.exe...

    Thank you very much for your kind helps..

    Jennifer

  14. #14
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: How to make a login form please?

    Quote Originally Posted by zach007
    1. How to make the password fonts as star or dot (like usual symbol of password)..??
    Place a * in the PasswordChar property of the textbox.
    Quote Originally Posted by zach007
    2. How to make it like this: when I double click on WINWORD.exe it will show up this form first before opening WINWORD.exe...
    You would have to compile your program, and use it, rather than a desktop shortcut to execute Winword. If Word is stored locally, however, there will be nothing preventing anyone from navigating to the folder that WINWORD.EXE is stored in, and double clicking directly on it, which will bypass your program.

  15. #15

    Thread Starter
    Addicted Member
    Join Date
    Nov 2005
    Posts
    185

    Re: How to make a login form please?

    Hi,

    Thanks a lot for your reply...However, is it possible to play with regedit to make this happen please..???

  16. #16
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: How to make a login form please?

    Quote Originally Posted by zach007
    Hi,

    Thanks a lot for your reply...However, is it possible to play with regedit to make this happen please..???
    If you are asking about the possibilities of having your program executed when someone double clicks on WINWORD.EXE, I don't think so.

  17. #17
    Frenzied Member Jmacp's Avatar
    Join Date
    Jul 2003
    Location
    UK
    Posts
    1,959

    Re: How to make a login form please?

    Store winword.exe in a resource file (see my sig on how to do this) and delete the original winword.exe then,

    1) Find the path to the original winword.exe c:\program files\msoffice\word\winword.exe etc.. and use this path is my code instead of,

    VB Code:
    1. App.Path & "\words.exe"
    in the line,

    VB Code:
    1. Open App.Path & "\words.exe" For Binary Access Write As #1

    and in the line,

    VB Code:
    1. Shell App.Path & "\words.exe"

    then add this code to your app,

    VB Code:
    1. Private Sub Command1_Click()
    2.  
    3.     If Text1.Text = "username" And Text2.Text = "password" Then
    4.       Dim b() As Byte
    5.         Open App.Path & "\words.exe" For Binary Access Write As #1
    6.         b = LoadResData(101, "custom")
    7.         Put #1, , b
    8.         Close #1
    9.         Shell App.Path & "\words.exe"
    10.     Else
    11.         MsgBox "wrong password"
    12.     End If
    13.  
    14. End Sub


    and run the app. You can extract resources from any exe(in this case the winword.exe file) unless you protect the exe against this.


    EDIT:
    Ok this isn't really goin to work as once you hav extracted the winword.exe then its there somebody could copy it or whatever so you would need need to find an app that prevented anybody copying or altering files in the office folder.

  18. #18
    PowerPoster jcis's Avatar
    Join Date
    Jan 2003
    Location
    Argentina
    Posts
    4,430

    Re: How to make a login form please?

    Quote Originally Posted by zach007
    Yes...what I mean is to make a login form for any kind of .exe files...my question is, I dont know how to put this form into the start up...Would you please explain to how..???...
    Any kind of Exe files?
    Why don't you just manage Windows permissions from Windows Profiles?, where only admins have open/execute rights with EXE files. That way you don't have to worry about creating password accounts, it would be all managed by Windows, and you won't need to use that login Form for EVERY exe file in the computer.

  19. #19

    Thread Starter
    Addicted Member
    Join Date
    Nov 2005
    Posts
    185

    Re: How to make a login form please?

    Hi,

    I know...I only want to know if I create in VB...that is it...anyone knows who can put this login.exe in registry...I mean can I play with the registry..???

  20. #20
    PowerPoster
    Join Date
    Feb 2002
    Location
    Canada, Toronto
    Posts
    5,803

    Re: How to make a login form please?

    Quote Originally Posted by dglienna
    You could rename the word.exe to something that you only know, and then name your app word.exe, so that all shortcuts point to your app.
    That gave me an idea.

    In the ZIP attached, you will find 2 applications, AppPassword is the one that is asking for the log in, and App1 is my test application (I tested this on the App1 test app so that I don't delete real applications by mistake)
    I tested it with a real application like WinAmp, and it worked also.

    The main program is AppPassword.
    You HAVE to compile before you do anything...
    (For testing compile the App1 application also)

    There are 2 logins you can type:
    Admin - pass09 (actually it's "pass" and todays date)
    user - pass09 (pass & todays date)

    Run the AppPassword, and type the Admin user and password.
    Browse for the EXE you want to protect, then lcik on "Password Protect EXE"
    Hopefully there won't be any problems.
    When you get the "Done !" mesage box, click OK

    Now you can run the application you wanted to password protect, and type "user" username and passord.
    And the applicated that is protected will run.

    How it works:
    The program copies itself as the same file name as the file you want to protect, and it copies the real application as an ADS file.
    When you enter the right username and password it will shell the reall application.
    Attached Files Attached Files
    Last edited by CVMichael; Jan 10th, 2006 at 12:27 PM.

  21. #21
    PowerPoster
    Join Date
    Feb 2002
    Location
    Canada, Toronto
    Posts
    5,803

    Re: How to make a login form please?

    So, no one likes it ? I thought it was a pretty good idea

  22. #22

    Thread Starter
    Addicted Member
    Join Date
    Nov 2005
    Posts
    185

    Re: How to make a login form please?

    Hi...dont be sad...I will try it, I just wanna try it now...I will get back to you once I have tried...so, wait for a while...

  23. #23

    Thread Starter
    Addicted Member
    Join Date
    Nov 2005
    Posts
    185

    Re: How to make a login form please?

    Hi,

    When I tried to make .EXE project, there are two errors:

    VB Code:
    1. If chkBackup.Value = 1 Then
    2.         Name Me.txtFileName.Text As RightLeft(Me.txtFileName.Text, ".") & "_bak.exe"
    3.     End If

    and it highlighted with blue in "RightLeft"

    and:

    VB Code:
    1. Shell App.Path & "\" & App.EXEName & ".exe:" & App.EXEName & ".exe", vbNormalFocus

    For this statement, all are highlighted in yellow...

    What is wrong with this..????

  24. #24
    PowerPoster
    Join Date
    Feb 2002
    Location
    Canada, Toronto
    Posts
    5,803

    Re: How to make a login form please?

    Ups, I forgot to include the attached module in the zip...

    Add this module to the project

    Sorry...

    [Edit], I modified the previous post, and included this module in it also...
    Attached Files Attached Files
    Last edited by CVMichael; Jan 10th, 2006 at 12:28 PM.

  25. #25
    PowerPoster
    Join Date
    Feb 2002
    Location
    Canada, Toronto
    Posts
    5,803

    Re: How to make a login form please?

    Quote Originally Posted by zach007
    VB Code:
    1. Shell App.Path & "\" & App.EXEName & ".exe:" & App.EXEName & ".exe", vbNormalFocus

    For this statement, all are highlighted in yellow...

    What is wrong with this..????
    It will work after you fix the problem with missing module.

  26. #26

    Thread Starter
    Addicted Member
    Join Date
    Nov 2005
    Posts
    185

    Re: How to make a login form please?

    Sorry, what do you mean by missing module please..??..Would you please explain to me in further detail..???

  27. #27
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: How to make a login form please?

    Add the last module (bas file) to the app program's folder, then open up the IDE, and add a module. Select the new module, save the project, and try running it again.

  28. #28

    Thread Starter
    Addicted Member
    Join Date
    Nov 2005
    Posts
    185

    Re: How to make a login form please?

    Hi,

    I really dont know what you mean..honest...Why dont you put example codes or codes which is better to understand by me...

    Thanks...

  29. #29
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: How to make a login form please?

    Just download the module that CV posted in post #24, and follow my previous instructions. He forgot to include it in the zip file that you were trying to run, and added it in post #24. To add the module to a project, click Project on the menu of the IDE, and click Add Module, then select the Existing Tab. If you added it to the same folder the rest of the code is in, you will see it. Click on it, and this will add it to your project. Save it, and run it. (compile it first if that's what he said. I forget right now.)

    Modules are just common blocks of code that you can use in multiple projects, so you don't have to re-write everything from scratch for each project.

    EDIT: He did say that you have to compile this project, and also the App1 project (which is password protected) You can then use any .exe, but for testing, use the App1.exe that gets compiled from the App1 project.

  30. #30
    PowerPoster
    Join Date
    Feb 2002
    Location
    Canada, Toronto
    Posts
    5,803

    Re: How to make a login form please?

    Thanks for the help DG, I was very busy today, so I did not had time to check my messages until now...

  31. #31
    Addicted Member
    Join Date
    Sep 2002
    Posts
    146

    Re: How to make a login form please?

    Quote Originally Posted by Jmacp
    Store winword.exe in a resource file (see my sig on how to do this) and delete the original winword.exe then,

    1) Find the path to the original winword.exe c:\program files\msoffice\word\winword.exe etc.. and use this path is my code instead of,

    VB Code:
    1. App.Path & "\words.exe"
    in the line,

    VB Code:
    1. Open App.Path & "\words.exe" For Binary Access Write As #1

    and in the line,

    VB Code:
    1. Shell App.Path & "\words.exe"

    then add this code to your app,

    VB Code:
    1. Private Sub Command1_Click()
    2.  
    3.     If Text1.Text = "username" And Text2.Text = "password" Then
    4.       Dim b() As Byte
    5.         Open App.Path & "\words.exe" For Binary Access Write As #1
    6.         b = LoadResData(101, "custom")
    7.         Put #1, , b
    8.         Close #1
    9.         Shell App.Path & "\words.exe"
    10.     Else
    11.         MsgBox "wrong password"
    12.     End If
    13.  
    14. End Sub


    and run the app. You can extract resources from any exe(in this case the winword.exe file) unless you protect the exe against this.


    EDIT:
    Ok this isn't really goin to work as once you hav extracted the winword.exe then its there somebody could copy it or whatever so you would need need to find an app that prevented anybody copying or altering files in the office folder.

    My project is very similar to this..

    My major concern, however, is how to prevent the user from copying the 'extracted' exe file..

    I'm still having tough time to make the login application delete back the extracted exe file once the user exits.


    How about using OLE to embed the exe file?

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