i have the following code:

HWND window;
	char name[MAX_PATH];

	while(1)
	{
		window = GetForegroundWindow();
		GetWindowText(window,name,sizeof(name));
		strcat(name , "\n");
		WriteToFile(name);
	}

i just want to print it once,and if i open a new window,print that too,once....and so on.....and i dont know what condition to put to work corectly :(

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.