简体   繁体   English

使用VB .Net应用程序登录凭据调用VB6 exe

[英]Calling VB6 exe using VB .Net applications login credentials

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. 我有一个VB .net Windows应用程序,单击某些按钮我想打开一个VB6应用程序,我使用“ Shell”成功打开了VB6 exe,但显然可以打开登录页面。 As the user entered the login credentials in the VB.net application already I dont want user to key in the credentials agian. 当用户已经在VB.net应用程序中输入登录凭据时,我不希望用户键入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"
    testString.AppendChar(ch)
Next
startInfo.Password = testString                       
Dim exe As Process = Process.Start(startInfo)

I did the above part in VB.net application and passed the UserName and password explicitly. 我在VB.net应用程序中完成了以上部分,并显式传递了用户名和密码。 But it is prompting the error as "Unkown UserName or bad password" . 但是,它提示错误为“用户名未知或密码错误

Do i need to amend Vb6 application too on the project load? 我是否也需要在项目负载上修改Vb6应用程序? or To create some GLOBAL parameter in VB6 to catch the UserName or Password sent from VB.net program and to check if these parameter exists then to perform the VB6 application's login screen's login button click. 或要在VB6中创建一些GLOBAL参数以捕获从VB.net程序发送的用户名或密码,并检查这些参数是否存在,请执行VB6应用程序的登录屏幕的登录按钮,单击。

In VB6 you'll have to tell it to use the arguments you're passing to it, otherwise it will ignore them. 在VB6中,您必须告诉它使用传递给它的参数,否则它将忽略它们。 Mind you, if you have access to the source use this as a workaround until you port it to .net so that it can be part of your existing project. 请注意,如果您有权访问源,请使用此方法作为变通办法,直到将其移植到.net,以便它可以成为现有项目的一部分。 There are very few things that you could do with VB6 that you can't with .net. .B几乎没有VB6可以做的事情。 To process command line arguments in VB6,. 在VB6中处理命令行参数。 I think you want the Command Function . 我认为您需要Command Function

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM