Hello all.

Ok im making a macro program...

I got this...



Code:
#include <windows.h>

int main(void)
{
	int i;
	char test;
	HWND hwndEdit = 0;
	HWND hwnd = 0;
	i = 0;
	//Get main notepad handle
	while(hwnd==0)
		hwnd = FindWindow("Notepad","a - Notepad");

	while(hwndEdit==0)
		hwndEdit = FindWindowEx(hwnd,0,"Edit",0);

	//write an 'a'
	
	test = 97;

	for(i=0;i<10;i++)
	SendMessage(hwnd,WM_CHAR,test,0);

	return 0; 
}

All that I want to do, is send a message to the notepad and display 'a' 10 times to it while its up.

I used spy++ to check if the handles were right for each window and everything checked out OK in debugger.

Does anyone notice whats wrong with this?