#include #include #include #include /* To compile with MinGW use: gcc htmltest.c -lhtmlhelp -o htmltest.exe */ /* You will have to integrate HTML Workshop according to "http://www.citlink.net/~messengertj/htmlhelp.htm" */ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE phInst,LPSTR lps,int nShow){ CHAR szBuff[255] = ""; WCHAR windir[255] = L""; INT result = 0; INT goodcount = 0; HWND htmlhandle; GetWindowsDirectoryW(windir, 255); // MessageBoxW(HWND_DESKTOP, windir, L"Windows Directory", MB_OK); if(wcsicmp(windir, L"C:\\Windows") == 0) strcat(szBuff, "C:\\Windows"); else strcat(szBuff, "C:\\ReactOS"); strcat(szBuff, "\\help\\calc.chm"); // MessageBoxA(HWND_DESKTOP, szBuff, "Full Path", MB_OK); if (GetFileAttributesA(szBuff) == INVALID_FILE_ATTRIBUTES) { // skip("Help file \"%S\" was not found.\n", szBuff); // printf("calc.chm file not found!"); MessageBoxA(HWND_DESKTOP, "calc.chm file not found!", "File Error!", MB_OK); return 0; } htmlhandle = HtmlHelpA(GetDesktopWindow(), szBuff, // "c:\\Windows\\Help\\calc.chm", HH_DISPLAY_TOPIC, (INT) NULL) ; sleep(4); SendMessage(htmlhandle, WM_CLOSE, (INT)NULL, (INT)NULL); result = MessageBox(HWND_DESKTOP, "Did the calc.chm file open?", "Help Test", MB_YESNO); /* result = 6 for YES and result = 7 for No */ if(result == 6) goodcount++; SendMessage(htmlhandle, WM_CLOSE, (INT)NULL, (INT)NULL); htmlhandle = HtmlHelpA(GetDesktopWindow(), "%systemroot%\\Help\\calc.chm", HH_DISPLAY_TOPIC, (INT) NULL) ; sleep(4); SendMessage(htmlhandle, WM_CLOSE, (INT)NULL, (INT)NULL); result = MessageBox(HWND_DESKTOP, "Did the calc.chm file open again?", "Help Test", MB_YESNO); /* result = 6 for YES and result = 7 for No */ if(result == 6) goodcount++; itoa (goodcount, szBuff ,10); sprintf (szBuff, "%d tests out of 2 returned success.\n", goodcount); MessageBox(HWND_DESKTOP, szBuff, "Returned success.", MB_OK); return 0; }