cWindow.cpp
上传用户:sycq158
上传日期:2008-10-22
资源大小:15361k
文件大小:1k
- // CMAIN LIB - APPLICATION AND DIRECT WRAPPER
- //
- // Written by Mauricio Teichmann Ritter
- //
- // Copyright (C) 2002, Brazil. All rights reserved.
- //
- //
- #include "cWindow.h"
- #include "cApplication.h"
- BOOL cWindow::RegisterWindow(LPSTR lpszClassName)
- {
- WNDCLASSEX wc;
-
- BOOL bRet;
-
- ZeroMemory(&wc, sizeof(WNDCLASSEX));
- wc.cbSize = sizeof(WNDCLASSEX);
- wc.style = CS_DBLCLKS;
- wc.lpfnWndProc = MainWndproc;
- wc.cbClsExtra = 0;
- wc.cbWndExtra = 0;
- wc.hInstance = cApplication::GetInstHandle();
- wc.hIcon = NULL;
- wc.hCursor = LoadCursor( NULL, IDC_ARROW );
- wc.hbrBackground = CreateSolidBrush(RGB(0,0,0));
- wc.lpszMenuName = NULL;
- wc.lpszClassName = lpszClassName;
- bRet = RegisterClassEx( &wc );
- if( !bRet )
- {
- return FALSE;
- }
- m_lpszClassName = lpszClassName;
- return TRUE;
- }
- BOOL cWindow::Create(LPSTR lpszWindowName)
- {
- m_hWnd = CreateWindowEx(0, // WS_EX_TOPMOST,
- m_lpszClassName,
- lpszWindowName,
- WS_VISIBLE | // so we don't have to call ShowWindow
- WS_POPUP | // non-app window
- WS_SYSMENU,//so we get an icon in the tray
- 0,
- 0,
- GetSystemMetrics(SM_CXSCREEN),
- GetSystemMetrics(SM_CYSCREEN),
- NULL,
- NULL,
- cApplication::GetInstHandle(),
- NULL );
- if( !m_hWnd )
- {
- return FALSE;
- }
- UpdateWindow( m_hWnd );
- return TRUE;
- }
- HWND cWindow::GetHWnd()
- {
- return m_hWnd;
- }