当前位置: 首页>>代码示例>>C++>>正文


C++ CreateWindowExW函数代码示例

本文整理汇总了C++中CreateWindowExW函数的典型用法代码示例。如果您正苦于以下问题:C++ CreateWindowExW函数的具体用法?C++ CreateWindowExW怎么用?C++ CreateWindowExW使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了CreateWindowExW函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: CreateWindowExW

void NzWindowImpl::WindowThread(HWND* handle, DWORD styleEx, const wchar_t* title, DWORD style, unsigned int x, unsigned int y, unsigned int width, unsigned int height, NzWindowImpl* window, NzMutex* mutex, NzConditionVariable* condition)
{
	HWND& winHandle = *handle;
	winHandle = CreateWindowExW(styleEx, className, title, style, x, y, width, height, nullptr, nullptr, GetModuleHandle(nullptr), window);

	mutex->Lock();
	condition->Signal();
	mutex->Unlock(); // mutex et condition sont considérés invalides à partir d'ici

	if (!winHandle)
		return;

	while (window->m_threadActive)
		window->ProcessEvents(true);

	DestroyWindow(winHandle);
}
开发者ID:GuillaumeBelz,项目名称:NazaraEngine,代码行数:17,代码来源:WindowImpl.cpp

示例2: GetParent

/******************************************************************************
 * create_listbox
 */
void CAutoComplete::CreateListbox()
{
    HWND hwndParent = GetParent(hwndEdit);

    /* FIXME : The listbox should be resizable with the mouse. WS_THICKFRAME looks ugly */
    hwndListBox = CreateWindowExW(0, WC_LISTBOXW, NULL,
                                  WS_BORDER | WS_CHILD | WS_VSCROLL | LBS_HASSTRINGS | LBS_NOTIFY | LBS_NOINTEGRALHEIGHT,
                                  CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
                                  hwndParent, NULL,
                                  (HINSTANCE)GetWindowLongPtrW(hwndParent, GWLP_HINSTANCE), NULL);

    if (hwndListBox)
    {
        wpOrigLBoxProc = (WNDPROC)SetWindowLongPtrW(hwndListBox, GWLP_WNDPROC, (LONG_PTR)ACLBoxSubclassProc);
        SetWindowLongPtrW(hwndListBox, GWLP_USERDATA, (LONG_PTR)this);
    }
}
开发者ID:Moteesh,项目名称:reactos,代码行数:20,代码来源:CAutoComplete.cpp

示例3: AddContentTab

static BOOL AddContentTab(HHInfo *info)
{
    if(info->tabs[TAB_CONTENTS].id == -1)
        return TRUE; /* No "Contents" tab */
    info->tabs[TAB_CONTENTS].hwnd = CreateWindowExW(WS_EX_CLIENTEDGE, WC_TREEVIEWW,
           szEmpty, WS_CHILD | WS_BORDER | 0x25, 50, 50, 100, 100,
           info->WinType.hwndNavigation, NULL, hhctrl_hinstance, NULL);
    if(!info->tabs[TAB_CONTENTS].hwnd) {
        ERR("Could not create treeview control\n");
        return FALSE;
    }

    ResizeTabChild(info, TAB_CONTENTS);
    ShowWindow(info->tabs[TAB_CONTENTS].hwnd, SW_SHOW);

    return TRUE;
}
开发者ID:YokoZar,项目名称:wine,代码行数:17,代码来源:help.c

示例4: CreateWindowExW

HWND WindowImpl::createWindow(Point pos, WDims dims, wchar_t const windowname[], wchar_t const classname[], DWORD style)
{
	HWND hWnd = CreateWindowExW(
		WS_EX_APPWINDOW,
		classname, windowname,
//		WS_CLIPCHILDREN | WS_OVERLAPPEDWINDOW | style,
		WS_OVERLAPPEDWINDOW | style,
		pos.x, pos.y,
		dims.width, dims.height,
		NULL, NULL,
		GetModuleHandle(NULL), NULL
	);
	if( hWnd == NULL ) {
		throw std::runtime_error(log::nativeErrorString());
	}
    return hWnd;
}
开发者ID:thinlizzy,项目名称:die-tk,代码行数:17,代码来源:WindowImplWin32.cpp

