SQACSharp
2007-09-08 05:07:54 UTC
Hi,
I'm looking for visual C++ (2005) examples for doing GUI automation.
Ex: Typing text to a notepad window, Clicking button in the windows
calculator and retrieving the result.
Any releated link will be usefull... I do this with VB using
enumwindow, SetWindowText, SetForeground window, SendMessage windows
API... but all the C++ examples found on the internet are not working
as expected.. ex:
#include <windows.h>
// Notepad must be started
int main()
{
HWND hWnd, hWndChild;
hWnd = FindWindow(NULL, L"Untitled - Notepad");
hWndChild = GetWindow(hWnd, GW_CHILD);
SendMessage((HWND) hWnd, WM_SETTEXT,0, (LPARAM)"New
Caption");
SendMessage((HWND) hWndChild, WM_SETTEXT,0,
(LPARAM)"New body text");
return 0;
}
This example change the caption and the text in the body for garbage
like "瑸" ([])
Any help?? Thanks!
Michel
I'm looking for visual C++ (2005) examples for doing GUI automation.
Ex: Typing text to a notepad window, Clicking button in the windows
calculator and retrieving the result.
Any releated link will be usefull... I do this with VB using
enumwindow, SetWindowText, SetForeground window, SendMessage windows
API... but all the C++ examples found on the internet are not working
as expected.. ex:
#include <windows.h>
// Notepad must be started
int main()
{
HWND hWnd, hWndChild;
hWnd = FindWindow(NULL, L"Untitled - Notepad");
hWndChild = GetWindow(hWnd, GW_CHILD);
SendMessage((HWND) hWnd, WM_SETTEXT,0, (LPARAM)"New
Caption");
SendMessage((HWND) hWndChild, WM_SETTEXT,0,
(LPARAM)"New body text");
return 0;
}
This example change the caption and the text in the body for garbage
like "瑸" ([])
Any help?? Thanks!
Michel