示例#1
0
文件: Window.cpp 项目: LK8000/LK8000
bool Window::Create(Window* pOwner, const RECT& rect) {
#ifndef NDEBUG
    if(pOwner) {
        assert(::GetCurrentThreadId() == ::GetWindowThreadProcessId(pOwner->Handle(), NULL));
    }
#endif

    // Create the window
    // send the this pointer as the window creation parameter
    HWND hwnd = CreateWindow(_szClassName.c_str(), _szWindowText.c_str(), _dwStyles, rect.left, rect.top,
            rect.right - rect.left, rect.bottom - rect.top, pOwner?pOwner->Handle():NULL, NULL, _hInstance,
            (void *)this);

    assert(hwnd);

    if(hwnd && !_hWnd) {
        // if CreateWindow return valid HWND, this it's not custom window class, so, we need to set WNDPROC
        _hWnd = hwnd;
        SubClassWindow();
    }

    if(_hWnd) {
        OnCreate();
    } else {
        StartupStore(_T("Window::Create error <0x%x>\n"), GetLastError());
    }

    return (_hWnd != NULL);
}
示例#2
0
BOOL __export FAR PASCAL EnumChildWindowsFunc( HWND hwnd, DWORD lparam )
{
    lparam=lparam;
    return( SubClassWindow( hwnd, FALSE ) );
}
示例#3
0
BOOL __export FAR PASCAL EnumTaskWindowsFunc( HWND hwnd, DWORD lparam )
{
    lparam=lparam;
    return( SubClassWindow( hwnd, TRUE ) );
}