예제 #1
0
int _tmain(int argc, _TCHAR* argv[]) {
	startTest();

	_tprintf(_T("\n\nPress any key..."));
	TCHAR ch = _gettch();
	return 0;
}
예제 #2
0
int _tmain(int argc, TCHAR* argv[])
{
    DetachDebugger();

    printf("\npress any key to quit...\n");
    _gettch();

    return 0;
}
예제 #3
0
int _tmain(int argc, TCHAR* argv[])
{
    FindDebuggerWindow();

    printf("\npress any key to quit...\n");
    _gettch();

    return 0;
}
예제 #4
0
bool menuArrow(){
	HANDLE hendle = GetStdHandle(STD_OUTPUT_HANDLE);
	COORD coord;
	coord.X=33;
	coord.Y=10;
	int key=0;
	do
	{
		key=_gettch();
		switch (key)
		{
		case 80: 
		SetConsoleCursorPosition(hendle,coord);
		cout<<"  "<<endl;
		coord.Y++;
		if(coord.Y>13){
			coord.Y=13;
		}
		SetConsoleCursorPosition(hendle,coord);
		cout<<"->"<<endl;
		break;
		case 72:
		SetConsoleCursorPosition(hendle,coord);
		cout<<"  "<<endl; 
		coord.Y--;
		if(coord.Y<10){
			coord.Y=10;
		}
		SetConsoleCursorPosition(hendle,coord);
		cout<<"->"<<endl;
		break;
		case 13:
		if(coord.Y==10){
			system("CLS");
			menuNext();
			}
		if(coord.Y==11){
			menuCompl();
			}
		if(coord.Y==12){
				about();
			}
		if(coord.Y==13){
			system("CLS");
			coord.X=33;
			coord.Y=10;
			SetConsoleCursorPosition(hendle,coord);
			cout<<"СПАСИБО ЗА ИГРУ;)";
			}
		break;
		case 27: menu();
		break;
		}
}
	while(key!=13);
	return 0;
}
예제 #5
0
int clearsyskey(int argc, TCHAR** argv)
{
	if (0 != argc && 1 != argc) {
		return usage();
	}

	BOOL fConfirm = TRUE;
	if (1 == argc) {
		if (0 == ::lstrcmpi(_T("/q"), argv[0]) ||
			0 == ::lstrcmpi(_T("-q"), argv[0]))
		{
			fConfirm = FALSE;
		} else {
			return usage();
		}
	}

	if (fConfirm) {

		_tprintf(_T("Are you sure to delete the system key? (Y/N) "));

#if 0 
		//
		// MSVCRT.DLL (6.1 in Windows 2000) does not have _getwch().
		// But MSVCRT.DLL (7.1 in Windows XP) does.
		// Use _gettchar() instead.
		//

		TCHAR ch = _gettch();
		_tprintf(_T("%c\n"), ch);

		if (_T('Y') != ch && _T('y') != ch) {
			return 1;
		}
#else
		TCHAR ch = _gettchar();

		if (_T('Y') != ch && _T('y') != ch) 
		{
			return 1;
		}
#endif
	}

	UINT lResult = ::NdasEncRemoveSysKey();

	if (ERROR_SUCCESS != lResult) {
		DWORD dwStatus = ::GetLastError();
		_tprintf(_T("Removing the system key failed with error %08X (Code: %08X).\n"), lResult, dwStatus);
		return lResult;
	}

	_tprintf(_T("NDAS System Key is deleted successfully.\n"));

	return 0;
}
예제 #6
0
int menuArrowCompl(){
	HANDLE hendle = GetStdHandle(STD_OUTPUT_HANDLE);
	COORD coord;
	coord.X=33;
	coord.Y=11;
	int key=0;
	do
	{
		key=_gettch();
		switch (key)
		{
		case 80: 
		SetConsoleCursorPosition(hendle,coord);
		cout<<"  "<<endl;
		coord.Y++;
		if(coord.Y>13){
			coord.Y=13;
		}
		SetConsoleCursorPosition(hendle,coord);
		cout<<"->"<<endl;
		break;
		case 72:
		SetConsoleCursorPosition(hendle,coord);
		cout<<"  "<<endl; 
		coord.Y--;
		if(coord.Y<11){
			coord.Y=11;
		}
		SetConsoleCursorPosition(hendle,coord);
		cout<<"->"<<endl;
		break;
		case 13:
			if(coord.Y==11){
				system("CLS");
				compl=1;
				cout<<" easy";
				}
			if(coord.Y==12){
				system("CLS");
				compl=2;
				cout<<" middle";
				}
			if(coord.Y==13){
				system("CLS");
				compl=3;
				cout<<" hard";
				}
		break;
		case 27: menu();
		break;
		}
}
	while(key!=13);
	return 0;
}
예제 #7
0
int _tmain(int argc, _TCHAR* argv[])
{
	/*
    if(argc < 3)
    {
        _tprintf(TEXT("Usage: <example.exe> <source file> ")
            TEXT("<destination file> | <password>\n"));
        _tprintf(TEXT("<password> is optional.\n"));
        _tprintf(TEXT("Press any key to exit."));
        _gettch();
        return 1;
    }

    LPTSTR pszSource = argv[1]; 
    LPTSTR pszDestination = argv[2]; 
    LPTSTR pszPassword = NULL;

    if(argc >= 4)
    {
        pszPassword = argv[3];
    }
	*/
	LPTSTR pszPassword = TEXT("123456");
    //---------------------------------------------------------------
    // Call EncryptFile to do the actual encryption.
	char *pbData = "hello";
	DWORD dwDataLen = 5;
    if(MyEncryptFile(pbData, dwDataLen, pszPassword))
    {
        _tprintf(
            TEXT("Encryption of the file was successful. \n"));
        _tprintf(
            TEXT("The encrypted data is in file.\n"));
    }
    else
    {
        MyHandleError(
            TEXT("Error encrypting file!\n"), 
            GetLastError()); 
    }
    _tprintf(TEXT("Press any key to exit."));
    _gettch();
    return 0;
}
예제 #8
0
int _tmain(int argc, _TCHAR* argv[])
{
    if(argc < 3)
    {
        _tprintf(TEXT("Usage: <example.exe> <source file> ")
            TEXT("<destination file> | <password>\n"));
        _tprintf(TEXT("<password> is optional.\n"));
        _tprintf(TEXT("Press any key to exit."));
        _gettch();
        return 1;
    }

    LPTSTR pszSource = argv[1]; 
    LPTSTR pszDestination = argv[2]; 
    LPTSTR pszPassword = NULL;

    if(argc >= 4)
    {
        pszPassword = argv[3];
    }

    //---------------------------------------------------------------
    // Call EncryptFile to do the actual encryption.
    if(MyEncryptFile(pszSource, pszDestination, pszPassword))
    {
        _tprintf(
            TEXT("Encryption of the file %s was successful. \n"), 
            pszSource);
        _tprintf(
            TEXT("The encrypted data is in file %s.\n"), 
            pszDestination);
    }
    else
    {
        MyHandleError(
            TEXT("Error encrypting file!\n"), 
            GetLastError()); 
    }

    return 0;
}
예제 #9
0
int _tmain()
{
	setlocale(LC_ALL,"rus");
	srand(time(NULL));
	setTable(tableHuman);
	setTable(tableCpu);
	setRandom(tableCpu,4);
	setRandom(tableCpu,3);
	setRandom(tableCpu,3);
	setRandom(tableCpu,2);
	setRandom(tableCpu,2);
	setRandom(tableCpu,2);
	setRandom(tableCpu,1);
	setRandom(tableCpu,1);
	setRandom(tableCpu,1);
	setRandom(tableCpu,1);
	printTable(tableHuman,0,0);
	printTable(tableCpu,15,0);
	movesOnTable();
	_gettch();
	return 0;
}
예제 #10
0
int _tmain(int argc, _TCHAR* argv[])
{
	if(argc < 2)
	{
		_tprintf(TEXT("PI <number-of-threads> <time>\n\n"));		
		return -1;
	}
	_tsetlocale( LC_ALL, TEXT("portuguese_portugal") );
	
	//ler do standart output o numero de tarefas a criar
//	DWORD NumThreads = _wtoi(argv[1]);
	DWORD NumThreads = 5;
	
	//ler numero de pontos a criar
//	DWORD Pontos  = _wtoi(argv[2]);
	DWORD Pontos = 5000000;

	_tprintf( TEXT("Tarefas: %d , Pontos: %d\n"), NumThreads, Pontos );
	
	DWORD NumPointForThread = NumThreads/Pontos;

	HANDLE* hThreads = (HANDLE*)calloc(NumThreads,sizeof(HANDLE));
	DWORD* idThreads = (DWORD *)calloc(NumThreads,sizeof(DWORD));
	int numPointAndId[2];

	for(DWORD i = 0; i < NumThreads; ++i)
	{
		numPointAndId[0] = NumPointForThread;
		numPointAndId[1] = &idThreads[i];
		hThreads[i] = chBEGINTHREADEX(NULL,
										0,
										FunctionOfThreads,
										(LPVOID) numPointAndId,
										NULL, 
										&idThreads[i] );
	}

	_tprintf( TEXT("Aguarde pela terminação das threads.\n") );
	WaitForMultipleObjects( NumThreads, hThreads, TRUE, INFINITE );

	_tprintf( TEXT("Fechar os HANDLES das tarefas.\n") );

	DWORD numOfPointsInCircle = 0;

	for (DWORD i=0; i<NumThreads; ++i)
	{
		DWORD in = 0;
		GetExitCodeThread(hThreads[i],&in);
		CloseHandle(hThreads[i]);
		numOfPointsInCircle =+ in;
	}
	
	_tprintf( TEXT("A percentagem de pontos dentro da circunferencia foram:\n%d"), (numOfPointsInCircle/(float)Pontos)*100 );


	_tprintf( TEXT("[main] Função principal a terminar.\nPrima uma tecla para continuar.\n") );
    _gettch();

	free(idThreads);
	free(hThreads);
	return 0;
}
예제 #11
0
int menuArrowNext(){
	HANDLE hendle = GetStdHandle(STD_OUTPUT_HANDLE);
	COORD coord;
	coord.X=33;
	coord.Y=11;
	int key=0;
	do
	{
		key=_gettch();
		switch (key)
		{
		case 80: 
		SetConsoleCursorPosition(hendle,coord);
		cout<<"  "<<endl;
		coord.Y++;
		if(coord.Y>12){
			coord.Y=12;
		}
		SetConsoleCursorPosition(hendle,coord);
		cout<<"->"<<endl;
		break;
		case 72:
		SetConsoleCursorPosition(hendle,coord);
		cout<<"  "<<endl; 
		coord.Y--;
		if(coord.Y<11){
			coord.Y=11;
		}
		SetConsoleCursorPosition(hendle,coord);
		cout<<"->"<<endl;
		break;
		case 13:
			if(coord.Y==11){
				system("CLS");
				setRandom(tableHuman,4);
				setRandom(tableHuman,3);
				setRandom(tableHuman,3);
				setRandom(tableHuman,2);
				setRandom(tableHuman,2);
				setRandom(tableHuman,2);
				setRandom(tableHuman,1);
				setRandom(tableHuman,1);
				setRandom(tableHuman,1);
				setRandom(tableHuman,1);
				printTable(tableHuman,0,0);
				printTable(tableCpu,15,0);
				
			}
			if(coord.Y==12){
			system("CLS");
				
				setManual();
				printTable(tableHuman,0,0);
				setManual();
				printTable(tableHuman,0,0);
				setManual();
				printTable(tableHuman,0,0);
				setManual();
				printTable(tableHuman,0,0);
				setManual();
				printTable(tableCpu,15,0);
				cout<<ship1;
				return 0;
			}
		break;
		case 27: menu();
		break;
		}
}
	while(key!=13);
	return 0;
}
예제 #12
0
aim* movesOnTableRight(){
	HANDLE hendle = GetStdHandle(STD_OUTPUT_HANDLE);
	COORD coord;
	int a=0;
	int b=0;
	aim *current=new aim;
	coord.X=20;
	coord.Y=5;
	SetConsoleCursorPosition(hendle,coord);
	int key=0;
	do 
	{
		key=_gettch();
		switch (key)
		{
		case 80: 
		SetConsoleCursorPosition(hendle,coord);
		cout<<" "<<endl;
		coord.Y++;
		if(coord.Y>10){
		coord.Y=10;
		}
		SetConsoleCursorPosition(hendle,coord);
		cout<<"+"<<endl;
		a=coord.Y;
		b=coord.X;
		coordinates(b-15,a-1);
			break;
		case 72:
		SetConsoleCursorPosition(hendle,coord);
		cout<<" "<<endl; 
		coord.Y--;
		if(coord.Y<1){
			coord.Y=1;
		}
		SetConsoleCursorPosition(hendle,coord);
		cout<<"+"<<endl;
		a=coord.Y;
		b=coord.X;
		coordinates(b-15,a-1);
			break;
		case 77: 
		SetConsoleCursorPosition(hendle,coord);
		cout<<" "<<endl;
		coord.X++;
		if(coord.X>25){
			coord.X=25;
		}
		SetConsoleCursorPosition(hendle,coord);
		cout<<"+"<<endl;
		a=coord.Y;
		b=coord.X;
		coordinates(b-15,a-1);
			break;
	    case 75:
		SetConsoleCursorPosition(hendle,coord);
		cout<<" "<<endl; 
		coord.X--;
		if(coord.X<16){
			coord.X=16;
		}
		SetConsoleCursorPosition(hendle,coord);
		cout<<"+"<<endl;
		a=coord.Y;
		b=coord.X;
		coordinates(b-15,a-1);
			break;		
		case 13: 
			a=current->y=coord.Y;
			b=current->x=coord.X;
			coordinates(b-15,a);
			movesOnTableRight();
			goto marker;
			break;
		case 27:
			menu();
			}
}
	while(key!=27);
	marker:return current;
}