BOOL WINAPI DllMain ( HINSTANCE hInstDLL, DWORD dwFunction, LPVOID lpNot) { switch(dwFunction) { case DLL_PROCESS_ATTACH: /* for debug ********************************/ #ifdef _MY_DEBUG if(nDebugLevel){ if( (DebugLogFile=_tfopen( DEBUGLOGFILE, "w"))==NULL) MessageBox(NULL,"can not open Debuglogfile","debug",MB_OK); DebugLog(1,(DebugLogFile,"Entry in\n")); } #endif /********************************************/ hInst = hInstDLL; InitDictionary(); hUIFont = CreateFont(16, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, ANSI_CHARSET, OUT_TT_PRECIS, CLIP_TT_ALWAYS, ANTIALIASED_QUALITY, DEFAULT_PITCH, _T("���ו")); IMERegisterClass( hInst ); break; case DLL_PROCESS_DETACH: DeleteObject(hUIFont); UnregisterClass(UICLASSNAME,hInst); UnregisterClass(COMPCLASSNAME,hInst); UnregisterClass(CANDCLASSNAME,hInst); UnregisterClass(STATUSCLASSNAME,hInst); DestroyDictionary(); /* for debug ********************************/ #ifdef _MY_DEBUG if(nDebugLevel){ DebugLog(1,(DebugLogFile,"Entry out\n")); if(DebugLogFile!=NULL) fclose(DebugLogFile); } #endif /********************************************/ break; case DLL_THREAD_ATTACH: break; case DLL_THREAD_DETACH: break; } return TRUE; }
BOOL WINAPI DllMain ( HINSTANCE hInstDLL, DWORD dwFunction, LPVOID lpNot) { switch(dwFunction) { case DLL_PROCESS_ATTACH: TRACE(TEXT("Entry in\n")); hInst = hInstDLL; InitDictionary(); hUIFont = CreateFont(16, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, ANSI_CHARSET, OUT_TT_PRECIS, CLIP_TT_ALWAYS, ANTIALIASED_QUALITY, DEFAULT_PITCH, _T("���ו")); TRACE(TEXT("Instance %d\n"), hInst); IMERegisterClass( hInst ); break; case DLL_PROCESS_DETACH: DeleteObject(hUIFont); UnregisterClass(UICLASSNAME,hInst); UnregisterClass(COMPCLASSNAME,hInst); UnregisterClass(CANDCLASSNAME,hInst); UnregisterClass(STATUSCLASSNAME,hInst); DestroyDictionary(); TRACE(TEXT("Entry out\n")); break; case DLL_THREAD_ATTACH: break; case DLL_THREAD_DETACH: break; } return TRUE; }
Game(){ int i = 1, startGame = 0, wordSize, wordCounter; startGame = InitDictionary(); char *wordChosen = ChooseRandomWord(startGame); char *displayWord = wordChosen ,letter, *gameWord; wordSize = ChangeWord(displayWord,gameWord); printf("The word now looks like this: %s\n", displayWord); printf("You have %d guesses left.\n", NumberOfTries); while(i <= NumberOfTries){ printf("Guess a letter: "); scanf("%c\n",&letter); CheckLetter(gameWord,displayWord,letter,wordSize,&wordCounter); if (wordCounter==wordSize){ printf("You guessed the word: %s\n",displayWord); printf("You win\n"); }else{ printf("You have %d guesses left.\n", (NumberOfTries - i)); } i++; } }