|
-
Jan 17th, 2002, 05:20 PM
#1
Thread Starter
Junior Member
Controlling a remote Dos window
Hello.
i need to controll a FULL SCREEN dos window remotly from my vb program.
i have no problem playing with it turning it to minimized mode, normal size mode, hidden mode
and also maximized size mode, (i am refering to the maximum dos window size while yu can still se behnd it the desktop)
i have a problem to handle it on its REAL FULL SIZE mode (like when you press Alt+Enter or change its shortcut properties to FULL SIZE)
this is what i have:
-----------------------
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function GetClassName Lib "user32" Alias "GetClassNameA" (ByVal hwnd As Long, ByVal lpClassName As String, ByVal nMaxCount As Long) As Long
Private Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long
Const SW_SHOWNORMAL = 1
Const gcClassnameMSWord = "OpusApp"
Const gcClassnameMSExcel = "XLMAIN"
Const gcClassnameMSIExplorer = "IEFrame"
Const gcClassnameMSVBasic = "wndclass_desked_gsk"
Const gcClassnameNotePad = "Notepad"
Const gcClassnameMyVBApp = "ThunderForm"
Public Sub GetClassNameFromTitle()
Dim sInput As String, hwnd As Long, lpClassName As String
Dim nMaxCount As Long, lresult As Long
nMaxCount = 256
lpClassName = Space(nMaxCount)
sInput = InputBox("Enter the exact window title:" + Chr$(13) + Chr$(10) + "Note: must be an exact match")
hwnd = FindWindow(vbNullString, sInput)
If hwnd = 0 Then
MsgBox "Couldn't find the window."
Else
lresult = GetClassName(hwnd, lpClassName, nMaxCount)
MsgBox "Window: " + sInput + Chr$(13) + Chr$(10) + "Classname: " + Left$(lpClassName, lresult)
fActivateWindowClass lpClassName
End If
End Sub
Public Function fActivateWindowClass(psClassname As String) As Boolean
Dim hwnd As Long
hwnd = FindWindow(psClassname, vbNullString)
If hwnd > 0 Then
ShowWindow hwnd, SW_SHOWNORMAL
fActivateWindowClass = True
End If
End Function
Private Sub Command1_Click()
GetClassNameFromTitle
End Sub
Please, Any one have an idea ??????????
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|