首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > VB Dotnet >

vb.net 程序怎么使另一个应用程序从最小化变为最大化显示

2012-01-26 
vb.net 程序如何使另一个应用程序从最小化变为最大化显示!如题!SetForegroundWindowSendMessageFindWindow

vb.net 程序如何使另一个应用程序从最小化变为最大化显示!
如题!
SetForegroundWindow
SendMessage
FindWindow
showwindow
这些都结合使用过了,均无效果!哪位高手能帖段具体代码出来!测试通过立即给分!


[解决办法]
参考如下:
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As IntPtr
Private Declare Function SendMessage Lib "user32.dll" Alias "SendMessageA" (ByVal hwnd As Int32, ByVal wMsg As Int32, ByVal wParam As Int32, ByVal lParam As Int32) As Int32
Private Const WM_SYSCOMMAND As Int32 = &H112
Private Const SC_MAXIMIZE As Int32 = &HF030
Private Const SC_MINIMIZE As Int32 = &HF020
Private Const SC_RESTORE As Int32 = &HF120
Public Const SW_HIDE = 0
Public Const SW_SHOW = 5

Private Declare Function ShowWindow Lib "user32.dll" (ByVal hwnd As Int32, ByVal nCmdShow As Int32) As Int32

Dim MyApp As IntPtr = FindWindow(Nothing, "你的程序名")
ShowWindow(MyApp.ToInt32, SW_SHOW)
SendMessage(MyApp.ToInt32, WM_SYSCOMMAND, SC_MAXIMIZE, 0)

热点排行