Foxtable(狐表)用户栏目专家坐堂 → 模拟ctrl +Space 按键怎么写?


  共有2060人关注过本帖树形打印复制链接

主题:模拟ctrl +Space 按键怎么写?

帅哥哟,离线,有人找我吗?
有点甜
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2017/8/4 15:22:00 [显示全部帖子]

要写一堆代码,红色代码,写到afterOpenProject即可

 

Dim typeForKeywords As Type = Type.[Gettype]("System.Windows.Forms.SendKeys+KeywordVk[], System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")

Dim typeForKeywordItem As Type = Type.[Gettype]("System.Windows.Forms.SendKeys+KeywordVk, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")
Dim objNewKey As Object = Activator.CreateInstance(typeForKeywordItem, "SPACE", &H20)

Dim typeForSendKeys As Type = Gettype(SendKeys)

Dim fieldForkeywords As System.Reflection.FieldInfo = typeForSendKeys.GetField("keywords", System.Reflection.BindingFlags.NonPublic Or System.Reflection.BindingFlags.GetField Or System.Reflection.BindingFlags.[Static])
Dim objKeys As Object = fieldForkeywords.GetValue(Nothing)

Dim typeForlistForKeyword As Type = Type.[Gettype]("System.Collections.Generic.List`1[[System.Windows.Forms.SendKeys+KeywordVk, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]], mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")
Dim objForTmpKeyWords As Object = Activator.CreateInstance(typeForlistForKeyword)

Dim mi As System.Reflection.MethodInfo = typeForlistForKeyword.GetMethod("Add")

For Each var As Object In DirectCast(objKeys, Array)
    'list.Add(var);
    mi.Invoke(objForTmpKeyWords, New Object() {var})
Next

'list.Add(key);
mi.Invoke(objForTmpKeyWords, New Object() {objNewKey})

mi = typeForlistForKeyword.GetMethod("ToArray")
Dim objArray As Object = mi.Invoke(objForTmpKeyWords, Nothing)
fieldForkeywords.SetValue(Nothing, objArray)

 

SendKeys.Send("^{Space}")


 回到顶部