示例5: main

int main(int argc, char *argv[])
{
	D2D1_FACTORY_OPTIONS opts;
	WNDCLASSW wc;
	HWND mainwin;
	MSG msg;
	HRESULT hr;

	CoInitialize(NULL);
	ZeroMemory(&opts, sizeof (D2D1_FACTORY_OPTIONS));
	opts.debugLevel = D2D1_DEBUG_LEVEL_NONE;
	hr = D2D1CreateFactory(D2D1_FACTORY_TYPE_SINGLE_THREADED,
		IID_ID2D1Factory,
		&opts,
		(void **) (&d2dfactory));
	if (hr != S_OK) {
		loghr("D2D1CreateFactory()", hr);
		return 1;
	}

	ZeroMemory(&wc, sizeof (WNDCLASSW));
	wc.lpszClassName = L"mainwin";
	wc.lpfnWndProc = wndproc;
	wc.hbrBackground = (HBRUSH) (COLOR_BTNFACE + 1);
	RegisterClassW(&wc);

	mainwin = CreateWindowExW(0,
		L"mainwin", L"mainwin",
		WS_OVERLAPPEDWINDOW,
		CW_USEDEFAULT, CW_USEDEFAULT,
		640, 480,
		NULL, NULL, NULL, NULL);

	ShowWindow(mainwin, SW_SHOWDEFAULT);
	UpdateWindow(mainwin);

	while (GetMessageW(&msg, NULL, 0, 0)) {
		TranslateMessage(&msg);
		DispatchMessageW(&msg);
	}

	d2dfactory->Release();
	CoUninitialize();
	return msg.wParam;
}
开发者ID:andlabs,项目名称:misctestprogs,代码行数:45,代码来源:wind2dmingwtest.cpp

示例6: CreateWindowExW

// Function to create Combo Box as child of Custom Combo Box
wyBool
CCustomComboBox::CreateCtrls(HWND hwnd, LPARAM lParam)
{
    CREATESTRUCT    *ctst = (CREATESTRUCT *)lParam;
    wyInt32         ret = 0;
    DWORD           style = CBS_DROPDOWN | CBS_SORT | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP | WS_CHILD | WS_CLIPCHILDREN;
    HFONT           hfont = (HFONT)GetStockObject(DEFAULT_GUI_FONT);
    m_id            = (wyInt32)ctst->hMenu;
    m_hwndParent    = ctst->hwndParent;
    m_hwnd          = hwnd;

    if((ctst->style &  CBS_OWNERDRAWFIXED))
        style |=  CBS_OWNERDRAWFIXED;
    m_hwndCombo     = CreateWindowExW(NULL, WC_COMBOBOX, NULL, 
                                style, 
                                0, 0, ctst->cx,ctst->cy, 
                                hwnd, (HMENU)IDC_COMBOCUSTOM, GetModuleHandle(NULL), 0);
    
    if(m_hwndCombo == NULL)
        return wyFalse;

    SendMessage(m_hwndCombo, WM_SETFONT, (WPARAM)hfont, (LPARAM)TRUE);
    
    ShowWindow(m_hwndCombo, SW_SHOW);

    ret = GetComboBoxInfo(m_hwndCombo, &m_cbif);

    m_editRect.bottom   = m_cbif.rcItem.bottom;
    m_editRect.right    = m_cbif.rcItem.right;
    m_editRect.left     = m_cbif.rcItem.left;
    m_editRect.top      = m_cbif.rcItem.top;
    
    if(ctst->style & WS_DISABLED)
    {
        SendMessage(hwnd, WM_ENABLE, FALSE, NULL);
    }

    SetWindowLongPtr(m_hwndCombo, GWLP_USERDATA, (LONG_PTR) this);
    m_origComboCtrlProc = (WNDPROC)SetWindowLongPtr(m_hwndCombo, GWLP_WNDPROC, (LONG_PTR) CCustomComboBox::ComboCtrlProc);
    
    SetWindowLongPtr(m_cbif.hwndItem, GWLP_USERDATA, (LONG_PTR)this);
    m_origEditCtrlProc = (WNDPROC)SetWindowLongPtr(m_cbif.hwndItem, GWLP_WNDPROC, (LONG_PTR) CCustomComboBox::EditCtrlProc);

    return wyTrue;
}
开发者ID:AwkwardDev,项目名称:sqlyog-community,代码行数:46,代码来源:CCustomComboBox.cpp

