|
-
Jun 30th, 2000, 12:23 PM
#1
Thread Starter
Lively Member
I forgot how to disable a button with API for another APP, how can i enable and disable a button? I think u use the SendMessage API but i don't have my API viewer, can someone give me an example how to enable a disabed button in nother APP?
-
Jun 30th, 2000, 12:56 PM
#2
Monday Morning Lunatic
Use SendDlgItemMessage, which allows you to send it to a specific item in a dialogue box.
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Jun 30th, 2000, 06:49 PM
#3
Thread Starter
Lively Member
yes....... but what is the message i send? huh?
yes....... but what is the message i send? huh? that was the question...
-
Jul 1st, 2000, 05:59 AM
#4
Fanatic Member
I am not sure what you are looking for, but here is my sample.
Code:
Option Explicit
Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
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 Declare Function SendMessageByNum Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Private Const WM_LBUTTONDOWN = &H201
Private Const WM_LBUTTONUP = &H202
Private Declare Function SendMessageByString Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As String) As Long
Private Const WM_CLOSE = &H10
Sub p_Close_Dialog()
Dim lng_Dialog As Long
Dim lng_Button As Long
'PURPOSE: Get the handle of an application by the classname
lng_Dialog = Findwindow("#32770", vbNullString)
'lng_Dialog = Findwindow("XLMAIN", vbNullString)
'PURPOSE: Get extra information of that application
lng_Button = FindWindowEx(lng_Dialog, 0&, "Button", vbNullString)
'PURPOSE: Press the Buttons - Method #1
Call SendMessageByNum(lng_Button, WM_LBUTTONDOWN, 0, 0&)
Call SendMessageByNum(lng_Button, WM_LBUTTONUP, 0, 0&)
'PURPOSE: Press the Buttons - Method #2
Call SendMessage(lng_Button, WM_LBUTTONDOWN, 0, 0&)
Call SendMessage(lng_Button, WM_LBUTTONUP, 0, 0&)
'PURPOSE: Close the button
Call SendMessageByString(lng_Button, WM_CLOSE, 0, 0&)
'PURPOSE: Close the message box
Call SendMessageByString(lng_Dialog, WM_CLOSE, 0, 0&)
End Sub
Chemically Formulated As:
Dr. Nitro
-
Jul 1st, 2000, 09:34 AM
#5
Monday Morning Lunatic
Nice code, try putting WM_ENABLE and you should be fine.
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Jul 1st, 2000, 08:54 PM
#6
Fanatic Member
You are right Parksie! Forgot to change WM_CLOSE to WM_ENABLE.
Chemically Formulated As:
Dr. Nitro
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
|