|
-
May 25th, 2011, 06:19 PM
#1
How do I manipulate a non-standard control window in another process ???
Hello to anyone who reads this. Very good day to you! Thanks in advance for any help. If I receive no help at all then I wouldn't be disappointed in the Guru's here, because you guys do nothing but help; you no doubt have your hands full... Thanks anyways.
(Note: ) This post is lengthy to give you a good idea of what I am after, and what my problems are. You could just skim through most of it, but my actual questions are at the bottom.
OS: MS Window 7 64bit
IDE: Code::Blocks
I am a novice C++ programmer. I have a limited understanding of the Win32 API, although the MSDN documentation is outstanding, and seems to be fairly easy to follow, I guess. I also have to admit, I've been a novice for a very, very long time....
-----------------------------------------------------------------------------------------------------------------------------------
I am trying to practice trading securities online. I am using the ThinkDesktop software from the Brokerage: ThinkorSwim.
If you think it will help you help me you can download the software at: Download ThinkDesktop. You can demo the program and actually get free quotes, but the quotes are 20 min. delayed. You also have to register, but you can always give fake info.
EDIT: Actually you can PM me if you want and I will give you a dummy registration that I have set up.
I think the ThinkDesktop Platform is awesome. It has most anything that a trader could want. However one thing that I need, but ThinkDesktop does not have is a floating shares quantity input control(I guess that's what you'd call it); I am referring to the controls found in the "ORDER ENTRY TOOLS" window.
The "ORDER ENTRY TOOLS" has a floating price input control which can be locked or allowed to float with the current Ask price. The quantity control is static though; you have to change it manually.EDIT:However, the quantity control is non-floating( idle/inert); you have to change it manually.
The purpose of floating the quantity of shares in respect to the current share price would be to maintain a desired spending periphery.
It allows you you revise the number of shares to buy, in a quick moving market, without having to waist time pokin' at a calculator.
-----------------------------------------------------------------------------------------------------------------------------------
Well, I've decided to write a program that uses DDE to retrieve the "Last"(i.e. Last price) data for a given stock in a my stock watchlist and finds the "Qty"(i.e. Share quantity) window control - then my program runs the current Last price through this simple formula:
(MaxInvestmentCost - CommissionFees) / CurrentLastPrice = ShareQuantity
Then I want to continuously place/inject ShareQuantity's value in the "Qty" window control of ThinkDesktop.
----------------------------------------------------------------------------------------------------------------------------------
Originally I had hoped to just be able to use the following functions to get a handle:
Code:
EnumWindows()
EnumChildWindows()
SendMessage(hWnd, WM_GETTEXT, (WPARAM)sizeof(wndTxt), (LPARAM)wndTxt)
if (strstr(wndTxt, "111")){ ... };
I decided to use EnumWindows() just to make sure that I checked - every - possible window -and it's child windows. However, try as I did, I could not locate the control's handle. I believe this is not a standard window. I would guess that it is actually part of an applet. Actually I believe ThinkDesktop is written in Java.
--------------------
Now I am looking into Windows hooking. I used the Find Window feature of Spy++, and clicked on the quantity control, but the only handle and properties displayed were that of it's parent window.
I also checked the messages of the control's parent window as I typed in the control box to see if any messages were somehow being routed through the parent, but I didn't see anything related to my typing (I don't totally know what I am doing though). However, there was an enormous stream of messages coming from the parent related to the cursors position (If the cursor was over the parent or it's children windows that is).
Who knows, the quantity window - may have - routed messages through the parent, but the messages filled Spy++ message window so quickly I may have just not seen them.
=======================================================================================
========================================MY QUESTIONS=====================================
Q1) What should I do, or how should I go about manipulating the text in this window???
Q2) It seems that some form of hooking may be the solution, but what type of hooking???
------So far I have read about the types of hooking on this site:API hooking revealed
Q3)If hooking (As in the kind described on the MSDN reference library) is the solution then which of the id's (WH_CALLWNDPROC, WH_SHELL, etc...)for the "SetWindowsHookEx( )" should I use???
Q4) In your opinion is the PEview.exe program mentioned at: :Assembly Language Programming... safe to use: I mean do think it may have a virus???
-------- I was thinking it might be able to help me. The site owner and program creator ,Wayne J. Radburn, seems like a nice guy.
Anyways thanks for any help. I am sorry for this lengthy post I'm not sure if less is more or more is more
THANKS......
Last edited by kmkkra; May 29th, 2011 at 12:13 PM.
-
May 26th, 2011, 06:36 AM
#2
Re: How do I manipulate a non-standard window in another process???
I think your approach is naive. Suppose, for simplicity, that there IS a static control that the trading app uses to display some calculated value to the user. Do you think that your painting over it can change the logic of that app? Even if you set the text of that control, the app will likely never read it, since it is used for one-way communication.
Vlad - MS MVP [2007 - 2012] - www.FeinSoftware.com
Convenience and productivity tools for Microsoft Visual Studio:
FeinWindows - replacement windows manager for Visual Studio, and more...
-
May 26th, 2011, 07:15 AM
#3
Re: How do I manipulate a non-standard window in another process???
 Originally Posted by VladimirF
I think your approach is naive. Suppose, for simplicity, that there IS a static control that the trading app uses to display some calculated value to the user. Do you think that your painting over it can change the logic of that app? Even if you set the text of that control, the app will likely never read it, since it is used for one-way communication.
I apologize for the misunderstanding. I should have realized the ambiguity, infact, I will edit that particular sentence for future reference. When I wrote "static" in my previous post I meant this in a general sense (I did not mean it as a Win32 control type). I meant that it is not automatically updated; it - must - be changed manually.
Whereas, the order's buy/sell price input control has an option to either automatically float the trader's order buy or sell price - or it can be manually controlled as well.
So the Qty(quantity) control window "type" in ThinkDesktop is not "static". It is actually used to enter the quantity of shares to purchase. So the control's very purpose is for user input; that is to say, it's a text box.
Last edited by kmkkra; May 26th, 2011 at 09:08 PM.
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
|