コード例 #1
0
//----------------------------------------------------------------------------------------
// 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);
}
コード例 #2
0
LRESULT CALLBACK ZPWebBrowserWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
	switch (uMsg)
	{
		case WM_SIZE:
		{
			// Resize the browser object to fit the window
			ResizeBrowser(hwnd, LOWORD(lParam), HIWORD(lParam));
			return(0);
		}

		case WM_CREATE:
		{
			// Embed the browser object into our host window. We need do this only
			// once. Note that the browser object will start calling some of our
			// IOleInPlaceFrame and IOleClientSite functions as soon as we start
			// calling browser object functions in EmbedBrowserObject().
			if (EmbedBrowserObject(hwnd)) return(-1);

			// Another window created with an embedded browser object
			//++gZPWebWindowCount;
			gZPWebWindowHWND = hwnd;

			// Success
			return(0);
		}

		case WM_DESTROY:
		{
			// Detach the browser object from this window, and free resources.
			UnEmbedBrowserObject(hwnd);

			{	//Save the window size.
				RECT windowSize;
				GetWindowRect( hwnd, &windowSize );
				gWindowX = windowSize.left;
				gWindowY = windowSize.top;
				gWindowWidth = windowSize.right - windowSize.left;
				gWindowHeight = windowSize.bottom - windowSize.top;
			}

			// One less window
			//--gZPWebWindowCount;
			gZPWebWindowHWND = NULL;
			HandleHistoryPanelClose();
	
			// Free the OLE library.
			//OleUninitialize();	//Commented as OleInitialize is also commented

			// If all the windows are now closed, quit this app
			//if (!gZPWebWindowCount) PostQuitMessage(0);

			return(TRUE);
		}
	}

	return(DefWindowProc(hwnd, uMsg, wParam, lParam));
}
コード例 #3
0
static LRESULT CALLBACK _WindowProcWebView(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{

	switch (uMsg)
	{
	case WM_SIZE:
		{
			// Resize the browser object to fit the window
			ResizeBrowser(hwnd, LOWORD(lParam), HIWORD(lParam));
			return(0);
		}

	case WM_CREATE:
		{
			// Embed the browser object into our host window. We need do this only
			// once. Note that the browser object will start calling some of our
			// IOleInPlaceFrame and IOleClientSite functions as soon as we start
			// calling browser object functions in EmbedBrowserObject().
			if (EmbedBrowserObject(hwnd)) return(-1);

			// Another window created with an embedded browser object
			++WindowCount;

			// Success
			return(0);
		}

	case WM_DESTROY:
		{
			// Detach the browser object from this window, and free resources.
			UnEmbedBrowserObject(hwnd);
			OleUninitialize();
			// One less window
			--WindowCount;

			return(TRUE);
		}
	}

	return(DefWindowProc(hwnd, uMsg, wParam, lParam));

}
コード例 #4
0
ファイル: tooltip.c プロジェクト: h16o2u9u/rtoss
/*------------------------------------------------
 ツールチップの表示更新
--------------------------------------------------*/
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;
	}
}
コード例 #5
0
ファイル: example.c プロジェクト: madhur/Npp-Markdown-Viewer
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);
}