Aaron Danbury Posted March 28, 2007 Posted March 28, 2007 I have a situation where I need to select a row from a given MFCGridCtrl based on the Text that is in a given Cell of that Control. But whenever I try to find a way to interact with the control in the help file, I don't find anything. Can someone give any type of reference on how to interact with this control? I'm not trying to create an instance of the MFCGridCtrl. I just need to be able to interact with an existing process that contains one.
Richard Robertson Posted March 29, 2007 Posted March 29, 2007 Microsoft has probably developed a subset of window messages you have to manually send in order to retrieve that information. Look up C++ documentation for the control. Actually, maybe not. MFC kinda sucks in that department. Just try it.
Gollum Posted March 29, 2007 Posted March 29, 2007 Dunno how useful it is for you, found this at 'The Code Project'MFC Grid control 2.26
Richard Robertson Posted March 29, 2007 Posted March 29, 2007 Hmm, this doesn't seem to be a standard MFC control. I'm sorry but it would take a while for me to figure it out. It seems useful as far as controls go, but I would have to see it in action to see how AutoIt can read it.
Aaron Danbury Posted March 29, 2007 Author Posted March 29, 2007 Thank you both for your input. The link was helpful to let me know that the Control was NOT a Standard Window's Control. For that reason, I realize now that this will probably not be supported. It would be nice if it eventually does get supported. Unfortunately, the time line for what I'm working on is now. This control was thrown in at the last minute to support something, and now I cannot fully automate the process due to it. Any other information that someone might have on how to automate this would be appreciated, and be very helpful. The only other idea that I have so far, is to somehow use a mouse click. But, since I cannot detect the text in the control, I cannot really assume that the selection in the grid will ever be the same between executions. The grid may have different data in it each time. Please recommend ANY solution that you think might be usable at this point. Thank you again for all of your help!
zfisherdrums Posted March 29, 2007 Posted March 29, 2007 (edited) Aaron,This suggestion steps out of the AutoIt camp slightly. My company uses some grid controls from FarPoint that give me the same problem you have. I have had success retrieving text data using the latest release of SnagIt. This screen capture utility is not free ($40), but the trial is 30 days. The reason I suggest it is because of this little blurb from their website:"Integrate SnagIt into any program that supports COM access with the COM Server"I downloaded the trial, created an instance (documentation available), pointed it to the hellacious FarPoint control, and was able to retrieve the text. While this prototype was in VB.NET, I see no reason why it wouldn't work in an AutoIt script as well. You could poll the control after sending your mouse click to verify the text is as expected. Obviously, distribution of your script becomes harder, but if it need only run locally this may do the trick.Let me know if you find any other solutions as well...Good luck! Edited March 30, 2007 by zfisherdrums Identify .NET controls by their design time namesLazyReader© could have read all this for you. Unit Testing for AutoItFolder WatcherWord Doc ComparisonThis here blog...
Aaron Danbury Posted April 2, 2007 Author Posted April 2, 2007 It's funny that you should mention SnagIt. The company I work for uses that already. I will put that on my To Do list for research, thank you. After talking with the developer that used the MFCGrdCtrl, he indicated that this control would probably be used a lot more in the future here. So, he indicated that we should talk about adding some custom messages so that I could automated the Control. The more I thought about that, it seemed a good idea. If something isn't supported by AutoIT, then if the developers define Custom Messages for automation, AND use THAT Customized Control in the future, then the automation should be workable. The only issue that I am running into at the moment is the following. How do I get a Handle for the Control that I want to send a message to. I see a _SendMessage() routine that appears to allow me to send the data that I would want to send, but it requires a Window's Handle. I find a routine GUICtrlGetHandle(), but it takes a ControlID. The problem is that the value is what was returned by the GUICtrlCreate...() routines. So, I don't know how I am supposed to identify the Control that needs the Custom Messages sent to.
Aaron Danbury Posted April 3, 2007 Author Posted April 3, 2007 Thanks. It's amazing what you can miss that is RIGHT in front of your face.
joewang12 Posted June 24, 2008 Posted June 24, 2008 Thanks. It's amazing what you can miss that is RIGHT in front of your face.Sir,I have same issue for my work.Did you find out the answer?Is it possible to get the MFCGridCtrl's cell text on another program via sendmessage API?Joewangjoewang12@hotmail.com
ionut Posted March 27, 2010 Posted March 27, 2010 Guys, So retrieving text from a grid control can only be accomplished by using a 3rd party tool? Thanks, Ionut
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now