|
-
Nov 27th, 2000, 12:41 AM
#1
Thread Starter
Member
Hello,
I am currently in the process of writing a small application in VB6 that is intended to run in a modal form at the initialisation of the Windows GUI. It is thought that it would prompt the user for a name and password. On confirmation it closes and goes away, on false it shuts the machine down.
My trouble is i dont know how to utilise a file (such as psswd.ini) for the list of passwords and users.
It's does not need to be pGP thick, merely keeps children off the pc.
Any info on this problem or directions to good sites would be most welcomed.
Regards
Morpheus.
-
Dec 15th, 2000, 06:31 AM
#2
New Member
Hello Morpheus,
U need to use an API to manipulate an .INI file. But save Urself trouble and use the OPEN statement, besides, U just want a list of Users and Passwords so U can just manipulate a text file. U can use this example:
'U can use any path or file extensions.
'This will create a new file and put values in it.
'If U want to keep overwriting UR text file U can
'use OPEN "C:\USERS.LST" FOR OUTPUT AS #1 instead
Open "C:\USERS.LST" for append as #1
Print #1,"USER1"
Print #1,"PASSWORD1"
'U can substitue variables intead of "USER1"
Print #1,"USER2"
Print #1,"PASSWORD2"
Close #1
'To read UR textfile, U need to define variables
Dim sUser,sPassword as string
Open "C:\USERS.LST" for INPUT AS #1
DO 'use the Do Loop to Cycle each user and password
Input #1,sUser
Input #1,sPassword
If text1=sUser and text2=sPassword then
Close #1 'Do not forget to close the opened text file
End
end if
Loop Until EOF(1) 'Loop until user and pw is found or not
Close #1
'Well since text1 is not in the file
<PUT SHUTDOWN CODE HERE>
Hope this helps.
----------------------------------
If all fails, there must be a VINFOC - Virus In Front Of Computer
-- /\/\/C
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|