CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 10 of 10
  1. #1
    Join Date
    Dec 2009
    Posts
    17

    stuck in EnumWindows

    there is a MDI application called ODIN

    it has a MDI FORM whose title starts with MARKET WATCH which displays text in syslistview32

    i want get the text from syslistview32 placed in this MDI FORM NAMED MARKET WATCH and save it to a csv file

    im very new to this enumwindows etc pls help me to code

    below is the code for seeing if ODIN is running

    if ODIN is running it inserts the Hwnd in the text box and displays message box

    i am attaching my code + Screen shot with this pls help me to get to the MDI CHILD FORM and get the text to csv file




    Attached Files Attached Files
    Last edited by rohitb; January 8th, 2010 at 02:40 AM.

  2. #2
    Join Date
    Jul 2006
    Location
    Germany
    Posts
    3,725

    Re: stuck in EnumWindows

    You are doing well so far.
    Next after you have found the window you have to use EnumChildWindow() API, which is very similar to EnumWindows(), only it calls back with the hWnd of all children of a window.
    In the callback you use GetWindowClassName() API to get the classname (similar to using GetWindowText() ) and get the handle of the syslistview32.

    Now for the difficult part.
    There are lots of messages defined which can be used with the SendMessage() API.
    I have not worked with a ListView using SendMessage() yet, but I recall reading some info about LV and SendMessage() in MSDN (dont ask where) and there would be some research to do.
    There are structs (User Defined Types) which describe Item properties and SendMessage() can be used to read text from the items with WM_GETTEXT message.
    It would be a task to determine the number of items (rows) and columnheaders (columns) in the LV and then write loop to get the text from each item and off its subitem array.

  3. #3
    Join Date
    Jul 2006
    Location
    Germany
    Posts
    3,725

    Re: stuck in EnumWindows

    Hey, you are lucky.

    I found these two modules in my archive. They are from somewhere in the web, some time ago.

    I think it is a real treasury for you and what you want to achive.
    All definitions of data types around ListView and Items and Columns
    All constants for the use with SendMessage() to read and set texts.
    All necessary functions for data conversion and acces.
    I think studying this toolbox allows to do everything with a ListView as long as you have its hWnd.
    Attached Files Attached Files

  4. #4
    Join Date
    Dec 2009
    Posts
    17

    Re: stuck in EnumWindows

    Quote Originally Posted by WoF View Post
    Hey, you are lucky.

    I found these two modules in my archive. They are from somewhere in the web, some time ago.

    I think it is a real treasury for you and what you want to achive.
    All definitions of data types around ListView and Items and Columns
    All constants for the use with SendMessage() to read and set texts.
    All necessary functions for data conversion and acces.
    I think studying this toolbox allows to do everything with a ListView as long as you have its hWnd.
    actually im new to this can u modify the code i attached pls

  5. #5
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: stuck in EnumWindows

    So, did you write *ANY* of it?
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  6. #6
    Join Date
    Jul 2006
    Location
    Germany
    Posts
    3,725

    Re: stuck in EnumWindows

    Let's see how far you get.

    I have added a function in the module to enumerate child windows to find syslistview32 by classname.
    Then I have added a few lines of code to your click handler in Form1 to find the MDIchild window and then syslistview.
    In fact it is nothing new except for getting the classname in the last step.

    I cannot say if it works because I don't have your odin application.
    If you are successful to the end, LVHandle will contain the hWnd of the ListView.

    Next thing you best study the libraries I gave you before. They should give enough clues to read text from the cells of a listview. I have never worked with these yet, but I'm sure everything is there.

    This was modifying your code a little.
    Everything else would be writing you a complete program.
    You should make an attempt.
    Attached Files Attached Files

  7. #7
    Join Date
    Dec 2009
    Posts
    17

    Re: stuck in EnumWindows

    Quote Originally Posted by WoF View Post
    Let's see how far you get.

    I have added a function in the module to enumerate child windows to find syslistview32 by classname.
    Then I have added a few lines of code to your click handler in Form1 to find the MDIchild window and then syslistview.
    In fact it is nothing new except for getting the classname in the last step.

    I cannot say if it works because I don't have your odin application.
    If you are successful to the end, LVHandle will contain the hWnd of the ListView.

    Next thing you best study the libraries I gave you before. They should give enough clues to read text from the cells of a listview. I have never worked with these yet, but I'm sure everything is there.

    This was modifying your code a little.
    Everything else would be writing you a complete program.
    You should make an attempt.

    sorry for late reply i was down on health and also was out of station

    thanks friend the code u gave me is very helpful i modified it and now im able to reach till the syslistview32

    thanks again

  8. #8
    Join Date
    Jul 2006
    Location
    Germany
    Posts
    3,725

    Re: stuck in EnumWindows

    Fine. Good to get some feedback.

  9. #9
    Join Date
    Sep 2010
    Posts
    5

    Re: stuck in EnumWindows

    Rohit,

    I am also trying to get data from SysListView32 control of ODIN. i am able to get the handle of SysListView32 and also column headers text. But not able to get the real data from rows below header. I think u have also stuck at this point. Have u find any solution to it. If yes please help me out.

    Thanks..

  10. #10
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: stuck in EnumWindows

    If you're allowed to access that information (legally) then, they should have an API that you can use to access it.

    Most places are required by law to only display market data, not transmit it.

    They can lose their license for transmitting live data.
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured