|
-
Jan 23rd, 2000, 03:41 AM
#1
Thread Starter
Junior Member
Hello,
I am trying to find a way to disable controls on a program that I didn't write and have no control over. How would I be able to disable such things as buttons or something like that?
I know this probably doesn't make since so if it doesn't then e-mail me at [email protected]
TIA,
XinMan
-
Jan 23rd, 2000, 09:56 PM
#2
Can you tell us what program you're trying to disable the button for? It's not hard to do it. You would have to use FindWindowEx API to find the application you need, then using the same API, find the control on it. Then using EnableWindow API to disable the control.
------------------
Serge
Software Developer
[email protected]
ICQ#: 51055819
-
Jan 23rd, 2000, 09:58 PM
#3
So Unbanned
He's probably trying to dis-able his netzero advertisement window LOL!!!
------------------
DiGiTaIErRoR
-
Jan 24th, 2000, 03:18 AM
#4
Yeah...this sounds interesting...I wouldn't mind knowing about this sorta thing.
How about some simple examples (A couple of articles, John Percival? )...
How would you disable the equals button in the Windows Calculator (calc.exe) ?
Or add another menu item to the help menu (like a web link, or that might call my own bit of code) ?
Or how would you change the Title Bar caption ?
Yeah... a decent VB World atricle would be cool, now I come to think of it...
------------------
Matthew Ralston
E-Mail: [email protected]
Web Sites:My Home Page
Sorry about my English, but my Scouse is dead good!
-
Jan 24th, 2000, 04:27 AM
#5
Thread Starter
Junior Member
Just like the 'Ok' button / 'apply' button on some of the settings menus in Windows.
XinMan
-
Jan 24th, 2000, 12:18 PM
#6
Thread Starter
Junior Member
No, I am not trying to disable the netzero ads. I'm trying to disable something in Windows, for security reasons. This way people can't change the settings unless the Site Administrator changes them.
Thanks,
XinMan
-
Jan 24th, 2000, 12:50 PM
#7
So what is the application name you're trying to disable the button for?
------------------
Serge
Programmer Analyst
[email protected]
[email protected]
ICQ#: 51055819
-
Sep 7th, 2000, 01:22 AM
#8
Conquistador
Originally posted by matthewralston
Yeah...this sounds interesting...I wouldn't mind knowing about this sorta thing.
How about some simple examples (A couple of articles, John Percival? )...
How would you disable the equals button in the Windows Calculator (calc.exe) ?
Or add another menu item to the help menu (like a web link, or that might call my own bit of code) ?
Or how would you change the Title Bar caption ?
Yeah... a decent VB World atricle would be cool, now I come to think of it...
------------------
Matthew Ralston
E-Mail: [email protected]
Web Sites:My Home Page
Sorry about my English, but my Scouse is dead good!
Code:
Private Declare Function EnableWindow Lib "user32" (ByVal hwnd As Long, ByVal fEnable As Long) As Long
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
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 Sub Command1_Click()
Dim hCalc As Long
hCalc = FindWindowEx(FindWindow("SciCalc", "Calculator"), 0&, "Button", vbNullString)
EnableWindow hCalc, 0
End Sub
disables the mc button!
-
Sep 7th, 2000, 01:24 AM
#9
Conquistador
use
Code:
EnableWindow hCalc, 1
to enable it
also for title captions:
(Posted by Megatron)
Code:
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function SetWindowText Lib "user32" Alias "SetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String) As Long
Private Sub Command1_Click()
Dim hApp As Integer
Dim NewTitle As String
NewTitle = "New Title for IE"
hApp = FindWindow("IEFrame", vbNullString)
If hApp <> 0 Then SetWindowText hApp, NewTitle
End Sub
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
|