Click to See Complete Forum and Search --> : Control handle
WadeD
Jan 10th, 2000, 03:07 AM
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
Dayo312
Jan 10th, 2000, 03:34 AM
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/kb/articles/Q147/6/59.asp
And I dont Know the sendmessage command to disable a window.. but I hope that helps some :)
Dayo312
Jan 10th, 2000, 03:36 AM
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/kb/articles/Q147/6/59.asp
And I dont Know the sendmessage command to disable a window.. but I hope that helps some :)
WadeD
Jan 10th, 2000, 04:27 AM
The article is for window handles which I already have. I need to get the control handle.
Anyone else know?
Thanks.
Aaron Young
Jan 10th, 2000, 04:34 AM
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
aarony@redwingsoftware.com
ajyoung@pressenter.com
WadeD
Jan 10th, 2000, 04:51 AM
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
Aaron Young
Jan 10th, 2000, 04:53 AM
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
aarony@redwingsoftware.com
ajyoung@pressenter.com
WadeD
Jan 10th, 2000, 05:22 AM
Ok, I have the class name thru Spy++, so I can get the control handle. Can I use SendMessage to disable the control?
Thanks.
KENNNY
Jan 10th, 2000, 06:34 AM
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
WadeD
Jan 10th, 2000, 09:31 PM
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
Aaron Young
Jan 11th, 2000, 04:33 AM
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
aarony@redwingsoftware.com
ajyoung@pressenter.com
WadeD
Jan 11th, 2000, 04:45 AM
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
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.