以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  鼠标的位置问题  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=79153)

--  作者:ljh29206
--  发布时间:2015/12/25 10:20:00
--  鼠标的位置问题
我设置了 开启后系统直接打开。


但开机后,鼠标会自动置于桌面的右下角(win7系统 右下角是显示桌面)

导致系统不能正常显示。

请教如何使鼠标移动到右上角

--  作者:大红袍
--  发布时间:2015/12/25 10:22:00
--  

 http://www.foxtable.com/bbs/dispbbs.asp?BoardID=2&ID=77775&skin=0

 


--  作者:大红袍
--  发布时间:2015/12/25 10:40:00
--  

模拟鼠标点击参考

 

全局代码

 

Public Declare Sub mouse_event Lib "user32" (ByVal dwFlags As Long, ByVal dx As Long, ByVal dy As Long, ByVal cButtons As Long, ByVal dwExtraInfo As Long)
Public const MOUSEEVENTF_MOVE As Int32 = &H1 \'  mouse move
Public const MOUSEEVENTF_LEFTDOWN As Int32 = &H2 \'  left button down
Public const MOUSEEVENTF_LEFTUP As Int32 = &H4 \'  left button up
Public const MOUSEEVENTF_RIGHTDOWN As Int32 = &H8 \'  right button down
Public const MOUSEEVENTF_RIGHTUP As Int32 = &H10 \'  right button up
Public const MOUSEEVENTF_MIDDLEDOWN As Int32 = &H20 \'  middle button down
Public const MOUSEEVENTF_MIDDLEUP As Int32 = &H40 \'  middle button up
Public const MOUSEEVENTF_ABSOLUTE As Int32 = &H8000 \'  absolute move
Public const MOUSEEVENTF_WHEEL As Int32 = &H800 \' wheel button rolled

<DllImport("user32.dll", EntryPoint := "SetCursorPos")> _
Public Function SetCursorPos(x As Integer, y As Integer) As Boolean

End Function

 

调用

 

SetCursorPos (599, 589) \'鼠标位置
mouse_event( MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0) \'点击
mouse_event (MOUSEEVENTF_LEFTUP, 0, 0, 0, 0)


--  作者:ljh29206
--  发布时间:2015/12/25 13:05:00
--  
袍哥找到问题了为什么开机启动后焦点没在系统上,
我之前请教过你网络连接的情况
我在beforeopenproject里面

Dim p As new Process()
p.StartInfo.FileName = "cmd.exe"
p.StartInfo.UseShellExecute = False \'关闭Shell的使用
p.StartInfo.RedirectStandardInput = True \'重定向标准输入
p.StartInfo.RedirectStandardOutput = True \'重定向标准输出
p.StartInfo.RedirectStandardError = True \'重定向错误输出
p.StartInfo.CreateNoWindow = True \'设置不显示窗口
p.Start()
p.StandardInput.WriteLine( "net use  \\\\192.168.44.202\\e TBFCfs.2109 /user:Administrator",0)
p.StandardInput.WriteLine("exit")
If FileSys.FileExists("\\\\192.168.44.202\\e\\空滤数据库\\空滤数据库.mdb") = False Then
MessageBox.Show("数据库连接失败,准备启动备用系统!,该情况请联系班长")
E.Cancel = True
End If
这个代码导致的,导致cmd一直在后台运行,应该怎么关掉,让焦点回到系统上

[此贴子已经被作者于2015/12/25 13:05:36编辑过]

--  作者:大红袍
--  发布时间:2015/12/25 14:24:00
--  

1、建议直接ping一下ip能不能通,不能通就退出好了

 

2、net use 在连接不上的时候,是会卡死十几秒的

 

3、不可能一直后台运行