[ create a new paste ] login | about

Link: http://codepad.org/ajqIvwl1    [ raw code | fork ]

C++, pasted on Sep 22:
#include <windows.h>
#include <commctrl.h>
#include <stdio.h>
#include "resource.h"

HINSTANCE hInst;
HBITMAP hSkin;
HBRUSH hBrush;

BOOL CALLBACK DlgMain(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
    switch(uMsg)
    {
    case WM_INITDIALOG:
    {
        hSkin=LoadBitmap(GetModuleHandle(NULL), MAKEINTRESOURCE(IDB_BITMAP1));
        hBrush=CreatePatternBrush(hSkin);
    }
    return TRUE;

    case WM_CLOSE:
    {
        EndDialog(hwndDlg, 0);
    }
    return TRUE;

    case WM_LBUTTONDOWN:
    {
        SendMessage(hwndDlg, WM_NCLBUTTONDOWN, HTCAPTION, NULL);
    }
    return TRUE;

    case WM_CTLCOLOREDIT:
    {
        RECT rect_edit= {0};
        RECT rect_window= {0};
        GetWindowRect(hwndDlg, &rect_window); //Window placement
        GetWindowRect((HWND)lParam, &rect_edit); //Control placement

        SetBkMode((HDC) wParam, TRANSPARENT); //Transparent control
        SetTextColor((HDC) wParam, RGB(255, 255, 255)); //White text
        SetBrushOrgEx((HDC)wParam, rect_window.left-rect_edit.left, rect_window.top-rect_edit.top, 0); //Set the brush origin (relative placement)
        return (BOOL)hBrush;
    }

    case WM_COMMAND:
    {
        switch(LOWORD(wParam))
        {
        case IDC_BUTTON1:
        {
            SendMessageA(hwndDlg, WM_CLOSE, 0, 0);
        }
        return TRUE;
        }
    }
    return TRUE;
    }
    return FALSE;
}


int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)
{
    hInst=hInstance;
    InitCommonControls();
    return DialogBox(hInst, MAKEINTRESOURCE(DLG_MAIN), NULL, (DLGPROC)DlgMain);
}


Create a new paste based on this one


Comments: