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...
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...
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..???
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.
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.
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..???
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")
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.
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.
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:
App.Path & "\words.exe"
in the line,
VB Code:
Open App.Path & "\words.exe" For Binary Access Write As #1
and in the line,
VB Code:
Shell App.Path & "\words.exe"
then add this code to your app,
VB Code:
Private Sub Command1_Click()
If Text1.Text = "username" And Text2.Text = "password" Then
Dim b() As Byte
Open App.Path & "\words.exe" For Binary Access Write As #1
b = LoadResData(101, "custom")
Put #1, , b
Close #1
Shell App.Path & "\words.exe"
Else
MsgBox "wrong password"
End If
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.
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.
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..???
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.
Last edited by CVMichael; Jan 10th, 2006 at 12:27 PM.
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.
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.
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:
App.Path & "\words.exe"
in the line,
VB Code:
Open App.Path & "\words.exe" For Binary Access Write As #1
and in the line,
VB Code:
Shell App.Path & "\words.exe"
then add this code to your app,
VB Code:
Private Sub Command1_Click()
If Text1.Text = "username" And Text2.Text = "password" Then
Dim b() As Byte
Open App.Path & "\words.exe" For Binary Access Write As #1
b = LoadResData(101, "custom")
Put #1, , b
Close #1
Shell App.Path & "\words.exe"
Else
MsgBox "wrong password"
End If
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.