Click here to Skip to main content
15,880,725 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have a VB .net Windows application and on certain click i want to open a VB6 application , I used "Shell" to open the VB6 exe successfully but its obvious opening the login page. As the user entered the login credentials in the application already I don't want user to key in the credentials agian.

My effort:
Dim startInfo As New ProcessStartInfo()
startInfo.UseShellExecute = False
startInfo.FileName = "POS.exe"
startInfo.UserName = "ADMIN"
Dim testString As New SecureString()
For Each ch As Char In "pass1234"
startInfo.Password = testString                       
Dim exe As Process = Process.Start(startInfo)

I did the above part in application and passed the UserName and password explicitly. But it is prompting the error as "Unkown UserName or bad password"

Do i need to amend Vb6 application too on the project load? or To create some GLOBAL parameter in VB6 to catch the UserName or Password sent from program and to check if these parameter exists then to perform the VB6 application's login screen's login button click.
Updated 23-Dec-13 19:39pm

1 solution

Since the VB6 app has no clue what a SecureString is you can't use it to pass the password as a parameter. VB6 can't decode it. You have no choice but to pass the string in clear text.

The UserName and Password fields in the ProcessStartInfo class are only used to tell Windows who to launch the process as. They do NOT get passed to the target application as any kind of login information for the application.

Chances are really good that you have to pass the credentials as clear text command line parameters, but it all depends entirely on what the VB6 app is expecting.
Share this answer
The Doer 26-Dec-13 4:37am    
Yes you are correct , finally i did this with the help of paramaters where User Name and password are in the plain text.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900