i have a few questions:
1. is there a way to change the window attributes on a console application?

2. is there a way to send commands to other windows/applets, like changing their attributes or closing them?

3. is there any way to cut console input to 1 keystroke, like detecting the keystroke and auto-submitting it? if there is, i'd appreciate a brief explanation of how it works too ^^

4. how do you make background applications?

5. how do you make a dll? and a '.h' file? i need to know how to make resources

i know its a lot, but i have the rest of my life to wait for answers ^^

thanks alot... in advance xD.

>>i know its a lot, but i have the rest of my life to wait for answers ^^
Then the first place to ask all those questions is google. Some of those questions depends on the operating system and compiler. google first, then come back for answers to what you can not find.

Sorry I took so long to respond, I moved, but my internet didn't.

well, I was able to find the answers for questions 1 and 5..
and I understand the theory behind number 2, but i don't know how to implement it.

as for 3 and 4, I'm pretty much helpless :(

thanks for responding

Assuming windows OS.

#2, using SendMessage() can tell windows to do stuff. You could also use SendInput() to send keystrokes to the active window

#3, if you can include conio.h, you can use kbhit() to check for any keystrokes, and getch() to get the keystroke

#4, same way as for other applications, just hide the window (or just compile as a GUI app w/o creating a window)

Communication with other applications isn't very difficult, the hardest part is just finding the window and the rest is easy. Here is an example which opens notepad.exe, gets its handle and sends the message WM_KEYDOWN a few times.

#include<windows.h>

HWND notepad = NULL;

BOOL CALLBACK WindowEnumProc(HWND hwnd, LPARAM lParam) {
	static bool first = 1;
	if (first) {
		notepad = hwnd;
		first = 0;
	}
	return 1;
}

void SendKey(HWND hwnd, char ch) {
	PostMessage(hwnd, WM_KEYDOWN, VkKeyScan(ch), NULL);
}

void SendKeys(HWND hwnd, char *str) {
	while (*str) SendKey(hwnd, *str++);
}

int main() {
	system("start notepad.exe");
	while (notepad == NULL) {
		// Keep trying until notepad is found
		notepad = FindWindow("Notepad", "Untitled - Notepad");
		Sleep(100);
	}
	// Find client textbox
	EnumChildWindows(notepad, WindowEnumProc, NULL);
	// Send keys
	SendKeys(notepad, "hello world");
	return 0;
}

Here is another snippet I made which loads up mspaint.exe and draws shapes in it. :)
http://www.daniweb.com/code/snippet886.html

Thanks very much guys, it was very useful information! ^^

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.