使用VB .Net应用程序登录凭据调用VB6 exe [英] Calling VB6 exe using VB .Net applications login credentials

查看:119
本文介绍了使用VB .Net应用程序登录凭据调用VB6 exe的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个VB .net Windows应用程序,并且在某些点击我想打开一个VB6应用程序,我用Shell成功打开VB6 exe但是很明显打开登录页面。当用户在VB.net应用程序中输入登录凭证时,我不希望用户键入凭据agian。



我的努力:

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 VB.net 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"
    testString.AppendChar(ch)
Next
startInfo.Password = testString                       
Dim exe As Process = Process.Start(startInfo)





我在VB.net应用程序中完成了上述部分并明确传递了UserName和密码。但它提示错误为未知用户名或密码错误



我是否需要修改Vb6应用程序项目负载也是如此?或者在VB6中创建一些GLOBAL参数以捕获从VB.net程序发送的 UserName 密码并检查是否这些参数存在然后执行VB6应用程序的登录屏幕的登录按钮点击。



I did the above part in VB.net 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 VB.net program and to check if these parameter exists then to perform the VB6 application's login screen's login button click.

推荐答案

由于VB6应用程序不知道什么是SecureString你不能用它来将密码作为参数传递。 VB6无法解码它。您别无选择,只能以明文形式传递字符串。



ProcessStartInfo类中的UserName和Password字段仅用于告知Windows启动该过程的人员。它们不会作为应用程序的任何登录信息传递给目标应用程序。



很有必要将凭证作为明文命令传递行参数,但这完全取决于VB6应用程序的期望。
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.


这篇关于使用VB .Net应用程序登录凭据调用VB6 exe的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