|
-
Feb 10th, 2005, 10:42 PM
#1
Thread Starter
Addicted Member
Call TextMatrix on external app's MSHFlexGrid
I would like to get the text from cells in an external application's MSHFlexGrid.
http://msdn.microsoft.com/library/de...ridcontrol.asp
Can it be done with hooking/subclassing or another method?
value = externalForeignAppsMSHFlexGrid.TextMatrix(rowindex, colindex)
Edit: Below (upto post 13) may be irrelevant.
Spy++ doesn't give me a handle for individual cells like it would for the caption of a window. So I have no WM_SETTEXT message. The only messages I see when data in a cell is updated are:
WM_STYLECHANGING
WM_STYLECHANGED
WM_PAINT
The text in the cells change colors, so I guess that's why the WM_STYLE* messages are there. Spy++ reports a point for the WM_PAINT messages and I thought those points may always be bounded by the RECT for the MSHFlexGrid, but they are not.
Thoughts?
Last edited by Phenix; Feb 24th, 2005 at 05:33 PM.
Reason: Maybe it is an average problem
Circa 1995
Engineer - I think we should put our website address on our paper catalogs.
Vice President - Don't get too excited about this internet thing.
I am sorry, but the Oracle was mistaken. You cannot help us.
-Matrix video game
I'm doing a (free) operating system (just a hobby, won't be big and professional like gnu) for 386(486) AT clones. ... and it probably never will support anything other than AT-harddisks, as that's all I have :-(.
-Linus
Question. Do you know that the character "?" means I'm asking a question? Question. Do you know that spoken inflection also provides the same cue? So please don't say, "Question" before you ask your question. Believe me I'll know.
That said, I would have said this first if it had to precede what I'm telling you now. Having said that, what I'm telling you now is the same thing I just said about the annoying phrases "That said" and "Having said that".
Are you threatening me, Master Jedi?
-Chancellor Palpatine
-
Feb 10th, 2005, 11:54 PM
#2
Hyperactive Member
Re: Not your average GetText/Hook: MSHFlexGrid
have you tried FindWindowEx ?... to get handle of MSHFlexGrid then work with it...
Last edited by EJ12N; Feb 11th, 2005 at 03:58 AM.
Born to help others
(If I've been helpful then please rate my post. Thanks)
call me EJ or be slapped! 
-
Feb 11th, 2005, 06:24 AM
#3
Re: Not your average GetText/Hook: MSHFlexGrid
There isn't a window for each cell - you'd soon run out of resources if there were.
-
Feb 11th, 2005, 11:22 AM
#4
Re: Not your average GetText/Hook: MSHFlexGrid
If Spy++ doesn't show messages coming to the grid, then I guess the grid's text isn't handled with messages.
Try hooking the app anyway and see what messages you get. When you hook an external app you are actually hooking the entire process that the app is running in. Make sure you hook both sent and posted messages.
If the values are being input via the keyboard, then you could always do a keyboard hook.
...
-
Feb 11th, 2005, 01:35 PM
#5
Thread Starter
Addicted Member
Image processing as last resort. Keep the ideas coming.
There are 3 messages when the grid is updated (spying on the grid). Just not the convenient WM_SETTEXT.
Are you suggesting spying on the whole app instead of only the grid?
I was thinking that the point in the WM_PAINT would indicate a location for the OS to begin a BitBlt, but I see no width/height. This is still leading to my only proposed solution of capturing an image and trying some image processing.
If I send the WM_PAINT message to my subclassed picturebox, could I cause the picturebox to be rendered/painted to appear graphically as the grid (or grid cell) being repainted? If so, how?
Or can I get access to the image/pixel data of the grid (even if the grid is not completely visible onscreen) -- similar to rendering to an offscreen buffer to attempt image processing?
Circa 1995
Engineer - I think we should put our website address on our paper catalogs.
Vice President - Don't get too excited about this internet thing.
I am sorry, but the Oracle was mistaken. You cannot help us.
-Matrix video game
I'm doing a (free) operating system (just a hobby, won't be big and professional like gnu) for 386(486) AT clones. ... and it probably never will support anything other than AT-harddisks, as that's all I have :-(.
-Linus
Question. Do you know that the character "?" means I'm asking a question? Question. Do you know that spoken inflection also provides the same cue? So please don't say, "Question" before you ask your question. Believe me I'll know.
That said, I would have said this first if it had to precede what I'm telling you now. Having said that, what I'm telling you now is the same thing I just said about the annoying phrases "That said" and "Having said that".
Are you threatening me, Master Jedi?
-Chancellor Palpatine
-
Feb 11th, 2005, 02:42 PM
#6
Lively Member
Re: Not your average GetText/Hook: MSHFlexGrid
Someone mentioned the offscreen buffer a while back. I know that unless you know of a way to do that, the bitblt method will return -1 for the pixel color. Also you might try an API spy to see if maybe the text is being drawn to the cells. Check for calls to Rlt functions.
-
Feb 16th, 2005, 11:51 AM
#7
Thread Starter
Addicted Member
Reference Note: SendMessage versus PostMessage and some questions
I fell into this trap again. Please correct me if I am wrong.
I wasn't seeing the WM_PAINT message in my CallWndProc callback. Probably because I should be using the GetMsgProc callback.
I believe Spy++ reports the message as S and P for sent messages via SendMessage and posted messages via PostMessage, respectively.
For a sent message S (SendMessage) use CallWndProc
For a posted message P (PostMessage) use GetMsgProc
http://msdn.microsoft.com/library/de...dowshookex.asp
WH_CALLWNDPROC
Installs a hook procedure that monitors messages before the system sends them to the destination window procedure. For more information, see the CallWndProc hook procedure.
WH_GETMESSAGE
Installs a hook procedure that monitors messages posted to a message queue. For more information, see the GetMsgProc hook procedure.
Other notes:
Also, I thought all the info to paint/render an area on the screen would be in a WM_PAINT message. My plan was to send my picturebox the WM_PAINT message and have it paint itself with the same image. Apparently this is wrong. So I used Partial Screen Capture http://vbforums.com/showthread.php?t...screen+capture using the coordinates given by Spy++ for the found target window. I just need to sample the area of the screen when a WM_PAINT message is received. Also, my target app sends (or rather POSTS) 2 WM_PAINT messages. Apparently 1 at the beginning of the paint and 1 at the end. I don't see any visual change after the 2nd WM_PAINT, only after the 1st. Ever seen that before? What's going on?
Next step: Get color data
This seems kind of bulky (but it is in VB).
http://vbforums.com/showthread.php?t...screen+capture
I'm thinking I should move as much as possible to the DLL to get faster execution (for upcoming image processing code and other calculations). Are there any drawbacks to this approach and shouldn't I get faster execution?
Circa 1995
Engineer - I think we should put our website address on our paper catalogs.
Vice President - Don't get too excited about this internet thing.
I am sorry, but the Oracle was mistaken. You cannot help us.
-Matrix video game
I'm doing a (free) operating system (just a hobby, won't be big and professional like gnu) for 386(486) AT clones. ... and it probably never will support anything other than AT-harddisks, as that's all I have :-(.
-Linus
Question. Do you know that the character "?" means I'm asking a question? Question. Do you know that spoken inflection also provides the same cue? So please don't say, "Question" before you ask your question. Believe me I'll know.
That said, I would have said this first if it had to precede what I'm telling you now. Having said that, what I'm telling you now is the same thing I just said about the annoying phrases "That said" and "Having said that".
Are you threatening me, Master Jedi?
-Chancellor Palpatine
-
Feb 16th, 2005, 12:07 PM
#8
Re: Not your average GetText/Hook: MSHFlexGrid
I believe Spy++ reports the message as S and P for sent messages via SendMessage and posted messages via PostMessage, respectively.
For a sent message S (SendMessage) use CallWndProc
For a posted message P (PostMessage) use GetMsgProc
This is correct.
I'm thinking I should move as much as possible to the DLL to get faster execution
If most of the code is API calls, then you won't see much of an improvement in performance. Being a VB programmer, I always like to move the coding back to VB as soon as pratical so that I can compile the dll and forget about it.
-
Feb 16th, 2005, 01:12 PM
#9
Thread Starter
Addicted Member
Re: Not your average GetText/Hook: MSHFlexGrid
So hand coded matrix math operations and for loops would benefit?
Are there any matrix math api calls?
Circa 1995
Engineer - I think we should put our website address on our paper catalogs.
Vice President - Don't get too excited about this internet thing.
I am sorry, but the Oracle was mistaken. You cannot help us.
-Matrix video game
I'm doing a (free) operating system (just a hobby, won't be big and professional like gnu) for 386(486) AT clones. ... and it probably never will support anything other than AT-harddisks, as that's all I have :-(.
-Linus
Question. Do you know that the character "?" means I'm asking a question? Question. Do you know that spoken inflection also provides the same cue? So please don't say, "Question" before you ask your question. Believe me I'll know.
That said, I would have said this first if it had to precede what I'm telling you now. Having said that, what I'm telling you now is the same thing I just said about the annoying phrases "That said" and "Having said that".
Are you threatening me, Master Jedi?
-Chancellor Palpatine
-
Feb 16th, 2005, 01:17 PM
#10
Re: Not your average GetText/Hook: MSHFlexGrid
So hand coded matrix math operations and for loops would benefit?
Is the Pope Catholic?
Are there any matrix math api calls?
There are certainly a lot of open source C++ libraries out there for this.
-
Feb 16th, 2005, 01:26 PM
#11
Thread Starter
Addicted Member
Re: Not your average GetText/Hook: MSHFlexGrid
How about the double WM_PAINT messages? Could it be some parent getting a WM_PAINT and trickling down?
Circa 1995
Engineer - I think we should put our website address on our paper catalogs.
Vice President - Don't get too excited about this internet thing.
I am sorry, but the Oracle was mistaken. You cannot help us.
-Matrix video game
I'm doing a (free) operating system (just a hobby, won't be big and professional like gnu) for 386(486) AT clones. ... and it probably never will support anything other than AT-harddisks, as that's all I have :-(.
-Linus
Question. Do you know that the character "?" means I'm asking a question? Question. Do you know that spoken inflection also provides the same cue? So please don't say, "Question" before you ask your question. Believe me I'll know.
That said, I would have said this first if it had to precede what I'm telling you now. Having said that, what I'm telling you now is the same thing I just said about the annoying phrases "That said" and "Having said that".
Are you threatening me, Master Jedi?
-Chancellor Palpatine
-
Feb 16th, 2005, 01:31 PM
#12
Re: Not your average GetText/Hook: MSHFlexGrid
Where do you see these WM_PAINT messages? In your hook or in SPY++?
-
Feb 16th, 2005, 01:34 PM
#13
Thread Starter
Addicted Member
Re: Not your average GetText/Hook: MSHFlexGrid
I see them in Spy++. The app is at home, so I can't even change to the GetMsgProc yet to see them in my hook.
Circa 1995
Engineer - I think we should put our website address on our paper catalogs.
Vice President - Don't get too excited about this internet thing.
I am sorry, but the Oracle was mistaken. You cannot help us.
-Matrix video game
I'm doing a (free) operating system (just a hobby, won't be big and professional like gnu) for 386(486) AT clones. ... and it probably never will support anything other than AT-harddisks, as that's all I have :-(.
-Linus
Question. Do you know that the character "?" means I'm asking a question? Question. Do you know that spoken inflection also provides the same cue? So please don't say, "Question" before you ask your question. Believe me I'll know.
That said, I would have said this first if it had to precede what I'm telling you now. Having said that, what I'm telling you now is the same thing I just said about the annoying phrases "That said" and "Having said that".
Are you threatening me, Master Jedi?
-Chancellor Palpatine
-
Feb 24th, 2005, 05:27 PM
#14
Thread Starter
Addicted Member
Maybe it is average... GetText/Hook: MSHFlexGrid
Is there a way to call TextMatrix on the external applications's MSHFlexGrid?
I just want to read the data not change it.
The screen capture/image processing technique may be overkill.
Circa 1995
Engineer - I think we should put our website address on our paper catalogs.
Vice President - Don't get too excited about this internet thing.
I am sorry, but the Oracle was mistaken. You cannot help us.
-Matrix video game
I'm doing a (free) operating system (just a hobby, won't be big and professional like gnu) for 386(486) AT clones. ... and it probably never will support anything other than AT-harddisks, as that's all I have :-(.
-Linus
Question. Do you know that the character "?" means I'm asking a question? Question. Do you know that spoken inflection also provides the same cue? So please don't say, "Question" before you ask your question. Believe me I'll know.
That said, I would have said this first if it had to precede what I'm telling you now. Having said that, what I'm telling you now is the same thing I just said about the annoying phrases "That said" and "Having said that".
Are you threatening me, Master Jedi?
-Chancellor Palpatine
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
|