示例7: RegisterShieldClass

static ATOM RegisterShieldClass()
{
    static ATOM atom = 0;

    if (!atom)
    {
        const WNDCLASSEX classex = {
            .cbSize        = sizeof(WNDCLASSEX),
            .style         = CS_NOCLOSE,
            .lpfnWndProc   = ShieldWndProc,
            .hInstance     = HINST_THISCOMPONENT,
            .hbrBackground = GetStockObject(WHITE_BRUSH),
            .lpszClassName = L"ClearshotShield",
        };

        atom = RegisterClassExW(&classex);
    }

    return atom;
}

static void ShootArea(int left, int top, int width, int height, uint8_t* buffer)
{
    HWND window = CreateWindowExW(
                      WS_EX_NOACTIVATE,
                      (wchar_t*)(intptr_t)RegisterShieldClass(),
                      L"Clearshot",
                      WS_DISABLED | WS_POPUP,
                      left, top, width, height,
                      NULL, NULL, HINST_THISCOMPONENT, buffer);

    if (!window)
        Fatal(L"Couldn't create window.");

    /* Move the shield underneath all other windows */
    SetWindowPos(window, HWND_BOTTOM, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_SHOWWINDOW | SWP_NOACTIVATE);

    /* Start the modal message loop */
    MSG msg;
    while (GetMessage(&msg, NULL, 0, 0))
    {
        TranslateMessage(&msg);
        DispatchMessage(&msg);
    }
}
开发者ID:rossy,项目名称:clearshot,代码行数:45,代码来源:clearshot.c

示例8: main

int main(int argc, char *argv[])
{
	HWND mainwin;
	MSG msg;
	INITCOMMONCONTROLSEX icc;

	ZeroMemory(&icc, sizeof (INITCOMMONCONTROLSEX));
	icc.dwSize = sizeof (INITCOMMONCONTROLSEX);
	icc.dwICC = ICC_LISTVIEW_CLASSES;
	if (InitCommonControlsEx(&icc) == 0)
		panic("(test program) error initializing comctl32.dll");
	initTable(NULL);
	mainwin = CreateWindowExW(0,
		tableWindowClass, L"Main Window",
		WS_OVERLAPPEDWINDOW | WS_HSCROLL | WS_VSCROLL,
		CW_USEDEFAULT, CW_USEDEFAULT,
		400, 400,
		NULL, NULL, GetModuleHandle(NULL), NULL);
	if (mainwin == NULL)
		panic("(test program) error creating Table");
	SendMessageW(mainwin, tableAddColumn, tableColumnText, (LPARAM) L"Column");
	SendMessageW(mainwin, tableAddColumn, tableColumnImage, (LPARAM) L"Column 2");
	SendMessageW(mainwin, tableAddColumn, tableColumnCheckbox, (LPARAM) L"Column 3");
	if (argc > 1) {
		NONCLIENTMETRICSW ncm;
		HFONT font;

		ZeroMemory(&ncm, sizeof (NONCLIENTMETRICSW));
		ncm.cbSize = sizeof (NONCLIENTMETRICSW);
		if (SystemParametersInfoW(SPI_GETNONCLIENTMETRICS, sizeof (NONCLIENTMETRICSW), &ncm, sizeof (NONCLIENTMETRICSW)) == 0)
			panic("(test program) error getting non-client metrics");
		font = CreateFontIndirectW(&ncm.lfMessageFont);
		if (font == NULL)
			panic("(test program) error creating lfMessageFont HFONT");
		SendMessageW(mainwin, WM_SETFONT, (WPARAM) font, TRUE);
	}
	ShowWindow(mainwin, SW_SHOWDEFAULT);
	if (UpdateWindow(mainwin) == 0)
		panic("(test program) error updating window");
	while (GetMessageW(&msg, NULL, 0, 0) > 0) {
		TranslateMessage(&msg);
		DispatchMessageW(&msg);
	}
	return 0;
}
开发者ID:tmaiaroto,项目名称:ui,代码行数:45,代码来源:main.c

