//We use FindWindow (a win32 api) to find a Notepad window.
//You must have an untitled notepad window open in order for this to work.
//We leave the classname NULL as we are only interested in the window title.
//The L before the "Untitled - Notepad" is only for Unicode projects.
HWND hWndParent = FindWindow(NULL, L"Untitled - Notepad");
//Now we need to find the edit-box part of the notepad window.
//Notice that we use FindWindowEx() here. This is because it is capable of searching
//for child windows. This time we search for classname instead of window title.
HWND hWnd = FindWindowEx(hWndParent, NULL, L"Edit", NULL);
//We set the x-coordinate to 0 and they y-coordinate to 5.
DWORD xPos = 0, yPos = 5;
//Mouse button is set to left.
DWORD button = MK_LBUTTON;
//This will send the Notepad window a left mouse button click to xPos 0, yPos 5.
MouseClick(hWnd, xPos, yPos, button);