-1

I'm working on a side project and I'm hoping some of you can help me out. Say I have an existing executable program running in Windows and that it requires some sort of user interaction every hour. The interaction process would require the stroke of some key on the keyboard, mouse clicks, and interaction with GUI.

What are some useful API, functions, or ways I can go about to accomplish this task?

I can program in C++ and Java.

Dan K
  • 19

3 Answers3

1

If the executable program is written natively in windows eg c++/WinApi/MFC, then you can use SendMessage() to the controls you want to activate. It simulates triggering of the events

Here is the C++ code:

#include <Windows.h>

int main(){
    HWND MainWindowHandle = FindWindowEx(NULL, NULL, "Notepad","Untitled - Notepad");

    HWND ButtonHandle = FindWindowEx(MainWindowHandle, NULL, "Button","OK");
    SendMessage(ButtonHandle, BM_CLICK,  0,  0);

    HWND TextBoxHandle = FindWindowEx(MainWindowHandle, NULL, "Edit",NULL);
    SendMessage(TextBoxHandle, WM_SETTEXT,  0,  (LPARAM)"hello");
    return 0;
}
Lefteris E
  • 2,806
  • 1
  • 24
  • 23
0

This looks like some popup application for the System Tray. Maybe with a timer, a daemon process.

Joop Eggen
  • 107,315
  • 7
  • 83
  • 138
0

Check Thrift, it is for intercommunication between two languages.

akshayb
  • 1,219
  • 2
  • 18
  • 44