示例9: create_tooltip

/*
 * Create a tooltip for the control passed as first parameter
 * duration sets the duration in ms. Use -1 for default
 * message is an UTF-8 string
 */
HWND create_tooltip(HWND hControl, char* message, int duration)
{
	TOOLINFOW toolInfo = {0};
	int i;

	if ( (hControl == NULL) || (message == NULL) ) {
		return (HWND)NULL;
	}

	// Find an empty slot
	for (i=0; i<MAX_TOOLTIPS; i++) {
		if (ttlist[i].hTip == NULL) break;
	}
	if (i == MAX_TOOLTIPS) {
		return (HWND)NULL; // No more space
	}

	// Create the tooltip window
	ttlist[i].hTip = CreateWindowExW(0, TOOLTIPS_CLASSW, NULL, WS_POPUP | TTS_NOPREFIX | TTS_ALWAYSTIP,
		CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, hMainDialog, NULL,
		main_instance, NULL);

	if (ttlist[i].hTip == NULL) {
		return (HWND)NULL;
	}

	// Subclass the tooltip to handle multiline
	ttlist[i].original_proc = (WNDPROC)SetWindowLongPtr(ttlist[i].hTip, GWLP_WNDPROC, (LONG_PTR)tooltip_callback);

	// Set the string to display (can be multiline)
	ttlist[i].wstring = utf8_to_wchar(message);

	// Set tooltip duration (ms)
	PostMessage(ttlist[i].hTip, TTM_SETDELAYTIME, (WPARAM)TTDT_AUTOPOP, (LPARAM)duration);

	// Associate the tooltip to the control
	toolInfo.cbSize = sizeof(toolInfo);
	toolInfo.hwnd = ttlist[i].hTip;	// Set to the tooltip itself to ease up subclassing
	toolInfo.uFlags = TTF_IDISHWND | TTF_SUBCLASS;
	toolInfo.uId = (UINT_PTR)hControl;
	toolInfo.lpszText = LPSTR_TEXTCALLBACKW;
	SendMessageW(ttlist[i].hTip, TTM_ADDTOOLW, 0, (LPARAM)&toolInfo);

	return ttlist[i].hTip;
}
开发者ID:pbatard,项目名称:libwdi,代码行数:50,代码来源:zadig_stdlg.c

示例10: CreateEditCtrl

bool CreateEditCtrl(EditCtrl *w) {
    // Note: has to remember this here because when I GetWindowStyle() later on,
    // WS_BORDER is not set, which is a mystery, because it is being drawn.
    // also, WS_BORDER seems to be painted in client areay
    w->hasBorder = bit::IsMaskSet<DWORD>(w->dwStyle, WS_BORDER);

    RECT rc = w->initialPos;
    w->hwnd = CreateWindowExW(w->dwExStyle, WC_EDIT, L"", w->dwStyle, rc.left, rc.top, RectDx(rc),
                              RectDy(rc), w->parent, nullptr, GetModuleHandleW(nullptr), nullptr);

    if (!w->hwnd) {
        return false;
    }
    SetFont(w, GetDefaultGuiFont());
    SetWindowSubclass(w->hwnd, EditProc, 0, (DWORD_PTR)w);
    SetWindowSubclass(GetParent(w->hwnd), EditParentProc, 0, (DWORD_PTR)w);
    return true;
}
开发者ID:kepazon,项目名称:my_sumatrapdf,代码行数:18,代码来源:EditCtrl.cpp

