//--------------------------------------------------------------------------- // allocate text object (advanced) HANDLE DLL_CALLCONV MTI_MTextCreateEx(HANDLE userHandle, void *text, DWORD flags) { TextObject *result = new TextObject; result->options = TextUserGetOptions(userHandle); result->ftd = new CFormattedTextDraw; result->ftd->Create(); InitRichEdit(result->ftd->getTextService()); MText_InitFormatting0(result->ftd, result->options); if (flags & MTEXT_FLG_WCHAR) result->ftd->putTextW((WCHAR *)text); else result->ftd->putTextA((char *)text); MText_InitFormatting1(result); delete result; return 0; }
//--------------------------------------------------------------------------- // allocate text object (unicode) HANDLE DLL_CALLCONV MTI_MTextCreateW(HANDLE userHandle, WCHAR *text) { TextObject *result = new TextObject; result->options = TextUserGetOptions(userHandle); result->ftd = new CFormattedTextDraw; result->ftd->Create(); InitRichEdit(result->ftd->getTextService()); MText_InitFormatting0(result->ftd, result->options); result->ftd->putTextW(text); MText_InitFormatting1(result); return (HANDLE)result; }
/********************************************************************* * * Function : CreateLogWindow * * Description : Create the logging window. * * Parameters : * 1 : hInstance = application's instance handle * 2 : nCmdShow = window show value (MIN, MAX, NORMAL, etc...) * * Returns : Handle to newly created window. * *********************************************************************/ HWND CreateLogWindow(HINSTANCE hInstance, int nCmdShow) { static const char *szWndName = "PrivoxyLogWindow"; static const char *szWndTitle = "Privoxy"; HWND hwnd = NULL; HWND hwndOwner = (g_bShowOnTaskBar) ? NULL : CreateHiddenLogOwnerWindow(hInstance); RECT rcClient; WNDCLASSEX wc; memset(&wc, 0, sizeof(wc)); wc.cbSize = sizeof(wc); wc.style = CS_DBLCLKS; wc.lpfnWndProc = LogWindowProc; wc.cbClsExtra = 0; wc.cbWndExtra = 0; wc.hInstance = hInstance; wc.hIcon = g_hiconApp; wc.hCursor = 0; wc.hbrBackground = 0; wc.lpszMenuName = MAKEINTRESOURCE(IDR_LOGVIEW); wc.lpszClassName = szWndName; wc.hbrBackground = GetStockObject(WHITE_BRUSH); RegisterClassEx(&wc); hwnd = CreateWindowEx(WS_EX_APPWINDOW, szWndName, szWndTitle, WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, hwndOwner, NULL, hInstance, NULL); /* Now create a child list box */ GetClientRect(hwnd, &rcClient); /* Create a rich edit control */ InitRichEdit(); g_hwndLogBox = CreateWindowEx(0, (g_nRichEditVersion == 0x0100) ? "RichEdit" : RICHEDIT_CLASS, "", ES_AUTOVSCROLL | ES_MULTILINE | ES_READONLY | ES_NOHIDESEL | WS_CHILD | WS_VSCROLL | WS_HSCROLL | WS_VISIBLE, rcClient.left, rcClient.top, rcClient.right, rcClient.bottom, hwnd, NULL, hInstance, NULL); /* SendMessage(g_hwndLogBox, EM_SETWORDWRAPMODE, 0, 0); */ /* Subclass the control to catch certain messages */ g_fnLogBox = (WNDPROC) GetWindowLongPtr(g_hwndLogBox, GWLP_WNDPROC); SetWindowLongPtr(g_hwndLogBox, GWLP_WNDPROC, (LONG_PTR) LogRichEditProc); /* Minimizing looks stupid when the log window is not on the task bar, so hide instead */ if (!g_bShowOnTaskBar && (nCmdShow == SW_SHOWMINIMIZED || nCmdShow == SW_MINIMIZE || nCmdShow == SW_SHOWMINNOACTIVE)) { g_bShowLogWindow = FALSE; nCmdShow = SW_HIDE; } ShowWindow(hwnd, nCmdShow); UpdateWindow(hwnd); GetClientRect(g_hwndLogFrame, &rcClient); SetWindowPos(g_hwndLogBox, NULL, rcClient.left, rcClient.top, rcClient.right - rcClient.left, rcClient.bottom - rcClient.top, SWP_NOZORDER); return hwnd; }