PC Review


Reply
Thread Tools Rate Thread

How can I use API to do.....

 
 
=?Utf-8?B?SHVzYW0=?=
Guest
Posts: n/a
 
      15th Mar 2005
Hi EveryBody:

How can I use win32 API to destroy or close spicfied window ?

any help will be appreciated

regard's

Husam
 
Reply With Quote
 
 
 
 
=?Utf-8?B?Q3JvdWNoaWUxOTk4?=
Guest
Posts: n/a
 
      15th Mar 2005
' API & Constant

Private Declare Function FindWindow Lib "user32" Alias "FindWindowA"
(ByVal lpClassName As String, ByVal lpWindowName As String) As Integer
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA"
(ByVal hwnd As Int32, ByVal wMsg As Int32, ByVal wParam As Int32, ByVal
lParam As Int32) As Int32
Private Const WM_CLOSE = &H10

' Put this behind a button for example:

Dim intHandle As Integer = FindWindow("Notepad", vbNullString)
If intHandle > 0 Then
SendMessage(intHandle, WM_CLOSE, 0, 0)
End If

I used 'Notepad in the above example & found the handle by passing the
classname to the FindWindow function

I hope this helps
 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off



Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:17 AM.