//---------------------------------------------------------------------------------------- // ShowTaskHistoryWindow //---------------------------------------------------------------------------------------- void ShowTaskHistoryWindow( const unsigned char * inHTMLString, HINSTANCE hInstance, HWND inParentWindow ) { int nCmdShow = SW_SHOWNORMAL; if( !gZPWebWindowHWND ) { gZPWebWindowHWND = CreateNewWebWindow( hInstance, inParentWindow ); } else { //Patch: setting the html again is not showing. UnEmbedBrowserObject(gZPWebWindowHWND); EmbedBrowserObject(gZPWebWindowHWND); } if( !gZPWebWindowHWND ) return; // For this window, display a string in the BODY of a web page. //DisplayHTMLStr(msg.hwnd, "<H2><CENTER>HTML string test</CENTER></H2><P><FONT COLOR=RED>This is a <U>HTML string</U> in memory.</FONT>"); //DisplayHTMLStr(msg.hwnd, "<html><body><p><b>#5 Updated by on 10/19/2010 5:16:53 PM</b></p><ul><li><b>Status</b> change from <i>done</i> to <i>assigned</i></li></ul><p>comments 3</p><hr/><p><b>#4 Updated by on 10/19/2010 5:12:27 PM</b></p><ul><li><b>Status</b> change from <i>assigned</i> to <i>done</i></li></ul><p>test comment" //"</p><hr/><p><b>#3 Updated by on 10/19/2010 4:59:13 PM</b></p><ul></ul><hr/><p><b>#2 Updated by on 10/15/2010 5:02:33 PM</b></p><ul><li><b>Spread</b> set to <i></i></li><li><b>Page</b> set to <i></i></li><li><b>Status</b> change from <i>new</i> to <i>assigned</i></li></ul><hr/><p><b>#1 Updated by on 10/15/2010 4:09:41 PM</b></p><ul><li><b>Spread</b> set to <i></i></li><li><b>Page</b> set to <i></i></li><li><b>Category</b> set to <i>Formatting</i></li></body></html>" ); DisplayHTMLStr( gZPWebWindowHWND, inHTMLString ); // Show the window. ShowWindow(gZPWebWindowHWND, nCmdShow); UpdateWindow(gZPWebWindowHWND); }
int CALLBACK WinMain(HINSTANCE hInstance, HINSTANCE hInstNULL, LPSTR lpszCmdLine, int nCmdShow) { MSG msg; // Initialize the OLE interface. We do this once-only. if (OleInitialize(NULL) == S_OK) { WNDCLASSEX wc; // Register the class of our window to host the browser. 'ZPWebBrowserWindowProc' is our message handler // and 'gWinClassName' is the class name. You can choose any class name you want. ZeroMemory(&wc, sizeof(WNDCLASSEX)); wc.cbSize = sizeof(WNDCLASSEX); wc.hInstance = hInstance; wc.lpfnWndProc = ZPWebBrowserWindowProc; wc.lpszClassName = &gWinClassName[0]; RegisterClassEx(&wc); // Create a window. NOTE: We embed the browser object duing our WM_CREATE handling for // this window. if ((msg.hwnd = CreateWindowEx(0, &gWinClassName[0], "Task History", WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, HWND_DESKTOP, NULL, hInstance, 0))) { // For this window, display a string in the BODY of a web page. //DisplayHTMLStr(msg.hwnd, "<H2><CENTER>HTML string test</CENTER></H2><P><FONT COLOR=RED>This is a <U>HTML string</U> in memory.</FONT>"); DisplayHTMLStr(msg.hwnd, "<html><body><p><b>#5 Updated by on 10/19/2010 5:16:53 PM</b></p><ul><li><b>Status</b> change from <i>done</i> to <i>assigned</i></li></ul><p>comments 3</p><hr/><p><b>#4 Updated by on 10/19/2010 5:12:27 PM</b></p><ul><li><b>Status</b> change from <i>assigned</i> to <i>done</i></li></ul><p>test comment" "</p><hr/><p><b>#3 Updated by on 10/19/2010 4:59:13 PM</b></p><ul></ul><hr/><p><b>#2 Updated by on 10/15/2010 5:02:33 PM</b></p><ul><li><b>Spread</b> set to <i></i></li><li><b>Page</b> set to <i></i></li><li><b>Status</b> change from <i>new</i> to <i>assigned</i></li></ul><hr/><p><b>#1 Updated by on 10/15/2010 4:09:41 PM</b></p><ul><li><b>Spread</b> set to <i></i></li><li><b>Page</b> set to <i></i></li><li><b>Category</b> set to <i>Formatting</i></li></body></html>" ); // Show the window. ShowWindow(msg.hwnd, nCmdShow); UpdateWindow(msg.hwnd); } // Do a message loop until WM_QUIT. while (GetMessage(&msg, 0, 0, 0) == 1) { TranslateMessage(&msg); DispatchMessage(&msg); } // Free the OLE library. OleUninitialize(); return(0); } MessageBox(0, "Can't open OLE!", "ERROR", MB_OK); return(-1); }
/*------------------------------------------------ ツールチップの表示更新 --------------------------------------------------*/ void TooltipOnTimer(HWND hwnd) { if (dwTooltipTypeCur == TOOLTIPTYPE_IECOMPO) { DWORD dwMousePos; POINT pt; RECT rc; GetCursorPos(&pt); dwMousePos = (pt.y << 16) | pt.x; GetWindowRect(hwndClock, &rc); if (bTooltipShow) { RECT rc2; GetWindowRect(hwndHTMLParent, &rc2); if (bEmbedBrowserObject) { if (++nTooltipHtmlDispCount >= TOOLTIPHTMLERASETIME * 5 && GetForegroundWindow() != hwndHTMLParent ) ////!PtInRect(&rc, pt) && !PtInRect(&rc2, pt) { ShowWindow(hwndHTMLParent, SW_HIDE); UnEmbedBrowserObject(hwndHTMLParent); bEmbedBrowserObject = FALSE; bTooltipShow = FALSE; nTooltipHtmlDispCount = 0; } } else nTooltipHtmlDispCount = 0; } else { if (!bEmbedBrowserObject && dwMousePosPrev == dwMousePos && PtInRect(&rc, pt)) { if (++nTooltipHtmlDispCount >= TOOLTIPHTMLDISPTIME) { int x,y,cx,cy; cx = iTooltipSizeX; cy = iTooltipSizeY; x = pt.x; y = (pt.y > cy) ? (pt.y - cy) : pt.y; GetWindowRect(GetDesktopWindow(), &rc); if (rc.right <= x + cx) x = rc.right - cx; SetWindowPos(hwndHTMLParent, HWND_TOPMOST, x, y, cx, cy, 0); bEmbedBrowserObject = EmbedBrowserObject(hwndHTMLParent) == 0; if (bEmbedBrowserObject) { TooltipUpdateText(); if(formatTooltip[0] == 'h' && formatTooltip[1] == 't' && formatTooltip[2] == 't' && formatTooltip[3] == 'p') DisplayHTMLPage(hwndHTMLParent, formatTooltip); else DisplayHTMLStr(hwndHTMLParent, formatTooltip); ShowWindow(hwndHTMLParent, SW_SHOW); SetActiveWindow(hwndHTMLParent); bTooltipShow = TRUE; } nTooltipHtmlDispCount = 0; } } else nTooltipHtmlDispCount = 0; } dwMousePosPrev = dwMousePos; } if (!bTooltipShow) return; if (++iTooltipDispIntervalCount < iTooltipDispInterval * 5) return; iTooltipDispIntervalCount = 0; if (!bTooltipUpdateEnable[iTooltipSelected]) return; switch(dwTooltipTypeCur) { case TOOLTIPTYPE_NORMAL: case TOOLTIPTYPE_BALLOON: if (hwndTooltip) { TOOLINFO ti; TooltipUpdateText(); TooltipUpdateTitle(); ti.cbSize = sizeof(TOOLINFO); ti.hwnd = hwnd; ti.uId = 1; SendMessage(hwndTooltip, TTM_GETTOOLINFO, 0, (LPARAM)(LPTOOLINFO)&ti); ti.uFlags = 0; ti.hinst = NULL; ti.lpszText = LPSTR_TEXTCALLBACK; SendMessage(hwndTooltip, TTM_UPDATETIPTEXT, 0, (LPARAM)(LPTOOLINFO)&ti); } break; } }
int CALLBACK WinMain(HINSTANCE hInstance, HINSTANCE hInstNULL, LPSTR lpszCmdLine, int nCmdShow) { //HINSTANCE cwebdll; MSG msg; WNDCLASSEX wc; int i; HWND hwnd; // Load our DLL containing the OLE/COM code. We do this once-only. It's named "cwebpage.dll" // if ((cwebdll = LoadLibrary(L"cwebpage.dll"))) // { // Get pointers to the EmbedBrowserObject, DisplayHTMLPage, DisplayHTMLStr, and UnEmbedBrowserObject // functions, and store them in some globals. // Get the address of the EmbedBrowserObject() function. NOTE: Only Reginald has this one //lpEmbedBrowserObject = (EmbedBrowserObjectPtr *)GetProcAddress((HINSTANCE)cwebdll, "EmbedBrowserObject"); //// Get the address of the UnEmbedBrowserObject() function. NOTE: Only Reginald has this one //lpUnEmbedBrowserObject = (UnEmbedBrowserObjectPtr *)GetProcAddress((HINSTANCE)cwebdll, "UnEmbedBrowserObject"); //// Get the address of the DisplayHTMLPagePtr() function //lpDisplayHTMLPage = (DisplayHTMLPagePtr *)GetProcAddress((HINSTANCE)cwebdll, "DisplayHTMLPage"); //// Get the address of the DisplayHTMLStr() function //lpDisplayHTMLStr = (DisplayHTMLStrPtr *)GetProcAddress((HINSTANCE)cwebdll, "DisplayHTMLStr"); // Register the class of our window to host the browser. 'WindowProc' is our message handler // and 'ClassName' is the class name. You can choose any class name you want. ZeroMemory(&wc, sizeof(WNDCLASSEX)); wc.cbSize = sizeof(WNDCLASSEX); wc.hInstance = hInstance; wc.lpfnWndProc = WindowProc1; wc.lpszClassName = &ClassName[0]; RegisterClassEx(&wc); /* hwnd = CreateWindowEx(0, &ClassName[0], L"An HTML string", WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, HWND_DESKTOP, NULL, hInstance, 0);*/ msg.hwnd=CreateDialogParam(hInstance, MAKEINTRESOURCE(IDD_MARK_DLG),0,(DLGPROC)WindowProc, 0); EmbedBrowserObject(msg.hwnd); // DisplayHTMLPage(msg.hwnd,L"http://www.microsoft.com"); DisplayHTMLStr(msg.hwnd, L"<H2><CENTER>HTML string test</CENTER></H2><P><FONT COLOR=RED>This is a <U>HTML string</U> in memory.</FONT>"); // Create a window. NOTE: We embed the browser object duing our WM_CREATE handling for // this window. /* if ((msg.hwnd = CreateWindowEx(0, &ClassName[0], L"An HTML string", WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, HWND_DESKTOP, NULL, hInstance, 0)))*/ // i=GetLastError(); //{ // For this window, display a string in the BODY of a web page. // (*lpDisplayHTMLStr)(msg.hwnd, "<H2><CENTER>HTML string test</CENTER></H2><P><FONT COLOR=RED>This is a <U>HTML string</U> in memory.</FONT>"); // Show the window. // ShowWindow(hwnd, nCmdShow); ShowWindow(msg.hwnd, nCmdShow); //UpdateWindow(msg.hwnd); // } // Create another window with another browser object embedded in it. // Do a message loop until WM_QUIT. while (GetMessage(&msg, 0, 0, 0)) { TranslateMessage(&msg); DispatchMessage(&msg); } // Free the DLL. // FreeLibrary(cwebdll); return(0); //} MessageBox(0, L"Can't open cwebpage.dll!", L"ERROR", MB_OK); return(-1); }