Jump to content

Interaction with an MFCGridCtrl Object


Recommended Posts

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.

Link to comment
Share on other sites

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!

Link to comment
Share on other sites

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 by zfisherdrums
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

  • 1 year later...

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?

Joewang

joewang12@hotmail.com

Link to comment
Share on other sites

  • 1 year later...

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...