示例#1
0
文件: rtf.cpp 项目: littlemole/moe
RTFEditor::RTFEditor()
{
	wndClass().setIcon(moe()->icon); 
	wndClass().hIconSm(moe()->icon); 

	findText_.chrg.cpMin = 0;
	findText_.chrg.cpMax = -1;
	findText_.lpstrText = 0;

	shuttingDown_ = false;

	rtfDocument_.QueryInterface(IID_IUnknown,(void**)&oleObject);
}
示例#2
0
void Window::Init(const WindowParam& param)
{
	WNDCLASSEX wndClass(param.wndClass);
	wndClass.lpfnWndProc = WndProc;
	
	wndClass.lpszClassName = param.wndClass_className.get();
	
	if(!RegisterClassEx(&wndClass))
		throw WIN32EXCEPTION_1("RegisterClassEx");
	
	_parentHwnd = param.hWndParent;
	_clientAreaAsCaption = param.clientAreaAsCaption;
	
	_hwnd = CreateWindowEx(
			param.exStyle,
			wndClass.lpszClassName,
			param.caption.get(),
			param.style,
			param.x,
			param.y,
			param.width,
			param.height,
			param.hWndParent,
			param.hMenu,
			wndClass.hInstance,
			param.lpParam);

	if(!_hwnd)
		throw WIN32EXCEPTION_1("CreateWindow");
	
	RegisterWindow(*this);
	onCreate(*this);
}
示例#3
0
int APIENTRY WinMain(HINSTANCE hInstance,
                     HINSTANCE hPrevInstance,
                     LPSTR    lpCmdLine,
                     int       nCmdShow)
{

    // Register the main window class
    WindowClass wndClass( KWindowClass, WndProc );

    // Create all of the windows
    CreateWindows();

    // Create the "sink" window that handles the timer to update all other windows
    HWND hWnd = CreateWindowA( KWindowClass, KWindowTitle, 
         WS_POPUP | WS_CLIPSIBLINGS | WS_CLIPCHILDREN, // style
        CW_USEDEFAULT,  //x
        0,              // y
        1, // w
        1,  // h
        NULL, // Parent
        NULL, // hMenu
        hInstance, NULL);
    DWORD gle = GetLastError();

    // Update the new window
    UpdateWindow(hWnd);

    // Add the tray icon
    AddTrayIcon(hWnd);

    // Main message loop
    MSG msg;
    while (GetMessage(&msg, NULL, 0, 0))
    {
        TranslateMessage(&msg);
        DispatchMessage(&msg);  
    }

    for ( unsigned int i=0; i<g_windows.size(); i++ )
    {
        delete g_windows[i];
    }

    return (int) msg.wParam;
}