Exemple #1
0
BOOL
InitControls(HWND hwnd)
{
    if (SettingsInfo.bSaveWndPos)
    {
        MoveWindow(hwnd, SettingsInfo.Left, SettingsInfo.Top,
                   SettingsInfo.Right - SettingsInfo.Left,
                   SettingsInfo.Bottom - SettingsInfo.Top, TRUE);

        if (SettingsInfo.Maximized) ShowWindow(hwnd, SW_MAXIMIZE);
    }

    if (CreateStatusBar(hwnd) &&
        CreateToolBar(hwnd) &&
        CreateListView(hwnd) &&
        CreateTreeView(hwnd) &&
        CreateRichEdit(hwnd) &&
        CreateVSplitBar(hwnd) &&
        CreateHSplitBar(hwnd))
    {
        WCHAR szBuffer1[MAX_STR_LEN], szBuffer2[MAX_STR_LEN];

        InitApplicationsList();

        InitCategoriesList();

        LoadStringW(hInst, IDS_APPS_COUNT, szBuffer2, sizeof(szBuffer2) / sizeof(WCHAR));
        swprintf(szBuffer1, szBuffer2, ListView_GetItemCount(hListView));
        SetStatusBarText(szBuffer1);
        return TRUE;
    }

    return FALSE;
}
Exemple #2
0
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
	PAINTSTRUCT ps;
	HDC hdc;

	switch (message)
	{
	case WM_CREATE:
		{
			std::mutex g_lock;
			g_lock.lock();

			gEnv->logBox = CreateRichEdit(hWnd,0,0,735,385);

			gEnv->statusBox = CreateWindow(TEXT("EDIT"),TEXT(""), WS_VISIBLE | WS_DISABLED | WS_CHILD | ES_CENTER,0,387,750,20,hWnd,(HMENU)1,NULL,NULL);

			gEnv->consoleBox = CreateWindow(TEXT("EDIT"),TEXT(""),WS_VISIBLE | WS_CHILD | WS_BORDER | ES_AUTOHSCROLL,0,407,750,20,hWnd,(HMENU)1,NULL,NULL);

			g_lock.unlock();
			break;
		}

	case WM_PAINT:
		{
			hdc = BeginPaint(hWnd, &ps);
			EndPaint(hWnd, &ps);
			break;
		}

	case WM_DESTROY:
		PostQuitMessage(0);
		break;

	case WM_CTLCOLORSTATIC:
		SetBkColor((HDC)wParam, RGB(0,0,0));
		SetTextColor((HDC)wParam, RGB(255,255,255));
		return  (LRESULT)GetStockObject(BLACK_BRUSH);
		break;

	case WM_CTLCOLOREDIT:
		SetBkColor((HDC)wParam, RGB(0,0,0));
		SetTextColor((HDC)wParam, RGB(255,255,255));
		return  (LRESULT)GetStockObject(BLACK_BRUSH);
		break;

	case WM_CLOSE:
		if(MessageBox(hWnd,"You realy want close server???",szWindowClass,MB_OKCANCEL)==IDOK)
		{
			DestroyWindow(hWnd);
			break;
		}
		else return 0;	

	default:
		return DefWindowProc(hWnd, message, wParam, lParam);
		break;
	}

	return 0;
}
Exemple #3
0
HWND CRuntimeDlg::CreateControl(LPCTSTR szClass, LPCTSTR szCaption, DWORD dwStyle, DWORD dwExStyle, 
								int x, int y, int cx, int cy, UINT nID, BOOL bDLU, UINT nIconID)
{
	if (bDLU)
	{
		CDlgUnits dlu(*this);
		
		dlu.ToPixels(x, y);
		dlu.ToPixels(cx, cy);
	}

	// override caption
	CString sCaption = OverrideItemText(nID);

	if (sCaption.IsEmpty())
		sCaption = szCaption;
	
	// validate the topleft position against the borders
	x = max(x, m_rBorders.left);
	y = max(y, m_rBorders.top);
	
	// make reasonably sure control is child
	dwStyle |= WS_CHILD;
	dwStyle &= ~WS_POPUP;
	
	// we don't need to be notified by our own children
	dwExStyle |= WS_EX_NOPARENTNOTIFY;
	
	// if its a richedit then make sure richedit dll is initialized
	HWND hwnd = NULL;
	
	if (CWinClasses::IsRichEditControl(szClass))
		hwnd = CreateRichEdit(szClass, sCaption, dwStyle, dwExStyle, x, y, cx, cy, *this, nID);
	else
		hwnd = ::CreateWindowEx(dwExStyle, szClass, sCaption, dwStyle, x, y, cx, cy, *this, (HMENU)nID, NULL, NULL);
	
	if (hwnd)
	{
		HFONT hFont = (HFONT)SendMessage(WM_GETFONT); // gets the dialog's font
		
		if (!hFont)
			hFont = (HFONT)::GetStockObject(DEFAULT_GUI_FONT);
		
		::SendMessage(hwnd, WM_SETFONT, (WPARAM)hFont, 0); 

		if (nIconID && _tcsicmp(szClass, _T("static")) == 0)
		{
			HICON hIcon = AfxGetApp()->LoadIcon(nIconID);
			
			if (hIcon)
				::SendMessage(hwnd, STM_SETIMAGE, IMAGE_ICON, (LPARAM)hIcon);
		}
		else if (!sCaption.IsEmpty())
			::SendMessage(hwnd, WM_SETTEXT, 0, (LPARAM)(LPCTSTR)sCaption);
	}
	else
		TRACE(_T("CreateWindowEx(%s) failed. GetLastError returned %08X\n"), szClass, GetLastError());
	
	return hwnd;
}
Exemple #4
0
BOOL
InitControls(HWND hwnd)
{

    if (CreateStatusBar(hwnd) &&
        CreateToolBar(hwnd)   &&
        CreateListView(hwnd)  &&
        CreateTreeView(hwnd)  &&
        CreateRichEdit(hwnd)  &&
        CreateVSplitBar(hwnd) &&
        CreateHSplitBar(hwnd))
    {
        WCHAR szBuffer1[MAX_STR_LEN], szBuffer2[MAX_STR_LEN];

        InitApplicationsList();

        InitCategoriesList();

        LoadStringW(hInst, IDS_APPS_COUNT, szBuffer2, _countof(szBuffer2));
        StringCbPrintfW(szBuffer1, sizeof(szBuffer1),
                        szBuffer2,
                        ListView_GetItemCount(hListView));
        SetStatusBarText(szBuffer1);
        return TRUE;
    }

    return FALSE;
}
HRESULT CFormattedTextDraw::CreateTextServicesObject()
{
	HRESULT hr = S_OK;
	
	IUnknown *spUnk;
	hr = CreateRichEdit(static_cast<ITextHost*>(this), &spUnk);
	if (hr == S_OK) 
	{
		hr = spUnk->QueryInterface(IID_ITextServicesEx, (void**)&m_spTextServices);
		hr = spUnk->QueryInterface(IID_ITextDocument, (void**)&m_spTextDocument);
		spUnk->Release();
	}

	return hr;
}
Exemple #6
0
    BOOL CreateLayout()
    {
        bool b = TRUE;

        m_ClientPanel = new CUiPanel();
        m_ClientPanel->m_VerticalAlignment = UiAlign_Stretch;
        m_ClientPanel->m_HorizontalAlignment = UiAlign_Stretch;

        // Top level
        b = b && CreateStatusBar();
        b = b && CreateToolbar();
        b = b && CreateSearchBar();
        b = b && CreateVSplitter();

        // Inside V Splitter
        b = b && CreateHSplitter();
        b = b && CreateTreeView();

        // Inside H Splitter
        b = b && CreateListView();
        b = b && CreateRichEdit();

        if (b)
        {
            RECT rTop;
            RECT rBottom;

            /* Size status bar */
            m_StatusBar->SendMessage(WM_SIZE, 0, 0);

            /* Size tool bar */
            m_Toolbar->AutoSize();

            ::GetWindowRect(m_Toolbar->m_hWnd, &rTop);
            ::GetWindowRect(m_StatusBar->m_hWnd, &rBottom);

            m_VSplitter->m_Margin.top = rTop.bottom - rTop.top;
            m_VSplitter->m_Margin.bottom = rBottom.bottom-rBottom.top;
        }

        return b;
    }