|
-
Oct 17th, 2001, 08:30 AM
#1
Thread Starter
Hyperactive Member
Calling an app within an app
Hi everyone!
Ok, let me get down to business . I have created two separate, independent apps. I want to call one from the other application. I know how to call it but I need to know how can I get the called application to automatically log in with a username and password.
Initially, the called app, if used independently, will start with a login screen. I want to bypass that when I call the app through my other app. Any ideas out there? Thanks in advance. I hope I have not confused anyone.
-vbuser1976 
VB6 Enterprise SP6
SQL 7.0 SP2
VBScript, HTML, Javascript, C++, a little UNIX
-
Oct 17th, 2001, 08:32 AM
#2
Frenzied Member
You can send the username and password as the command line arguments. Then add code in the other application that will check if the username and password are correct. If so, show the main form instead of the login screen.
-
Oct 17th, 2001, 08:32 AM
#3
Frenzied Member
Re: Calling an app within an app
Originally posted by vbuser1976
Hi everyone!
Ok, let me get down to business . I have created two separate, independent apps. I want to call one from the other application. I know how to call it but I need to know how can I get the called application to automatically log in with a username and password.
Initially, the called app, if used independently, will start with a login screen. I want to bypass that when I call the app through my other app. Any ideas out there? Thanks in advance. I hope I have not confused anyone.
Use command to pass data to another programm
oh1mie/Vic

-
Oct 17th, 2001, 08:38 AM
#4
Thread Starter
Hyperactive Member
hmm...
Originally posted by vbgladiator
...Then add code in the other application that will check if the username and password are correct. If so, show the main form instead of the login screen.
Can you please show me an example of this? For assignment of parameters, do I use the name of the textbox or create a global variable name?
-vbuser1976 
VB6 Enterprise SP6
SQL 7.0 SP2
VBScript, HTML, Javascript, C++, a little UNIX
-
Oct 17th, 2001, 08:43 AM
#5
Frenzied Member
Use Command$ in the called application to get the command line arguments. You can separate the username and password by a comma to easily separate them.
In you startup routine.
Code:
dim sArgs as string
sArgs = Command$
If len(sArgs) = 0 then 'username and password wasn't send
LoginForm.Show
else
'username and password was sent. Check for the username and password if they are correct. If so then
MainForm.Show
end if
-
Oct 17th, 2001, 09:14 AM
#6
Thread Starter
Hyperactive Member
need more info...
Thank you for your input. First, what should the line calling the app look like? This is what I have so far:
Shell "C:\Program Files\Folder1\express.exe" what do I add after this to let the app know that I am passing parameters?
Second, how do I , or do I need to, assign these parameters to variables in the called app for it to check the connection(verify the username and password)? Sorry for asking you these questions, I feel like a dunce .
Thanks again for all your input.
-vbuser1976 
VB6 Enterprise SP6
SQL 7.0 SP2
VBScript, HTML, Javascript, C++, a little UNIX
-
Oct 17th, 2001, 09:21 AM
#7
Frenzied Member
First Line - Shell "C:\Program Files\Folder1\express.exe UserName,Password
Yes, you do need to assign these to variables.
Code:
dim sUser as string
dim sPass as string
sUser = Left$(Instr(1,command$, ",") -1)
sPass = Left$(Instr(1,command$, ",")+1)
Now, check if they're correct
You might have to play with -1 and +1. I'm not doing this on a computer.
-
Oct 17th, 2001, 11:17 AM
#8
Thread Starter
Hyperactive Member
getting an error...
I am getting an error with the code above. Here it is:
Compile error:
Variable required - can't assign to this expression.
the 'this' the error speaks of is : Command$. I don't think this works in VB6, it might work if you are using Access to create apps, but I am not. Any ideas? thanks again.
-vbuser1976 
VB6 Enterprise SP6
SQL 7.0 SP2
VBScript, HTML, Javascript, C++, a little UNIX
-
Oct 17th, 2001, 11:25 AM
#9
Fanatic Member
Change the following:
VB Code:
sUser = Left$(command$, Instr(1,command$, ",") -1)
'Changed this after inital post
sPass = Right$(command$, Len(command$) - Instr(1,command$, ",")+1)
Chris
Chris
Master Of My Domain
Got A Question? Look Here First
-
Oct 17th, 2001, 03:01 PM
#10
Thread Starter
Hyperactive Member
THANX!
Thank you all! That was what I was looking for. The Right$ code needed a little tweaking (i.e. not including the " + 1" at the end) but it is working.
Kudos to you all!
-vbuser1976 
VB6 Enterprise SP6
SQL 7.0 SP2
VBScript, HTML, Javascript, C++, a little UNIX
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
|