CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Oct 2010

    Question Accessing data in other applications - how would you do it?

    Hi everyone,

    I need some inspiration on how to achieve what we need. Here's what we want to do:

    We have a database frontend application which holds customer data. This application has an interface that enables other applications to pass a value (the customer ID e.g.) and show up the corresponding data. This part works fine.

    Usually the users of this database have to copy & paste or even write down a customers name, ID oder similar, switch over to our db frontend and initiate a search manually. So we thought it would be nice to simplify this.

    So we created a small tool that resides in the system tray and that creates a system-wide hotkey. When the hotkey is pressed, the currently selected text in currently active application window is being copied to the clipboard via a keybd_event that simulates a CTRL-C. The tool then build the correct request and passes it to our database frontend which opens up the correct customer.

    So far everything works fine. The problem is that we do not always have a "selectable" control in the application from where the user wants to call a database lookup. It works fine for "normal" text in a textbox, an email oder a webpage, but it fails in cases where the name or id is shown in a read-only list, a label or similar, because we can't use the dirty strg-c trick here

    One possibility would be to implement some kind of OCR funcionality to actually "read" the data out of the currently visible screen area around the mouse cursor. After playing around with this and trying different engines we dropped this idea due to the lack of stability and success rate. The windows/controls we have to read are so different in terms of color and layout of all the diverse apps we would have to cover - it simply didn't make sense to go any further in that direction.

    Now I thought about directly accessing the foreign controls in the application and reading the relevant information from it. Using this methode would exclude "strange" windows like Java apps etc, but in this case we could fallback to the copy & paste way. What I want to achieve: the user works in his/her application, holds the mouse over the control containing the relevant text and presses the hotkey. Our tool iterates through the controls of the active window, indentifies the one under the mouse cursor and reads its data/text.

    I noticed that this is exactly what Spy++ does when using the "Search Window" function and dragging the crosshair over the controls of an application. This is exactly what our tool should do. The question is: how can I implement this?

    Any suggestions and help are greatly appreciated, thanks for your help!


  2. #2
    Join Date
    Apr 1999

    Re: Accessing data in other applications - how would you do it?

    Have you thought about supporting a form of IPC (Inter Process Communication) for your application?
    Gort...Klaatu, Barada Nikto!

  3. #3
    Join Date
    Nov 2000
    Voronezh, Russia

    Re: Accessing data in other applications - how would you do it?

    The question is: how can I implement this?
    If my understanding of the situation is correct, afraid I have to disappoint you. There's no common way for letting outer program into private application data unless the latter intentionally provides the said data out (like Windows native controls do). Imagine Java, Qt and Delphi applications that just draw the data on a canvas. Do you think there is anything similar in underlying data handling in so much different applications? No way.
    Best regards,

Posting Permissions

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

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

On-Demand Webinars (sponsored)

By using this site, you agree to the Privacy Policy