示例11: GetModuleHandleW

bool TreeCtrl::Create(const WCHAR* title) {
    if (!title) {
        title = L"";
    }

    RECT rc = this->initialPos;
    HMODULE hmod = GetModuleHandleW(nullptr);
    this->hwnd = CreateWindowExW(this->dwExStyle, WC_TREEVIEWW, title, this->dwStyle, rc.left, rc.top, RectDx(rc),
                                 RectDy(rc), this->parent, this->menu, hmod, nullptr);
    if (!this->hwnd) {
        return false;
    }
    TreeView_SetUnicodeFormat(this->hwnd, true);
    this->SetFont(GetDefaultGuiFont());
    Subclass(this);

    return true;
}
开发者ID:jingyu9575,项目名称:sumatrapdf,代码行数:18,代码来源:TreeCtrl.cpp

示例12: create_tooltips_window

static void create_tooltips_window(HTMLDocumentObj *This)
{
    tooltip_data *data = heap_alloc(sizeof(*data));

    This->tooltips_hwnd = CreateWindowExW(0, TOOLTIPS_CLASSW, NULL, TTS_NOPREFIX | WS_POPUP,
            CW_USEDEFAULT, CW_USEDEFAULT, 10, 10, This->hwnd, NULL, hInst, NULL);

    data->doc = This;
    data->proc = (WNDPROC)GetWindowLongPtrW(This->tooltips_hwnd, GWLP_WNDPROC);

    SetPropW(This->tooltips_hwnd, wszTooltipData, data);

    SetWindowLongPtrW(This->tooltips_hwnd, GWLP_WNDPROC, (LONG_PTR)tooltips_proc);

    SetWindowPos(This->tooltips_hwnd, HWND_TOPMOST,0, 0, 0, 0,
                 SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);

}
开发者ID:pstrealer,项目名称:wine,代码行数:18,代码来源:view.c

示例13: sizeof

	bool CWindowsApp::Init(wchar_t *windowName, int width, int height)
	{
		m_wndClassEx.cbSize = sizeof(WNDCLASSEX);
		m_wndClassEx.style = CS_CLASSDC;
		m_wndClassEx.lpfnWndProc = MsgProc;
		m_wndClassEx.cbClsExtra = 0L;
		m_wndClassEx.cbWndExtra = 0L;
		m_wndClassEx.hInstance = m_instanceHandle;
		m_wndClassEx.hIcon = nullptr;
		m_wndClassEx.hCursor = LoadCursor(nullptr, IDC_ARROW);
		m_wndClassEx.hbrBackground = nullptr;
		m_wndClassEx.lpszMenuName = nullptr;
		m_wndClassEx.lpszClassName = L"framework_9";
		m_wndClassEx.hIconSm = nullptr;
		//RegisterClassEx(&m_wndClassEx);
		RegisterClassExW(&m_wndClassEx);

		int screenX = GetSystemMetrics(SM_CXSCREEN);
		int screenY = GetSystemMetrics(SM_CYSCREEN);

		RECT windowRect;
		ZeroMemory(&windowRect, sizeof(windowRect));
		windowRect.left = (screenX - width) / 2;
		windowRect.top = (screenY - height) / 2;
		windowRect.right = windowRect.left + width;
		windowRect.bottom = windowRect.top + height;
		AdjustWindowRectEx(&windowRect, WindowStyle, 0, 0);

		//m_windowHandle = CreateWindowEx(
		m_windowHandle = CreateWindowExW(
			0L, m_wndClassEx.lpszClassName, windowName,
			WindowStyle,
			windowRect.left, windowRect.top, windowRect.right - windowRect.left, windowRect.bottom - windowRect.top,
			nullptr, nullptr, m_wndClassEx.hInstance, nullptr
			);

		m_width = width;
		m_height = height;

		if (!AllocDevice())
			return false;

		return true;
	}
