I need to disable a control on another program. I can call the window and retrieve its handle. How would I get the specific control's handle? Would I then use sendmessage?
Thanks in advance,
Wade
Printable View
I need to disable a control on another program. I can call the window and retrieve its handle. How would I get the specific control's handle? Would I then use sendmessage?
Thanks in advance,
Wade
I hope I can help.
I found a really neat page today ( the code has a few erros) But if you play with it, it will work. This , After edited will print out every handle of the Window, and all the other Info.
Try this.. http://support.microsoft.com/support.../Q147/6/59.asp
And I dont Know the sendmessage command to disable a window.. but I hope that helps some :)
I hope I can help.
I found a really neat page today ( the code has a few erros) But if you play with it, it will work. This , After edited will print out every handle of the Window, and all the other Info.
Try this.. http://support.microsoft.com/support.../Q147/6/59.asp
And I dont Know the sendmessage command to disable a window.. but I hope that helps some :)
The article is for window handles which I already have. I need to get the control handle.
Anyone else know?
Thanks.
The Control is just a Child Window, so you need the Child Windows Handle, you could get this using the FindWindowEx API and look for the specific controls Class, it's really going to be application specific.
------------------
Aaron Young
Analyst Programmer
[email protected]
[email protected]
Aaron,
If I renum all of the windows and pop a messagebox, I can see all of the class names. Is there anything you can tell me that I should look for when looking for a particular control? Would spy++ be helpful?
Thanks,
Wade
Spy++ would be very useful, it's not much use my giving you a Class name as the App you're looking at could use an entirely different class altogether.
------------------
Aaron Young
Analyst Programmer
[email protected]
[email protected]
Ok, I have the class name thru Spy++, so I can get the control handle. Can I use SendMessage to disable the control?
Thanks.
arghhhhh noooo!! the murky world of subclassing :)
yes you probably can.. unless the other app has been coded so the control is always enabled..
its all a bit dodgy: anyway why do u need to disable the control? isnt there an easier solution to whatever your prob is?
------------------
cintel rules :p
www.cintelsoftware.co.uk
The control is for the username on a login screen. I need to prevent the user from attempting to login with someone else's name.
So can I use SendMessage to disable it? Could someone share the syntax?
Thanks so much,
Wade
Once you have the Controls Window Handle you can use the EnableWindow() API, ie.
Call EnableWindow(lCtrlHwnd, 0) 'Disable Control
Or..
Call EnableWindow(lCtrlHwnd, 1) 'Enable Control
------------------
Aaron Young
Analyst Programmer
[email protected]
[email protected]
Thanks for the EnableWindow api. I ran Spy++ to get the control's class and it turns out that 2 controls share the same class. Although they have different text values, Spy++ says they both have "" for the caption. What can I do to differentiate the 2 controls?
Thanks,
Wade