盼vb高人指点:以下操作能否实现,如何实现????
当前状况:有A.exe,B.exe两文件(已经固化不能再重新编写),B.exe是连接网络的,A运行时调用B,当网络不通时跳出B.EXE的界面(要求输入IP、数据库用户名/密码,这样很容易让用户知道数据库的信息存在安全隐患)。
问题:想用VB写个小程序控制B.EXE文件的运行,即当B要跳出界面时提示“数据库连接出错请稍候”,不让B.EXE的界面出现?请问请高人示例指点如何实现??!!!(懂一点vb,写个一点小程序),急啊???
{如同拨号上网一样,当网络断开了跳出了拨号软件界面,现在想写个小程序让拨号软件界面不出现,直接提示网络已断开!!}
[最优解释]
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Sub Timer1_Timer()
Const NILL = 0&
Const WM_SYSCOMMAND = &H112
Const SC_CLOSE = &HF060
lpClassName$ = "SciCalc"
lpCaption$ = "计算器" ’程序B的名称
Handle = FindWindow(lpClassName$, lpCaption$) '找到程序B的句柄
X& = SendMessage(Handle, WM_SYSCOMMAND, SC_CLOSE, NILL) '关闭程序B
MsgBox "数据库连接出错请稍候"
Timer1.Enabled = False
End Sub