Results 1 to 10 of 10

Thread: SysListView32 [resolved]

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2005
    Posts
    399

    Resolved SysListView32 [resolved]

    The class for the list box I am trying to get data from is SysListView32.. I was wondering how I could get the text that is selected from that list box ? This listbox is from an external application, I want my application to get the highlighted text.

    Thanks
    Last edited by bail3yz; Apr 7th, 2006 at 02:31 PM. Reason: resolved

  2. #2
    Frenzied Member
    Join Date
    Jul 2005
    Posts
    1,168

    Re: SysListView32

    There are a few ways to do it. One way is to inject the code into the external process.

    The code you want to inject is something like this:

    Code:
    LVITEM* lvItem;
    
    lvItem = new LVITEM;
    lvItem->iSubItem = 0;
    lvItem->cchTextMax = 255;
    lvItem->pszText = lpText;
    
    int totalItem = SendMessage(TargetHwnd, LVM_GETITEMCOUNT, 0, 0);
    
    for(int i = 0; i < totalItem; i++)
    {
    
         int res2 = SendMessage(TargetHwnd, LVM_GETITEMSTATE, i, LVIS_SELECTED);
         if(res2 == LVIS_SELECTED)
              SendMessage(TargetHwnd, LVM_GETITEMTEXT, i, (long)lvItem);
    }
    the text is in lvItem->pszText.
    Last edited by benmartin101; Apr 7th, 2006 at 11:22 AM.

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2005
    Posts
    399

    Re: SysListView32

    Ty, works great

  4. #4
    Frenzied Member
    Join Date
    Apr 2005
    Posts
    1,907

    Re: SysListView32 [resolved]

    benmartin101 could u show me how to select perticuler external listbox item . Thanks

  5. #5
    Frenzied Member
    Join Date
    Jul 2005
    Posts
    1,168

    Re: SysListView32 [resolved]

    tony007, this thread should help you. http://www.vbforums.com/showthread.php?t=390889

  6. #6
    Member
    Join Date
    Aug 2006
    Posts
    40

    Re: SysListView32 [resolved]

    benmartin101 if the data in "Syslistview32" updates dynamically like a stocks trading platform how could we copy the data in to a excel sheet automatically.

  7. #7
    Frenzied Member
    Join Date
    Jul 2005
    Posts
    1,168

    Re: SysListView32 [resolved]

    Well, I'm guessing you could create a hook that would intercept all LVM_SETITEMTEXT messages to that listview. Then from that intercepted message, just get the text and just create a code that would send the text to the excel sheet. I'm assuming that your already familiar with hooks, if not, then there are many threads here that explains how to make one.

  8. #8
    Member
    Join Date
    Aug 2006
    Posts
    40

    Re: SysListView32 [resolved]

    Quote Originally Posted by benmartin101
    Well, I'm guessing you could create a hook that would intercept all LVM_SETITEMTEXT messages to that listview. Then from that intercepted message, just get the text and just create a code that would send the text to the excel sheet. I'm assuming that your already familiar with hooks, if not, then there are many threads here that explains how to make one.

    benmartin101 I am new to programming.The application which I use displays data in "syslistview32".That is executable application only.How Can i get the data that is displayed to be displayed in Excel.If it is a small thing can you write the code for me

  9. #9
    Member
    Join Date
    Aug 2006
    Posts
    40

    Re: SysListView32 [resolved]

    Mr benmartin101
    Pl guide me which books i have to read,about hooks .Particularly VB.net wnvironment

  10. #10
    Frenzied Member
    Join Date
    Jul 2005
    Posts
    1,168

    Re: SysListView32 [resolved]

    I didn't really read any books to learn about hooks. I mainly looked at the threads, and to understand what is happening, I just googled in the internet. Understanding the concept first is probably best to do first. Then you could look at the codes(that are shown in many of the threads in here) and just learn what they are doing.

    For example, when you click on a button, a "WM_LBUTTONDOWN message" is sent to the button's window procedure. The window procedure then processes that message.

    Now, if you installed a WH_GETMESSAGE hook(there are other types of hooks other than this, and they differ in usage), it will intercept that WM_LBUTTONDOWN message before it gets to the button's window procedure. You can then manipulate or process the data that came with the WM_LBUTTONDOWN message depending on what you're trying to do. After you're finished processing the message, it then goes to the window procedure.

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