Exemplo n.º 1
0
/*--------------------------------------------------------------+
| statusInit - initialize for status window, register the
|          Window's class.
|
+--------------------------------------------------------------*/
BOOL statusInit(HANDLE hInst, HANDLE hPrev)
{
    WNDCLASS  cls;

    statusCreateTools();

    if(!hPrev)
    {
        cls.hCursor       = LoadCursor(NULL, IDC_ARROW);
        cls.hIcon         = NULL;
        cls.lpszMenuName  = NULL;
        cls.lpszClassName = szStatusClass;
        cls.hbrBackground = (HBRUSH) (COLOR_BTNFACE + 1);
        cls.hInstance     = (HINSTANCE)hInst;
        cls.style         = CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS;
        cls.lpfnWndProc   = (WNDPROC)statusWndProc;
        cls.cbClsExtra    = 0;
        cls.cbWndExtra    = 0;

        if(!RegisterClass(&cls))
            return FALSE;

        cls.hCursor        = LoadCursor(NULL,IDC_ARROW);
        cls.hIcon          = NULL;
        cls.lpszMenuName   = NULL;
        cls.lpszClassName  = szText;
        cls.hbrBackground  = (HBRUSH) (COLOR_BTNFACE + 1);
        cls.hInstance      = (HINSTANCE)hInst;
        cls.style          = CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS;
        cls.lpfnWndProc    = (WNDPROC)fnText;
        cls.cbClsExtra     = 0;
        cls.cbWndExtra     = 0;

        if(!RegisterClass(&cls))
            return FALSE;
    }

    return TRUE;
}
Exemplo n.º 2
0
/*--------------------------------------------------------------+
| statusWndProc - window proc for status window
|
+--------------------------------------------------------------*/
LRESULT CALLBACK statusWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
    PAINTSTRUCT ps;
    HWND hwndSText;

    switch(msg)
    {
        case WM_CREATE:
        {

            // The following code is correct for x64, but the /Wp64 switch doesn't think so.
            // Therefore, temporarily disable warning C4312.
#pragma warning(push)
#pragma warning(disable: 4312)

            /* we need to create the static text control for the status bar */
            hwndSText = CreateWindow(szText,
                                     TEXT(""),
                                     WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS,
                                     0, 0, 0, 0,
                                     hwnd,
                                     (HMENU) 1,  // child id
                                     GetWindowInstance(hwnd),   // Returns (HMODULE)LONG_PTR
                                     NULL);
#pragma warning(pop)


            if(!hwndSText)
                return -1;

            break;
        }

        case WM_DESTROY:
            statusDeleteTools();
            break;

        case WM_SIZE:
        {
            RECT rc;

            GetClientRect(hwnd, &rc);

            MoveWindow(GetDlgItem(hwnd, 1),    // get child window handle
                2, 1,                          // xy just inside
                rc.right - 4,
                rc.bottom - 2,
                TRUE);

            break;
        }

        case WM_PAINT:
        {
            BeginPaint(hwnd, &ps);

            // only the background and the child window need painting
            EndPaint(hwnd, &ps);
            break;
        }

        case WM_SYSCOLORCHANGE:
            statusDeleteTools();
            statusCreateTools();
            break;

        case WM_ERASEBKGND:
            break;

    }

    return DefWindowProc(hwnd, msg, wParam, lParam);
}
Exemplo n.º 3
0
/*--------------------------------------------------------------+
| statusWndProc - window proc for status window
|
+--------------------------------------------------------------*/
LRESULT CALLBACK statusWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
    PAINTSTRUCT ps;
    HWND hwndSText;

    switch(msg)
    {
        case WM_CREATE:
        {
            /* we need to create the static text control for the status bar */
            hwndSText = CreateWindow(szText,
                                     TEXT(""),
                                     WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS,
                                     0, 0, 0, 0,
                                     hwnd,
                                     (HMENU) 1,  // child id
                                     GetWindowInstance(hwnd),
                                     NULL);
            if(!hwndSText)
                return -1;

            break;
        }

        case WM_DESTROY:
            statusDeleteTools();
            break;

        case WM_SIZE:
        {
            RECT rc;

            GetClientRect(hwnd, &rc);

            MoveWindow(GetDlgItem(hwnd, 1),    // get child window handle
                2, 1,                          // xy just inside
                rc.right - 4,
                rc.bottom - 2,
                TRUE);

            break;
        }

        case WM_PAINT:
        {
            BeginPaint(hwnd, &ps);

            // only the background and the child window need painting
            EndPaint(hwnd, &ps);
            break;
        }

        case WM_SYSCOLORCHANGE:
            statusDeleteTools();
            statusCreateTools();
            break;

        case WM_ERASEBKGND:
            break;

    }

    return DefWindowProc(hwnd, msg, wParam, lParam);
}