开发者ID:Nickchooshin,项目名称:Framework_9,代码行数:44,代码来源:WindowsApp.cpp

示例14: sizeof

		DummyWindow::DummyWindow(HINSTANCE hinstance)
		{
			this->hinstance = hinstance;

			WCHAR classname[sizeof(DummyWindow*) * 2 + 1];
			win32::genClassNameStr(this, classname);

			WNDCLASSEXW klass;
			klass.cbSize = sizeof(WNDCLASSEXW);
			klass.style = CS_OWNDC;
			klass.lpfnWndProc = &wndproc;
			klass.cbClsExtra = 0;
			klass.cbWndExtra = 0;
			klass.hInstance = hinstance;
			klass.hIcon = 0;
			klass.hCursor = 0;
			klass.hbrBackground = 0;
			klass.lpszMenuName = 0;
			klass.lpszClassName = &classname[0];
			klass.hIconSm = 0;

			classatom = RegisterClassExW(&klass);
			if(!classatom)
				throw Exception("Can't register win32 window class: " + win32::getErrorMsg());

			hwnd = CreateWindowExW(
				0,
				&classname[0],
				L"",	// window title
				WS_POPUP | WS_DISABLED,
				CW_USEDEFAULT, CW_USEDEFAULT,
				100, 100, // width, height
				0,
				0,
				hinstance,
				0);

			if(!hwnd)
			{
				DWORD err = GetLastError();
				UnregisterClassW(&classname[0], hinstance);
				throw wm::Exception("Can't create Window: " + wm::win32::getErrorMsg(err));
			}
		}
开发者ID:cordarei,项目名称:libwm,代码行数:44,代码来源:dummywindow.cpp

示例15: createHelperWindow

// Creates a dummy window for behind-the-scenes work
//
static HWND createHelperWindow(void)
{
    MSG msg;
    HWND window = CreateWindowExW(WS_EX_OVERLAPPEDWINDOW,
                                  _GLFW_WNDCLASSNAME,
                                  L"GLFW message window",
                                  WS_CLIPSIBLINGS | WS_CLIPCHILDREN,
                                  0, 0, 1, 1,
                                  NULL, NULL,
                                  GetModuleHandleW(NULL),
                                  NULL);
    if (!window)
    {
        _glfwInputErrorWin32(GLFW_PLATFORM_ERROR,
                             "Win32: Failed to create helper window");
        return NULL;
    }

    // HACK: The command to the first ShowWindow call is ignored if the parent
    //       process passed along a STARTUPINFO, so clear that with a no-op call
    ShowWindow(window, SW_HIDE);

    // Register for HID device notifications
    {
        DEV_BROADCAST_DEVICEINTERFACE_W dbi;
        ZeroMemory(&dbi, sizeof(dbi));
        dbi.dbcc_size = sizeof(dbi);
        dbi.dbcc_devicetype = DBT_DEVTYP_DEVICEINTERFACE;
        dbi.dbcc_classguid = GUID_DEVINTERFACE_HID;

        _glfw.win32.deviceNotificationHandle =
            RegisterDeviceNotificationW(window,
                                        (DEV_BROADCAST_HDR*) &dbi,
                                        DEVICE_NOTIFY_WINDOW_HANDLE);
    }

    while (PeekMessageW(&msg, _glfw.win32.helperWindowHandle, 0, 0, PM_REMOVE))
    {
        TranslateMessage(&msg);
        DispatchMessageW(&msg);
    }

   return window;
}
开发者ID:Draghi,项目名称:glfw,代码行数:46,代码来源:win32_init.c


注:本文中的CreateWindowExW函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。