[Vb]我需要打开注册表并连接到计算机 [英] [Vb] I need to open registry and connect to a computer

查看:81
本文介绍了[Vb]我需要打开注册表并连接到计算机的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好我需要连接到计算机,但需要连接到注册表。



i得到了这个,但它只是打开注册表然后它什么也没做。







 Private Sub Button1_Click_3(发送者为对象,e为EventArgs)处理Button1.Click 


System.Diagnostics.Process.Start(regedit.exe)

System.Threading.Thread.Sleep(2000)

SendKeys.Send({%})
SendKeys.Send({ENTER})
SendKeys.Send({DOWN})
SendKeys.Send({ DOWN})
SendKeys.Send({DOWN})
SendKeys.Send({DOWN})
SendKeys.Send({ENTER})
SendKeys.Send(Hostname.Text)
SendKeys.Send({ENTER})

End Sub





我的尝试:



以下代码



ALT,ENTER,DOWN,DOWN,DOWN,DOWN,Hostname.text,ENTER



dosnt work

解决方
首先,你为什么要这么做?正确检索注册表项并使用它返回的值: Registry.GetValue方法(String,String,Object)(Microsoft.Win32) [ ^ ]

其次,你真的希望它能起作用吗? Regedit将要做的第一件事是启动阿联酋以获得用户编辑注册表的权限:你不能自己给出...


我认为你的SendKeys没有打开菜单正常。看起来你正在打开文件菜单并向下跳到菜单项4(连接网络注册表)。



关于SendKeys的一些信息 where(MSDN) where(Stack Overflow)



您正在发送ALT(按键会突出显示菜单)然后按ENTER(然后应该打开第一个菜单)。请尝试通过发送ALT + F打开文件菜单一个操作



所以而不是

 SendKeys.Send(  {%}
SendKeys.Send( {ENTER}



尝试

 SendKeys.Send( %{f}





还有一件事 - 你能澄清不行吗?应用程序是否打开?菜单是否突出显示但未选择?菜单是否完整?我提供了一个解决方案,我认为*可能是问题,但你的问题有点不清楚。



祝你好运,

格伦


Hello i need to connect to a computer but with the registry.

i got this, but it just open regedit and then it makes nothing.



Private Sub Button1_Click_3(sender As Object, e As EventArgs) Handles Button1.Click


      System.Diagnostics.Process.Start("regedit.exe")

      System.Threading.Thread.Sleep(2000)

      SendKeys.Send("{%}")
      SendKeys.Send("{ENTER}")
      SendKeys.Send("{DOWN}")
      SendKeys.Send("{DOWN}")
      SendKeys.Send("{DOWN}")
      SendKeys.Send("{DOWN}")
      SendKeys.Send("{ENTER}")
      SendKeys.Send(Hostname.Text)
      SendKeys.Send("{ENTER}")

  End Sub



What I have tried:

code below

ALT, ENTER, DOWN, DOWN, DOWN, DOWN, Hostname.text, ENTER

dosnt work

解决方案

First off, why would you want to do that? Retrieve the Registry entry properly and use the value it returns: Registry.GetValue Method (String, String, Object) (Microsoft.Win32)[^]
Secondly, did you really expect that to work? The first thing Regedit will do is kick up UAE to get user permission to edit the registry: and you can't give that yourself...


I think your SendKeys isn't opening the menu properly. Looks like you're opening the File menu and tabbing downwards to menu item 4 (Connect Network Registry).

Some information on SendKeys here (MSDN) and here (Stack Overflow)

You are sending ALT (which as a keystroke will highlight the menu) then ENTER (which should then open the first menu). Try instead to open the file menu in one operation by sending ALT+F

So instead of

SendKeys.Send("{%}")
SendKeys.Send("{ENTER}")


try

SendKeys.Send("%{f}")



Just one more thing - can you clarify "doesn't work"? Does the application open? Does the menu highlight but not select? Does the menu appear at all? I offer a solution to what I *think* might be the problem but your question is a little unclear.

Good luck,
Glen.


这篇关于[Vb]我需要打开注册表并连接到计算机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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