Not a Member Yet,
Click here to Register

ID: 195
Viewed: 3561
Added: Apr 29, 2002
Version:
Snippet uploaded by: snippet
Written By: unknown
Demo: Sorry, no demo



User Rated at: 0 Stars
Rate This:

Thank you for your vote. Please wait...

It appears you already voted for this snippet

It appears your vote value was empty

There are times when you might need to know if a window is a DOS window and all you have is the window handle. To find out if a window is a DOS window you only need to do the following two things: Get the task handle for your window handle with the "GetWindowTask" API call. Test this "IsWinOldApTask" API call for true. The following declare statement outlines the IsDOSWindow API call: Declare Function IsWinOldApTask% Lib "kernel" Alias "#158" (ByVal hTask%) In the "kernel" (ex: KRNL386.EXE) file, the exported function, "158", points to this routine. Although undocumented, this API call was supported internally in Windows 3.0 and continues to thrive in the 3.1 and 3.11 versions. It probably won't be around for future Windows versions as DOS seems to be on the way out.

Highlight all by clicking in box
<!---Declaration--->
'Declare

Declare Function IsWinOldApTask% Lib "kernel" Alias "#158" (ByVal hTask%)

Declare Function GetWindowTask% Lib "user" (ByVal hWnd%)

Declare Function FindWindow% Lib "user" (ByVal ClassName$, ByVal lpWindowName As Any)



Function IsDOSWindow (iHandle As Integer) As Long

IsDOSWindow = IsWinOldApTask(GetWindowTask(iHandle))

End Function

'Example

Dim iInstance As Integer
Dim iFoundWindow As Integer

'launch a DOS window

iInstance = Shell("COMMAND.COM", 1)

'Get the window handle

iFoundWindow = FindWindow("tty", 0&)

If IsDOSWindow(iFoundWindow) = True Then

MsgBox "YES, it IS a DOS window"

End If

Highlight All
<!---Code--->
none;


No Comments to show

Please completely fill out the form below if you want to review this snippet. All reviews are subject to validation.


Replying to a Comment...


Adding your comment. Please wait...

Thanks for adding your comment!. After further review it will be added.

There was a problem adding your comment. Please try again.

Please complete all the fields in the form before sending.

© 2002 - 2024 snippetlibrary.com All Rights Reserved. Conditions
Do NOT follow this link or you will be banned from the site!