您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ CreateWindowEx函数代码示例

51自学网 2021-06-01 20:15:25
  C++
这篇教程C++ CreateWindowEx函数代码示例写得很实用,希望能帮到您。

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

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

示例1: Game_Genie_Window_CreateChildWindows

void Game_Genie_Window_CreateChildWindows(HWND hWnd){	// Description labels.	HWND lblInfoTitle, lblInfo;		// Strings	const char* strInfoTitle = "Information about Game Genie / Patch codes";	const char* strInfo =			"Both Game Genie codes and Patch codes are supported./n"			"Check the box next to the code to activate it./n"			"Syntax for Game Genie codes: XXXX-YYYY/n"			"Syntax for Patch codes: AAAAAA-DDDD (address-data)";		// Info Title	lblInfoTitle = CreateWindow(WC_STATIC, strInfoTitle,				    WS_CHILD | WS_VISIBLE | SS_LEFT,				    8, 8, 256, 16, hWnd, NULL, ghInstance, NULL);	SetWindowFont(lblInfoTitle, fntTitle, TRUE);		// Info	lblInfo = CreateWindow(WC_STATIC, strInfo,			       WS_CHILD | WS_VISIBLE | SS_LEFT,			       8, 24, wndWidth-16, 68, hWnd, NULL, ghInstance, NULL);	SetWindowFont(lblInfo, fntMain, TRUE);		// Code and Name boxes, plus "Add Code" button.	HWND lblCode, btnAddCode;	HWND lblName;		// Code label	lblCode = CreateWindow(WC_STATIC, "Code",			       WS_CHILD | WS_VISIBLE | SS_LEFT,			       8, 24+68+8, 32, 16, hWnd, NULL, ghInstance, NULL);	SetWindowFont(lblCode, fntMain, TRUE);		// Code entry	gg_txtCode = CreateWindowEx(WS_EX_CLIENTEDGE, WC_EDIT, NULL,				    WS_CHILD | WS_VISIBLE | WS_TABSTOP | SS_LEFT | ES_AUTOHSCROLL,				    8+32+8, 24+68+8, wndWidth - (8+32+8+64+8+8+16), 20,				    hWnd, NULL, ghInstance, NULL);	SetWindowFont(gg_txtCode, fntMain, TRUE);	gg_txtCode_oldProc = (WNDPROC)SetWindowLongPtr(gg_txtCode, GWL_WNDPROC, (LONG_PTR)Game_Genie_TextBox_WndProc);		// Name label	lblName = CreateWindow(WC_STATIC, "Name",			       WS_CHILD | WS_VISIBLE | SS_LEFT,			       8, 24+68+8+24, 32, 16,			       hWnd, NULL, ghInstance, NULL);	SetWindowFont(lblName, fntMain, TRUE);		// Name entry	gg_txtName = CreateWindowEx(WS_EX_CLIENTEDGE, WC_EDIT, NULL,				    WS_CHILD | WS_VISIBLE | WS_TABSTOP | SS_LEFT | ES_AUTOHSCROLL,				    8+32+8, 24+68+8+24, wndWidth - (8+32+8+64+8+8+16), 20,				    hWnd, NULL, ghInstance, NULL);	SetWindowFont(gg_txtName, fntMain, TRUE);	gg_txtName_oldProc = (WNDPROC)SetWindowLongPtr(gg_txtName, GWL_WNDPROC, (LONG_PTR)Game_Genie_TextBox_WndProc);		// Add Code	btnAddCode = CreateWindow(WC_BUTTON, "&Add Code",				  WS_CHILD | WS_VISIBLE | WS_TABSTOP,				  wndWidth - (64+8+16), 24+68+8, 63+16, 20,				  hWnd, IDC_BTN_ADD, ghInstance, NULL);	SetWindowFont(btnAddCode, fntMain, TRUE);		// ListView	gg_lstvCodes = CreateWindowEx(WS_EX_CLIENTEDGE, WC_LISTVIEW, "",				      WS_CHILD | WS_VISIBLE | WS_TABSTOP | LVS_REPORT,				      8, 24+68+8+24+24, wndWidth - (8+8), 128,				      hWnd, NULL, ghInstance, NULL);	SetWindowFont(gg_lstvCodes, fntMain, TRUE);	SendMessage(gg_lstvCodes, LVM_SETEXTENDEDLISTVIEWSTYLE, 0, LVS_EX_CHECKBOXES | LVS_EX_FULLROWSELECT);		// Create the ListView columns.	LV_COLUMN lvCol;	memset(&lvCol, 0, sizeof(lvCol));	lvCol.mask = LVCF_TEXT | LVCF_WIDTH | LVCF_SUBITEM;		// Code	lvCol.pszText = "Code";	lvCol.cx = 128;	SendMessage(gg_lstvCodes, LVM_INSERTCOLUMN, 0, (LPARAM)&lvCol);		// Name	lvCol.pszText = "Name";	lvCol.cx = 256;	SendMessage(gg_lstvCodes, LVM_INSERTCOLUMN, 1, (LPARAM)&lvCol);		// Buttons	const int btnTop = 24+68+8+24+24+128+8;	HWND btnOK, btnApply, btnCancel, btnDeactivateAll, btnDelete;		btnOK = CreateWindow(WC_BUTTON, "&OK", WS_CHILD | WS_VISIBLE | WS_TABSTOP | BS_DEFPUSHBUTTON,			     8, btnTop, 75, 23,			     hWnd, (HMENU)IDC_BTN_OK, ghInstance, NULL);	SetWindowFont(btnOK, fntMain, TRUE);		btnApply = CreateWindow(WC_BUTTON, "&Apply", WS_CHILD | WS_VISIBLE | WS_TABSTOP,				8+75+8, btnTop, 75, 23,				hWnd, (HMENU)IDC_BTN_APPLY, ghInstance, NULL);//.........这里部分代码省略.........
开发者ID:chipsoftwaretester,项目名称:OpenEmu,代码行数:101,


示例2: _WinMain

DWORD WINAPI _WinMain(LPVOID lpParam) {     HWND hwnd;     MSG messages;     WNDCLASSEX wincl; /*    wincl.hInstance = hInstance;     wincl.lpszClassName = szClassName;     wincl.lpfnWndProc = WindowProcedure;     wincl.style = CS_DBLCLKS;     wincl.cbSize = sizeof (WNDCLASSEX);     wincl.hbrBackground = (HBRUSH) COLOR_BACKGROUND; 	MessageBox(NULL,"AA","AA",MB_OK); */		wincl.cbSize = sizeof(wincl);          // size of structure     wincl.style = CS_HREDRAW |         CS_VREDRAW;                    // redraw if size changes     wincl.lpfnWndProc = WndProc;     // points to window procedure     wincl.cbClsExtra = 0;                // no extra class memory     wincl.cbWndExtra = 0;                // no extra window memory     wincl.hInstance = _hinst;         // handle to instance     wincl.hIcon = LoadIcon(NULL,         IDI_APPLICATION);              // predefined app. icon     wincl.hCursor = LoadCursor(NULL,         IDC_ARROW);                    // predefined arrow     wincl.hbrBackground     = (HBRUSH) GetStockObject (WHITE_BRUSH) ;  //  wincl.hbrBackground = (HBRUSH) COLOR_BACKGROUND;             // white background brush     wincl.lpszMenuName =  "MainMenu";    // name of menu resource     wincl.lpszClassName = "MainWClass";  // name of window class 	wincl.hIconSm = NULL; char	buf[100];//sprintf(buf,"%d",_hinst);//	MessageBox(NULL,buf,"11",MB_OK);     if (!RegisterClassEx (&wincl))         return 0;     hwnd = CreateWindowEx (           0,           szClassName,        /* Classname */           "MainWClass",      /* Title Text */           WS_OVERLAPPEDWINDOW, /* default window */ //          CW_USEDEFAULT,      /* Windows decides the position */  //         CW_USEDEFAULT,      /* where the window ends up on the screen */  0, 0,          640,                /* The programs width */           400,                /* and height in pixels */           HWND_DESKTOP,        /* The window is a child-window to desktop */           NULL,                /* No menu */           _hinst,      /* Program Instance handler */           NULL                /* No Window Creation data */           ); 	if(!hwnd)	{			long lError;		   lError   =   ::GetLastError(); 			sprintf(buf,"%d, %d",hwnd,lError);			MessageBox(NULL,buf,"22",MB_OK); 			return 0;	}	_hwnd=hwnd;    /* Make the window visible on the screen */     ShowWindow (hwnd, SW_SHOWNORMAL);     UpdateWindow(hwnd);     /* Run the message loop. It will run until GetMessage() returns 0 */     while (GetMessage (&messages, NULL, 0, 0))     {         /* Translate virtual-key messages into character messages */         TranslateMessage(&messages);         /* Send message to WindowProcedure */         DispatchMessage(&messages);     }     /* The program return-value is 0 - The value that PostQuitMessage() gave */     return messages.wParam; } 
开发者ID:roybai,项目名称:poe,代码行数:80,


示例3: wf_post_connect

boolean wf_post_connect(freerdp* instance){	rdpGdi* gdi;	wfInfo* wfi;	rdpCache* cache;	wfContext* context;	int width, height;	wchar_t win_title[64];	rdpSettings* settings;	settings = instance->settings;	context = (wfContext*) instance->context;	cache = instance->context->cache;	wfi = context->wfi;	wfi->dstBpp = 32;	width = settings->width;	height = settings->height;	if (wfi->sw_gdi)	{		gdi_init(instance, CLRCONV_ALPHA | CLRBUF_32BPP, NULL);		gdi = instance->context->gdi;		wfi->hdc = gdi->primary->hdc;		wfi->primary = wf_image_new(wfi, width, height, wfi->dstBpp, gdi->primary_buffer);	}	else	{		wf_gdi_register_update_callbacks(instance->update);		wfi->srcBpp = instance->settings->color_depth;		wfi->primary = wf_image_new(wfi, width, height, wfi->dstBpp, NULL);		wfi->hdc = gdi_GetDC();		wfi->hdc->bitsPerPixel = wfi->dstBpp;		wfi->hdc->bytesPerPixel = wfi->dstBpp / 8;		wfi->hdc->alpha = wfi->clrconv->alpha;		wfi->hdc->invert = wfi->clrconv->invert;		wfi->hdc->hwnd = (HGDI_WND) malloc(sizeof(GDI_WND));		wfi->hdc->hwnd->invalid = gdi_CreateRectRgn(0, 0, 0, 0);		wfi->hdc->hwnd->invalid->null = 1;		wfi->hdc->hwnd->count = 32;		wfi->hdc->hwnd->cinvalid = (HGDI_RGN) malloc(sizeof(GDI_RGN) * wfi->hdc->hwnd->count);		wfi->hdc->hwnd->ninvalid = 0;	}	if (strlen(wfi->window_title) > 0)		_snwprintf(win_title, sizeof(win_title), L"%S", wfi->window_title);	else if (settings->port == 3389)		_snwprintf(win_title, sizeof(win_title) / sizeof(win_title[0]), L"%S - FreeRDP", settings->hostname);	else		_snwprintf(win_title, sizeof(win_title) / sizeof(win_title[0]), L"%S:%d - FreeRDP", settings->hostname, settings->port);	if (wfi->hwnd == 0)	{		wfi->hwnd = CreateWindowEx((DWORD) NULL, g_wnd_class_name, win_title,				0, 0, 0, 0, 0, NULL, NULL, g_hInstance, NULL);		SetWindowLongPtr(wfi->hwnd, GWLP_USERDATA, (LONG_PTR) wfi);	}	if (wfi->fullscreen)	{		SetWindowLongPtr(wfi->hwnd, GWL_STYLE, WS_POPUP);		SetWindowPos(wfi->hwnd, HWND_TOP, 0, 0, width, height, SWP_FRAMECHANGED);	}	else	{		POINT diff;		RECT rc_client, rc_wnd;		SetWindowLongPtr(wfi->hwnd, GWL_STYLE, WS_CAPTION | WS_OVERLAPPED | WS_SYSMENU | WS_MINIMIZEBOX);		/* Now resize to get full canvas size and room for caption and borders */		SetWindowPos(wfi->hwnd, HWND_TOP, 10, 10, width, height, SWP_FRAMECHANGED);		GetClientRect(wfi->hwnd, &rc_client);		GetWindowRect(wfi->hwnd, &rc_wnd);		diff.x = (rc_wnd.right - rc_wnd.left) - rc_client.right;		diff.y = (rc_wnd.bottom - rc_wnd.top) - rc_client.bottom;		SetWindowPos(wfi->hwnd, HWND_TOP, -1, -1, width + diff.x, height + diff.y, SWP_NOMOVE | SWP_FRAMECHANGED);	}	BitBlt(wfi->primary->hdc, 0, 0, width, height, NULL, 0, 0, BLACKNESS);	wfi->drawing = wfi->primary;	ShowWindow(wfi->hwnd, SW_SHOWNORMAL);	UpdateWindow(wfi->hwnd);	if (wfi->sw_gdi)	{		instance->update->BeginPaint = wf_sw_begin_paint;		instance->update->EndPaint = wf_sw_end_paint;	}	else	{		instance->update->BeginPaint = wf_hw_begin_paint;		instance->update->EndPaint = wf_hw_end_paint;	}//.........这里部分代码省略.........
开发者ID:zzzhou,项目名称:FreeRDP,代码行数:101,


示例4: m_bFullScreen

/*	This Code Creates Our OpenGL Window.  Parameters Are: *	lpszTitle		- Title to Appear at the Top of the Window *	hWndParent		- Parent HWND where the screne will be drawn *	nZBuffer		- Number of Bits to Use for Z-Buffer (16/32) */bool CGL::Create(char* lpszTitle, HWND hWndParent, int nZBuffer=16) : m_bFullScreen(false){	GLuint		PixelFormat;							// Holds The Results After Searching For A Match	WNDCLASS	wc;										// Windows Class Structure	DWORD		dwExStyle;								// Window Extended Style	DWORD		dwStyle;								// Window Style	RECT		rectWindow;								// Grabs Rectangle Upper Left / Lower Right Values	int			nWidth,				nHeight;	// Get window size	GetClientRect(hWndParent, &rectWindow);	nWidth  = rectWindow.right-rectWindow.left;	nHeight = rectWindow.bottom-rectWindow.top;	m_hInstance			= GetModuleHandle(NULL);		// Grab An Instance For Our Window	wc.style			= CS_HREDRAW | CS_VREDRAW | CS_OWNDC; // Redraw On Size, And Own DC For Window.	wc.lpfnWndProc		= (WNDPROC) WndProc;			// WndProc Handles Messages	wc.cbClsExtra		= 0;							// No Extra Window Data	wc.cbWndExtra		= 0;							// No Extra Window Data	wc.hInstance		= m_hInstance;					// Set The Instance	wc.hIcon			= LoadIcon(NULL, IDI_WINLOGO);	// Load The Default Icon	wc.hCursor			= LoadCursor(NULL, IDC_ARROW);	// Load The Arrow Pointer	wc.hbrBackground	= NULL;							// No Background Required For GL	wc.lpszMenuName		= NULL;							// We Don't Want A Menu	wc.lpszClassName	= "OpenGL";						// Set The Class Name	if (!RegisterClass(&wc))							// Attempt To Register The Window Class	{		MessageBox(m_hWnd,"Failed To Register The Window Class.","ERROR",MB_OK|MB_ICONEXCLAMATION);		return false;									// Return false	}		dwExStyle = WS_EX_APPWINDOW;						// Window Extended Style	//dwStyle = WS_OVERLAPPEDWINDOW;					// Windows Style	dwStyle = WS_DISABLED | WS_VISIBLE | WS_CHILD;		// Windows Style	AdjustWindowRectEx(&rectWindow, dwStyle, false, dwExStyle);		// Adjust Window To true Requested Size	// Create The Window	if (!(m_hWnd=CreateWindowEx(dwExStyle,				// Extended Style For The Window								"OpenGL",				// Class Name								lpszTitle,				// Window Title								dwStyle |				// Defined Window Style								WS_CLIPSIBLINGS |		// Required Window Style								WS_CLIPCHILDREN,		// Required Window Style								0, 0,					// Window Position								WindowRect.right-WindowRect.left,	// Calculate Window Width								WindowRect.bottom-WindowRect.top,	// Calculate Window Height								NULL,					// No Parent Window								NULL,					// No Menu								m_hInstance,			// Instance								NULL)))					// Dont Pass Anything To WM_CREATE	{		KillGLWindow();									// Reset The Display		MessageBox(m_hWnd,"Window Creation Error.","ERROR",MB_OK|MB_ICONEXCLAMATION);		return false;									// Return false	}	static	PIXELFORMATDESCRIPTOR pfd =					// pfd Tells Windows How We Want Things To Be	{		sizeof(PIXELFORMATDESCRIPTOR),					// Size Of This Pixel Format Descriptor		1,												// Version Number		PFD_DRAW_TO_WINDOW |							// Format Must Support Window		PFD_SUPPORT_OPENGL |							// Format Must Support OpenGL		PFD_DOUBLEBUFFER,								// Must Support Double Buffering		PFD_TYPE_RGBA,									// Request An RGBA Format		nBits,											// Select Our Color Depth		0, 0, 0, 0, 0, 0,								// Color Bits Ignored		0,												// No Alpha Buffer		0,												// Shift Bit Ignored		0,												// No Accumulation Buffer		0, 0, 0, 0,										// Accumulation Bits Ignored		nZBuffer,										// 16/32Bit Z-Buffer (Depth Buffer)  		0,												// No Stencil Buffer		0,												// No Auxiliary Buffer		PFD_MAIN_PLANE,									// Main Drawing Layer		0,												// Reserved		0, 0, 0											// Layer Masks Ignored	};		if (!(m_hDC=GetDC(m_hWnd)))							// Did We Get A Device Context?	{		KillGLWindow();									// Reset The Display		MessageBox(m_hWnd,"Can't Create A GL Device Context.","ERROR",MB_OK|MB_ICONEXCLAMATION);		return false;									// Return false	}	if (!(PixelFormat=ChoosePixelFormat(m_hDC,&pfd)))	// Did Windows Find A Matching Pixel Format?	{		KillGLWindow();									// Reset The Display		MessageBox(m_hWnd,"Can't Find A Suitable PixelFormat.","ERROR",MB_OK|MB_ICONEXCLAMATION);		return false;									// Return false	}//.........这里部分代码省略.........
开发者ID:wernight,项目名称:cuckoo,代码行数:101,


示例5: WndProc

LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam){	PAINTSTRUCT ps;	HDC hdc;	RECT rect;	COLORREF colorText = RGB(0, 0, 255); // задаём цвет текста		switch (message)	{	case WM_COMMAND:	case BN_CLICKED:		if (LOWORD(wParam) == ID_BUTTON1)		{						GetClientRect(hWnd, &rect);			edit1 = CreateWindowEx(				WS_EX_CLIENTEDGE,				L"edit",				L"Нажмите правую клавишу мыши",				WS_CHILD | WS_VISIBLE | EM_FMTLINES,				rect.right / 4,									/*координаты по X*/				rect.bottom / 4,								/*координаты по Y*/				rect.right / 2,									/*Ширина окошка*/				rect.bottom / 2,				hWnd,				(HMENU)ID_EDIT1,				hinst,				NULL);				}				break;	case WM_RBUTTONDOWN:						ShowWindow(edit1, SW_HIDE);			break;	case WM_CREATE:		GetClientRect(hWnd, &rect);						button1 = CreateWindowEx(			WS_EX_CLIENTEDGE,			L"button",			L"Показать",			WS_CHILD | WS_VISIBLE,			rect.right / 2 - ARRAYSIZE(L"Показать") * 4 - 10,		/*координаты по X*/			rect.bottom - 30,						/*координаты по Y*/			ARRAYSIZE(L"Показать") * 10,						/*Ширина окошка*/			25,			hWnd,			(HMENU)ID_BUTTON1,			hinst,			NULL);				break;	case WM_PAINT:		hdc = BeginPaint(hWnd, &ps); // инициализируем контекст устройства		GetClientRect(hWnd, &rect); // получаем ширину и высоту области для рисования		SetTextColor(hdc, colorText); // устанавливаем цвет контекстного устройства								DrawText(hdc, L"В в е д и т е   т е к с т", -1, &rect, DT_SINGLELINE | DT_CENTER); // рисуем текст					break;	case WM_DESTROY:		PostQuitMessage(0);		break;	default:		return DefWindowProc(hWnd, message, wParam, lParam);		break;	}	return 0;}
开发者ID:andrevyakin,项目名称:DZ_05.04.15_3_WinAPI,代码行数:82,


示例6: switch

INT_PTR SettingsVideo::ProcMessage(UINT message, WPARAM wParam, LPARAM lParam){    HWND hwndTemp;    switch(message)    {        case WM_INITDIALOG:            {                LocalizeWindow(hwnd);                //--------------------------------------------                HWND hwndToolTip = CreateWindowEx(NULL, TOOLTIPS_CLASS, NULL, WS_POPUP|TTS_NOPREFIX|TTS_ALWAYSTIP,                    CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,                    hwnd, NULL, hinstMain, NULL);                TOOLINFO ti;                zero(&ti, sizeof(ti));                ti.cbSize = sizeof(ti);                ti.uFlags = TTF_SUBCLASS|TTF_IDISHWND;                ti.hwnd = hwnd;                SendMessage(hwndToolTip, TTM_SETMAXTIPWIDTH, 0, 500);                SendMessage(hwndToolTip, TTM_SETDELAYTIME, TTDT_AUTOPOP, 8000);                //--------------------------------------------                hwndTemp = GetDlgItem(hwnd, IDC_MONITOR);                App->monitors.Clear();                EnumDisplayMonitors(NULL, NULL, (MONITORENUMPROC)MonitorInfoEnumProc, (LPARAM)&App->monitors);                for(UINT i=0; i<App->monitors.Num(); i++)                    SendMessage(hwndTemp, CB_ADDSTRING, 0, (LPARAM)IntString(i+1).Array());                int monitorID = LoadSettingComboInt(hwndTemp, TEXT("Video"), TEXT("Monitor"), 0, App->monitors.Num()-1);                if(monitorID > (int)App->monitors.Num())                    monitorID = 0;                //--------------------------------------------                SendMessage(GetDlgItem(hwnd, IDC_USECUSTOM), BM_SETCHECK, BST_CHECKED, 0);                EnableWindow(GetDlgItem(hwnd, IDC_MONITOR), FALSE);                //--------------------------------------------                int cx, cy;                if(!AppConfig->HasKey(TEXT("Video"), TEXT("BaseWidth")) || !AppConfig->HasKey(TEXT("Video"), TEXT("BaseHeight")))                {                    cx = App->monitors[monitorID].rect.right  - App->monitors[monitorID].rect.left;                    cy = App->monitors[monitorID].rect.bottom - App->monitors[monitorID].rect.top;                    AppConfig->SetInt(TEXT("Video"), TEXT("BaseWidth"),  cx);                    AppConfig->SetInt(TEXT("Video"), TEXT("BaseHeight"), cy);                }                else                {                    cx = AppConfig->GetInt(TEXT("Video"), TEXT("BaseWidth"));                    cy = AppConfig->GetInt(TEXT("Video"), TEXT("BaseHeight"));                    if(cx < 128)        cx = 128;                    else if(cx > 4096)  cx = 4096;                    if(cy < 128)        cy = 128;                    else if(cy > 4096)  cy = 4096;                }                hwndTemp = GetDlgItem(hwnd, IDC_SIZEX);                editProc = (FARPROC)GetWindowLongPtr(hwndTemp, GWLP_WNDPROC);                SetWindowLongPtr(hwndTemp, GWLP_WNDPROC, (LONG_PTR)ResolutionEditSubclassProc);                SetWindowText(hwndTemp, IntString(cx).Array());                hwndTemp = GetDlgItem(hwnd, IDC_SIZEY);                SetWindowLongPtr(hwndTemp, GWLP_WNDPROC, (LONG_PTR)ResolutionEditSubclassProc);                SetWindowText(hwndTemp, IntString(cy).Array());                //--------------------------------------------                hwndTemp = GetDlgItem(hwnd, IDC_DISABLEAERO);                if(OSGetVersion() == 8)                    EnableWindow(hwndTemp, FALSE);                BOOL bDisableAero = AppConfig->GetInt(TEXT("Video"), TEXT("DisableAero"), 0);                SendMessage(hwndTemp, BM_SETCHECK, bDisableAero ? BST_CHECKED : 0, 0);                ti.lpszText = (LPWSTR)Str("Settings.Video.DisableAeroTooltip");                ti.uId = (UINT_PTR)hwndTemp;                SendMessage(hwndToolTip, TTM_ADDTOOL, 0, (LPARAM)&ti);                //--------------------------------------------                BOOL bUnlockFPS = AppConfig->GetInt(TEXT("Video"), TEXT("UnlockFPS"));                int topFPS = bUnlockFPS ? 120 : 60;                hwndTemp = GetDlgItem(hwnd, IDC_FPS);                SendMessage(hwndTemp, UDM_SETRANGE32, 10, topFPS);                int fps = AppConfig->GetInt(TEXT("Video"), TEXT("FPS"), 30);                if(!AppConfig->HasKey(TEXT("Video"), TEXT("FPS")))                {//.........这里部分代码省略.........
开发者ID:magicpriest,项目名称:OBS,代码行数:101,


示例7: WinMain

INT WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow){	char const * class_name = "Pong";	char const * window_title = "Adolf Hitler Pong";	WNDCLASSEX window_class;	window_class.cbSize = sizeof(window_class);	window_class.style = CS_OWNDC | CS_VREDRAW | CS_HREDRAW;	window_class.lpfnWndProc = &window_procedure;	window_class.cbClsExtra = 0;	window_class.cbWndExtra = 0;	window_class.hInstance = hInstance;	window_class.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_HITLER));	window_class.hCursor = LoadCursor(0, IDC_ARROW);	window_class.hbrBackground = reinterpret_cast<HBRUSH>(GetStockObject(WHITE_BRUSH));	window_class.lpszMenuName = 0;	window_class.lpszClassName = class_name;	window_class.hIconSm = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_HITLER));	RegisterClassEx(&window_class);	HWND window_handle = CreateWindowEx(0, class_name, window_title, WS_POPUP | WS_VISIBLE, CW_USEDEFAULT, CW_USEDEFAULT, window_width, window_height, 0, 0, hInstance, 0);	//SetTimer(window_handle, 0, 1000 / fps, 0);	std::string arguments(lpCmdLine);	if(!arguments.empty())	{		if(arguments[0] == '"' && arguments.length() >= 2)		{			arguments.erase(arguments.begin());			arguments.erase(arguments.end() - 1);		}		bool success = game.load_demo(arguments);		if(!success)		{			MessageBox(window_handle, "Unable to load demo file", "Demo playback error", MB_OK | MB_ICONERROR);			SendMessage(window_handle, WM_DESTROY, 0, 0);			return 0;		}	}	else		game.start_game();	nil::ini ini;	if(ini.load("pong.ini"))	{		game.set_demo_level_limit(ini.number<unsigned>("demo_level_limit", 3));		SetThreadPriority(GetCurrentThread(), ini.number<int>("thread_priority", 0));	}	LARGE_INTEGER frequency_struct;	QueryPerformanceFrequency(&frequency_struct);	unsigned long long divisor = frequency_struct.QuadPart / fps;	unsigned long long last_state = 0ull;	while(run)	{		MSG message;		while(PeekMessage(&message, window_handle, 0, 0, PM_REMOVE))		{			TranslateMessage(&message);			DispatchMessage(&message);		}		LARGE_INTEGER counter;		QueryPerformanceCounter(&counter);		unsigned long long current_state = counter.QuadPart / divisor;		if(last_state < current_state)		{			game.invalidate(window_handle);			game.process_frame(window_handle);			last_state = current_state;		}		//Sleep(20);	}	return 0;}
开发者ID:epicvrvs,项目名称:pong,代码行数:76,


示例8: CreateWindowGL

BOOL CreateWindowGL (GL_Window* window)									// This Code Creates Our OpenGL Window{	DWORD windowStyle = WS_OVERLAPPEDWINDOW;							// Define Our Window Style	DWORD windowExtendedStyle = WS_EX_APPWINDOW;						// Define The Window's Extended Style	PIXELFORMATDESCRIPTOR pfd =											// pfd Tells Windows How We Want Things To Be	{		sizeof (PIXELFORMATDESCRIPTOR),									// Size Of This Pixel Format Descriptor		1,																// Version Number		PFD_DRAW_TO_WINDOW |											// Format Must Support Window		PFD_SUPPORT_OPENGL |											// Format Must Support OpenGL		PFD_DOUBLEBUFFER,												// Must Support Double Buffering		PFD_TYPE_RGBA,													// Request An RGBA Format		window->init.bitsPerPixel,										// Select Our Color Depth		0, 0, 0, 0, 0, 0,												// Color Bits Ignored		0,																// No Alpha Buffer		0,																// Shift Bit Ignored		0,																// No Accumulation Buffer		0, 0, 0, 0,														// Accumulation Bits Ignored		16,																// 16Bit Z-Buffer (Depth Buffer)  		0,																// No Stencil Buffer		0,																// No Auxiliary Buffer		PFD_MAIN_PLANE,													// Main Drawing Layer		0,																// Reserved		0, 0, 0															// Layer Masks Ignored	};	RECT windowRect = {0, 0, window->init.width, window->init.height};	// Define Our Window Coordinates	GLuint PixelFormat;													// Will Hold The Selected Pixel Format	if (window->init.isFullScreen == TRUE)								// Fullscreen Requested, Try Changing Video Modes	{		if (ChangeScreenResolution (window->init.width, window->init.height, window->init.bitsPerPixel) == FALSE)		{			// Fullscreen Mode Failed.  Run In Windowed Mode Instead			MessageBox (HWND_DESKTOP, "Mode Switch Failed./nRunning In Windowed Mode.", "Error", MB_OK | MB_ICONEXCLAMATION);			window->init.isFullScreen = FALSE;							// Set isFullscreen To False (Windowed Mode)		}		else															// Otherwise (If Fullscreen Mode Was Successful)		{			ShowCursor (FALSE);											// Turn Off The Cursor			windowStyle = WS_POPUP;										// Set The WindowStyle To WS_POPUP (Popup Window)			windowExtendedStyle |= WS_EX_TOPMOST;						// Set The Extended Window Style To WS_EX_TOPMOST		}																// (Top Window Covering Everything Else)	}	else																// If Fullscreen Was Not Selected	{		// Adjust Window, Account For Window Borders		AdjustWindowRectEx (&windowRect, windowStyle, 0, windowExtendedStyle);	}	// Create The OpenGL Window	window->hWnd = CreateWindowEx (windowExtendedStyle,					// Extended Style								   window->init.application->className,	// Class Name								   window->init.title,					// Window Title								   windowStyle,							// Window Style								   0, 0,								// Window X,Y Position								   windowRect.right - windowRect.left,	// Window Width								   windowRect.bottom - windowRect.top,	// Window Height								   HWND_DESKTOP,						// Desktop Is Window's Parent								   0,									// No Menu								   window->init.application->hInstance, // Pass The Window Instance								   window);	if (window->hWnd == 0)												// Was Window Creation A Success?	{		return FALSE;													// If Not Return False	}	window->hDC = GetDC (window->hWnd);									// Grab A Device Context For This Window	if (window->hDC == 0)												// Did We Get A Device Context?	{		// Failed		DestroyWindow (window->hWnd);									// Destroy The Window		window->hWnd = 0;												// Zero The Window Handle		return FALSE;													// Return False	}	PixelFormat = ChoosePixelFormat (window->hDC, &pfd);				// Find A Compatible Pixel Format	if (PixelFormat == 0)												// Did We Find A Compatible Format?	{		// Failed		ReleaseDC (window->hWnd, window->hDC);							// Release Our Device Context		window->hDC = 0;												// Zero The Device Context		DestroyWindow (window->hWnd);									// Destroy The Window		window->hWnd = 0;												// Zero The Window Handle		return FALSE;													// Return False	}	if (SetPixelFormat (window->hDC, PixelFormat, &pfd) == FALSE)		// Try To Set The Pixel Format	{		// Failed		ReleaseDC (window->hWnd, window->hDC);							// Release Our Device Context		window->hDC = 0;												// Zero The Device Context		DestroyWindow (window->hWnd);									// Destroy The Window		window->hWnd = 0;												// Zero The Window Handle		return FALSE;													// Return False	}//.........这里部分代码省略.........
开发者ID:alesko,项目名称:stereo_proj,代码行数:101,


示例9: GetModuleHandle

void SystemClass::InitializeWindows(int& screenWidth, int& screenHeight){	WNDCLASSEX wc;	DEVMODE dmScreenSettings;	int posX, posY;	// Get an external pointer to this object.		ApplicationHandle = this;	// Get the instance of this application.	m_hinstance = GetModuleHandle(NULL);	// Give the application a name.	m_applicationName = L"Engine";	// Setup the windows class with default settings.	wc.style         = CS_HREDRAW | CS_VREDRAW | CS_OWNDC;	wc.lpfnWndProc   = WndProc;	wc.cbClsExtra    = 0;	wc.cbWndExtra    = 0;	wc.hInstance     = m_hinstance;	wc.hIcon		 = LoadIcon(NULL, IDI_WINLOGO);	wc.hIconSm       = wc.hIcon;	wc.hCursor       = LoadCursor(NULL, IDC_ARROW);	wc.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH);	wc.lpszMenuName  = NULL;	wc.lpszClassName = m_applicationName;	wc.cbSize        = sizeof(WNDCLASSEX);		// Register the window class.	RegisterClassEx(&wc);	// Determine the resolution of the clients desktop screen.	screenWidth  = GetSystemMetrics(SM_CXSCREEN);	screenHeight = GetSystemMetrics(SM_CYSCREEN);	// Setup the screen settings depending on whether it is running in full screen or in windowed mode.	if(FULL_SCREEN)	{		// If full screen set the screen to maximum size of the users desktop and 32bit.		memset(&dmScreenSettings, 0, sizeof(dmScreenSettings));		dmScreenSettings.dmSize       = sizeof(dmScreenSettings);		dmScreenSettings.dmPelsWidth  = (unsigned long)screenWidth;		dmScreenSettings.dmPelsHeight = (unsigned long)screenHeight;		dmScreenSettings.dmBitsPerPel = 32;					dmScreenSettings.dmFields     = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT;		// Change the display settings to full screen.		ChangeDisplaySettings(&dmScreenSettings, CDS_FULLSCREEN);		// Set the position of the window to the top left corner.		posX = posY = 0;	}	else	{		// If windowed then set it to 800x600 resolution.		screenWidth  = 800;		screenHeight = 600;		// Place the window in the middle of the screen.		posX = (GetSystemMetrics(SM_CXSCREEN) - screenWidth)  / 2;		posY = (GetSystemMetrics(SM_CYSCREEN) - screenHeight) / 2;	}	// Create the window with the screen settings and get the handle to it.	m_hwnd = CreateWindowEx(WS_EX_APPWINDOW, m_applicationName, m_applicationName, 						    WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_POPUP,						    posX, posY, screenWidth, screenHeight, NULL, NULL, m_hinstance, NULL);	// Bring the window up on the screen and set it as main focus.	ShowWindow(m_hwnd, SW_SHOW);	SetForegroundWindow(m_hwnd);	SetFocus(m_hwnd);	// Hide the mouse cursor.	ShowCursor(false);	return;}
开发者ID:dagepzsir,项目名称:BirdEngine,代码行数:80,


示例10: memset

//************************************// Method:    CreateWindow// FullName:  QuackWin::CreateWindow// Access:    public // Returns:   bool// Qualifier:// Parameter: int width// Parameter: int height// Parameter: int colorBits//************************************bool QuackWin::B_CreateWindow(int width, int height, int colorBits) {	if (!classRegistered) {		WNDCLASS wc;		memset(&wc, 0, sizeof(wc));		wc.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC;		wc.lpfnWndProc = (WNDPROC)wndproc;		wc.cbClsExtra = 0;		wc.cbWndExtra = sizeof(void*)+sizeof(int);		wc.hInstance = GetModuleHandle(NULL);		//wc.hIcon = LoadIcon(hinstOpenGL, MAKEINTRESOURCE(IDI_ICON1));		wc.hCursor = LoadCursor(NULL, IDC_ARROW);		wc.hbrBackground = NULL;		wc.lpszMenuName = 0;		wc.lpszClassName = WINDOW_CLASS_NAME;		if (!RegisterClass(&wc)) {			// TODO: Add safe error here			// unable to register class		}		classRegistered = true;	}	// create HWND	if (!hWnd) {		hWnd = CreateWindowEx(			WS_EX_APPWINDOW | WS_EX_WINDOWEDGE,			WINDOW_CLASS_NAME,			"Quack",			WS_VISIBLE | WS_OVERLAPPEDWINDOW,			0,			0,			width,			height,			NULL,			NULL,			hinstOpenGL,			this			);		if (!hWnd) {			// error creating the window		}		ShowWindow(hWnd, SW_SHOW);		UpdateWindow(hWnd);	}	if (!(hDC = GetDC(hWnd))) {		ShowWindow(hWnd, SW_HIDE);		DestroyWindow(hWnd);		hWnd = NULL;		return false;	}	// Create OpenGL Context	if (!MakeContext()) {		ShowWindow(hWnd, SW_HIDE);		DestroyWindow(hWnd);		hWnd = NULL;		return false;	}	SetForegroundWindow(hWnd);	SetFocus(hWnd);	return true;}
开发者ID:orbv,项目名称:Quack,代码行数:80,


示例11: InitGLCapture

bool InitGLCapture(){    static HWND hwndOpenGLSetupWindow = NULL;    bool bSuccess = false;    if(!hwndOpenGLSetupWindow)    {        WNDCLASSEX windowClass;        ZeroMemory(&windowClass, sizeof(windowClass));        windowClass.cbSize = sizeof(windowClass);        windowClass.style = CS_OWNDC;        windowClass.lpfnWndProc = DefWindowProc;        windowClass.lpszClassName = TEXT("OBSOGLHookClass");        windowClass.hInstance = hinstMain;        if(RegisterClassEx(&windowClass))        {            hwndOpenGLSetupWindow = CreateWindowEx (0,                TEXT("OBSOGLHookClass"),                TEXT("OBS OpenGL Context Window"),                WS_POPUP | WS_CLIPCHILDREN | WS_CLIPSIBLINGS,                0, 0,                1, 1,                NULL,                NULL,                hinstMain,                NULL                );        }    }    HMODULE hGL = GetModuleHandle(TEXT("opengl32.dll"));    if(hGL && hwndOpenGLSetupWindow)    {        pglReadBuffer       = (GLREADBUFFERPROC)        GetProcAddress(hGL, "glReadBuffer");        pglReadPixels       = (GLREADPIXELSPROC)        GetProcAddress(hGL, "glReadPixels");        pglGetError         = (GLGETERRORPROC)          GetProcAddress(hGL, "glGetError");        pwglSwapLayerBuffers= (WGLSWAPLAYERBUFFERSPROC) GetProcAddress(hGL, "wglSwapLayerBuffers");        pwglSwapBuffers=      (WGLSWAPBUFFERSPROC)      GetProcAddress(hGL, "wglSwapBuffers");        pwglDeleteContext   = (WGLDELETECONTEXTPROC)    GetProcAddress(hGL, "wglDeleteContext");        pwglGetProcAddress  = (WGLGETPROCADDRESSPROC)   GetProcAddress(hGL, "wglGetProcAddress");        pwglMakeCurrent     = (WGLMAKECURRENTPROC)      GetProcAddress(hGL, "wglMakeCurrent");        pwglCreateContext   = (WGLCREATECONTEXTPROC)    GetProcAddress(hGL, "wglCreateContext");        if( !pglReadBuffer || !pglReadPixels || !pglGetError || !pwglSwapLayerBuffers || !pwglSwapBuffers ||            !pwglDeleteContext || !pwglGetProcAddress || !pwglMakeCurrent || !pwglCreateContext)        {            return false;        }        HDC hDC = GetDC(hwndOpenGLSetupWindow);        if(hDC)        {            PIXELFORMATDESCRIPTOR pfd;            ZeroMemory(&pfd, sizeof(pfd));            pfd.nSize = sizeof(pfd);            pfd.nVersion = 1;            pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER | PFD_GENERIC_ACCELERATED;            pfd.iPixelType = PFD_TYPE_RGBA;            pfd.cColorBits = 32;            pfd.cDepthBits = 32;            pfd.cAccumBits = 32;            pfd.iLayerType = PFD_MAIN_PLANE;            SetPixelFormat(hDC, ChoosePixelFormat(hDC, &pfd), &pfd);            HGLRC hGlrc = jimglCreateContext(hDC);            if(hGlrc)            {                jimglMakeCurrent(hDC, hGlrc);                pglBufferData       = (GLBUFFERDATAARBPROC)     jimglGetProcAddress("glBufferData");                pglDeleteBuffers    = (GLDELETEBUFFERSARBPROC)  jimglGetProcAddress("glDeleteBuffers");                pglGenBuffers       = (GLGENBUFFERSARBPROC)     jimglGetProcAddress("glGenBuffers");                pglMapBuffer        = (GLMAPBUFFERPROC)         jimglGetProcAddress("glMapBuffer");                pglUnmapBuffer      = (GLUNMAPBUFFERPROC)       jimglGetProcAddress("glUnmapBuffer");                pglBindBuffer       = (GLBINDBUFFERPROC)        jimglGetProcAddress("glBindBuffer");                UINT lastErr = GetLastError();                if(pglBufferData && pglDeleteBuffers && pglGenBuffers && pglMapBuffer && pglUnmapBuffer && pglBindBuffer)                {                    glHookSwapBuffers.Hook((FARPROC)SwapBuffers, (FARPROC)SwapBuffersHook);                    glHookSwapLayerBuffers.Hook((FARPROC)jimglSwapLayerBuffers, (FARPROC)wglSwapLayerBuffersHook);                    glHookwglSwapBuffers.Hook((FARPROC)jimglSwapBuffers, (FARPROC)wglSwapBuffersHook);                    glHookDeleteContext.Hook((FARPROC)jimglDeleteContext, (FARPROC)wglDeleteContextHook);                    bSuccess = true;                }                jimglMakeCurrent(NULL, NULL);                jimglDeleteContext(hGlrc);                ReleaseDC(hwndOpenGLSetupWindow, hDC);                if(bSuccess)                {                    glHookSwapBuffers.Rehook();                    glHookSwapLayerBuffers.Rehook();//.........这里部分代码省略.........
开发者ID:AaronMike,项目名称:OBS,代码行数:101,


示例12: khm_create_standard_toolbar

void khm_create_standard_toolbar(HWND rebar) {    HWND hwtb;    SIZE sz;    HBITMAP hbm_blank;    HIMAGELIST hiList;    REBARBANDINFO rbi;    khui_menu_def * def;    khui_action * act;    khui_action_ref * aref;    int idx_blank;    def = khui_find_menu(KHUI_TOOLBAR_STANDARD);    if (!def) {#ifdef DEBUG        assert(FALSE);#endif        return;    }    hwtb = CreateWindowEx(0 ,                          TOOLBARCLASSNAME,                          (LPWSTR) NULL,                          WS_CHILD |                          TBSTYLE_FLAT |                          TBSTYLE_AUTOSIZE |                          TBSTYLE_TOOLTIPS |                          CCS_NORESIZE |                          CCS_NOPARENTALIGN |                          CCS_ADJUSTABLE |                          CCS_NODIVIDER,                          0, 0, 0, 0, rebar,                          (HMENU) NULL, khm_hInstance,                          NULL);    if(!hwtb) {#ifdef DEBUG        assert(FALSE);#endif        return;    }#if (_WIN32_IE >= 0x0501)    SendMessage(hwtb, TB_SETEXTENDEDSTYLE, 0,                TBSTYLE_EX_MIXEDBUTTONS | TBSTYLE_EX_DRAWDDARROWS);#endif    hiList = ImageList_Create(        KHUI_TOOLBAR_IMAGE_WIDTH,        KHUI_TOOLBAR_IMAGE_HEIGHT,        ILC_MASK,        (int) khui_action_list_length(def->items),        3);    hbm_blank = LoadImage(khm_hInstance,                          MAKEINTRESOURCE(IDB_TB_BLANK),                          IMAGE_BITMAP,                          KHUI_TOOLBAR_IMAGE_WIDTH,                          KHUI_TOOLBAR_IMAGE_HEIGHT, 0);    idx_blank = ImageList_AddMasked(hiList, hbm_blank, RGB(0,0,0));    khui_hwnd_standard_toolbar = hwtb;    khui_tb_blank = idx_blank;    def = khui_find_menu(KHUI_TOOLBAR_STANDARD);    aref = def->items;    SendMessage(hwtb,        TB_BUTTONSTRUCTSIZE,        sizeof(TBBUTTON),        0);    SendMessage(hwtb,        TB_SETBITMAPSIZE,        0,        MAKELONG(KHUI_TOOLBAR_IMAGE_WIDTH,KHUI_TOOLBAR_IMAGE_HEIGHT));    SendMessage(hwtb,        TB_SETIMAGELIST,        0,        (LPARAM) hiList);    SendMessage(hwtb,        TB_SETBUTTONSIZE,        0,        MAKELONG(KHUI_TOOLBAR_IMAGE_WIDTH,KHUI_TOOLBAR_IMAGE_HEIGHT));    while(aref && aref->action != KHUI_MENU_END) {        if(aref->action == KHUI_MENU_SEP) {            khui_add_action_to_toolbar(hwtb,                                       NULL,                                       KHUI_TOOLBAR_ADD_SEP,                                       hiList);        } else {            act = khui_find_action(aref->action);            khui_add_action_to_toolbar(hwtb,                                       act,                                       KHUI_TOOLBAR_ADD_BITMAP |                                       ((aref->flags & KHUI_ACTIONREF_SUBMENU)?//.........这里部分代码省略.........
开发者ID:Brainiarc7,项目名称:pbis,代码行数:101,


示例13: DialogBox

bool WINDOW::InitExtended(){	//Put up dialog box and find out which number of samples to use	DialogBox(hInstance, MAKEINTRESOURCE(IDD_RESOLUTION), HWND_DESKTOP, SelectModeProc);	//Create a rect structure for the size/position of the window	RECT windowRect;	windowRect.left=0;	windowRect.right=(long)width;	windowRect.top=0;	windowRect.bottom=(long)height;	//Window class structure	WNDCLASS wc;	//Fill in window class struct	wc.style=			CS_HREDRAW | CS_VREDRAW | CS_OWNDC;		//Style - redraw on move, own DC	wc.lpfnWndProc=		(WNDPROC) WndProc;						//Wndproc handles messages	wc.cbClsExtra=		0;	wc.cbWndExtra=		0;	wc.hInstance=		hInstance;								//Handle to instance	wc.hIcon=			LoadIcon(NULL, IDI_WINLOGO);			//Load windows logo icon	wc.hCursor=			LoadCursor(NULL, IDC_ARROW);			//Load standard cursor	wc.hbrBackground=	NULL;									//No background required	wc.lpszMenuName=	NULL;									//No Menu	wc.lpszClassName=	"OpenGL";								//class name	//Register window class	if(!RegisterClass(&wc))	{		LOG::Instance()->OutputError("Unable to register window class");		return false;	}	else		LOG::Instance()->OutputSuccess("Window Class Registered");	//Switch to fullscreen if required	if(fullscreen)	{		DEVMODE screenSettings;	//device mode		memset(&screenSettings, 0, sizeof(screenSettings));		screenSettings.dmSize=sizeof(screenSettings);		//Set size & color bits		screenSettings.dmPelsWidth=width;		screenSettings.dmPelsHeight=height;		screenSettings.dmBitsPerPel=redBits+greenBits+blueBits+alphaBits;		screenSettings.dmFields= DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT;		//Try to change to full screen		if(ChangeDisplaySettings(&screenSettings, CDS_FULLSCREEN)!=DISP_CHANGE_SUCCESSFUL)		{			//If failed, ask whether to run in window			char * errorText="The Requested Full Screen Mode Is Not Supported By/n Your Video Card. Use Windowed Mode Instead?";			if(MessageBox(NULL, errorText, title, MB_YESNO | MB_ICONEXCLAMATION)==IDYES)				fullscreen=false;			else			{				LOG::Instance()->OutputError("Requested full screen mode not supported, quitting...");				return false;			}		}	}	//Set window style & extended style	DWORD style, exStyle;	if(fullscreen)	{		exStyle=WS_EX_APPWINDOW;		style=WS_POPUP | WS_VISIBLE;	//no border		//Hide cursor		ShowCursor(false);	}	else	{		exStyle=WS_EX_CLIENTEDGE;		style=WS_SYSMENU | WS_BORDER | WS_CAPTION | WS_VISIBLE;	}	//Adjust the window size so that client area is the size requested	AdjustWindowRectEx(&windowRect, style, false, exStyle);	//Create Window	if(!(hWnd=CreateWindowEx(	exStyle,									//window style								"OpenGL",									//class name								title,								WS_CLIPSIBLINGS | WS_CLIPCHILDREN | style,	//style								0, 0,										//position								windowRect.right-windowRect.left,			//width								windowRect.bottom-windowRect.top,			//height								NULL, NULL,								hInstance,//.........这里部分代码省略.........
开发者ID:iag,项目名称:MMOpenGLProject,代码行数:101,


示例14: CreateHypCtrl

//.........这里部分代码省略.........		GetObject(hFontParent, sizeof(LOGFONT), &lf);		switch (pHcWnd->ulStyle) {			case ulHover:				hFontNormal = CreateFontIndirect(&lf);				lf.lfUnderline = (BYTE) TRUE;				hFontHover  = CreateFontIndirect(&lf);				break;			case ulAlways:				lf.lfUnderline = (BYTE) TRUE;				hFontNormal = CreateFontIndirect(&lf);				hFontHover  = CreateFontIndirect(&lf);				break;			case ulNone:				hFontNormal = CreateFontIndirect(&lf);				hFontHover  = CreateFontIndirect(&lf);				break;			}			// save the fonts in the window extra space			SetWindowLong(hWndHyperlink, WND_FONTN, (LONG) hFontNormal);			SetWindowLong(hWndHyperlink, WND_FONTH, (LONG) hFontHover);	} else {		// use the system font		SetWindowLong(hWndHyperlink, WND_FONTN, (LONG) NULL);		SetWindowLong(hWndHyperlink, WND_FONTH, (LONG) NULL);	}	GetClientRect(hWndHyperlink, &rect);	// adjust window size to fit the text	if (pHcWnd->bAutoSize) {		PAINTSTRUCT ps;		HDC hdc;		SIZE size;		hdc	= BeginPaint(hWndHyperlink, &ps); 		SelectObject(hdc, (HFONT) GetWindowLong(hWndHyperlink, WND_FONTN));		GetTextExtentPoint32(hdc, pHcWnd->szText, GetStringLength(pHcWnd->szText), &size);		rect.right	= size.cx - rect.left;		rect.bottom	= size.cy - rect.top;		EndPaint(hWndHyperlink, &ps);		SetWindowPos(hWndHyperlink,			0,			0, 0, size.cx, size.cy,			SWP_NOMOVE | SWP_NOZORDER);	}	// save window size in the window extra space	SetWindowLong(hWndHyperlink, WND_LEFT, (LONG) (rect.left));	SetWindowLong(hWndHyperlink, WND_TOP, (LONG) (rect.top));	SetWindowLong(hWndHyperlink, WND_RIGHT, (LONG) (rect.right));	SetWindowLong(hWndHyperlink, WND_BOTTOM, (LONG) (rect.bottom));	// create tooltip if requested	if (pHcWnd->szTooltip != NULL) {    	HWND hWndTT;    	TOOLINFO ti;    	hWndTT = CreateWindowEx(WS_EX_TOPMOST,    		TOOLTIPS_CLASS,    		NULL,    		WS_POPUP | TTS_NOPREFIX | TTS_ALWAYSTIP,    		CW_USEDEFAULT,    		CW_USEDEFAULT,    		CW_USEDEFAULT,    		CW_USEDEFAULT,    		hWndHyperlink,    		NULL,    		hInst,    		NULL);    				    	if (!hWndTT) return FALSE;    	SetWindowPos(hWndTT,    		HWND_TOPMOST,    		0, 0, 0, 0,    		SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);    	ti.cbSize      = sizeof(TOOLINFO);    	ti.uFlags      = TTF_SUBCLASS;    	ti.hwnd        = hWndHyperlink;    	ti.hinst       = hInst;    	ti.uId         = 0;    	ti.lpszText    = pHcWnd->szTooltip; // get text for tooltip    	ti.rect.left   = (LONG) GetWindowLong(hWndHyperlink, WND_LEFT);    	ti.rect.top    = (LONG) GetWindowLong(hWndHyperlink, WND_TOP);    	ti.rect.right  = (LONG) GetWindowLong(hWndHyperlink, WND_RIGHT);    	ti.rect.bottom = (LONG) GetWindowLong(hWndHyperlink, WND_BOTTOM);    	// add tooltip    	SendMessage(hWndTT, TTM_ADDTOOL, 0, (LPARAM) (LPTOOLINFO) &ti);	}	// show the window	ShowWindow(hWndHyperlink, SW_NORMAL);	UpdateWindow(hWndHyperlink);	return hWndHyperlink;}
开发者ID:469306621,项目名称:Languages,代码行数:101,


示例15: VID_CreateWindow

qboolean VID_CreateWindow( int width, int height, qboolean fullscreen ){#ifdef __WXWINDOWS__	glw_state.hWnd = *(HWND*) ri.Vid_GetWindowPtr();#else	WNDCLASS		wc;	RECT			r;	cvar_t			*vid_xpos, *vid_ypos;	int				stylebits;	int				x, y, w, h;	int				exstyle;	/* Register the frame class */    wc.style         = 0;    wc.lpfnWndProc   = (WNDPROC)glw_state.wndproc;    wc.cbClsExtra    = 0;    wc.cbWndExtra    = 0;    wc.hInstance     = glw_state.hInstance;    wc.hIcon         = 0;    wc.hCursor       = LoadCursor (NULL,IDC_ARROW);	wc.hbrBackground = (void *)COLOR_GRAYTEXT;    wc.lpszMenuName  = 0;    wc.lpszClassName = WINDOW_CLASS_NAME;    if (!RegisterClass (&wc) )		ri.Sys_Error (ERR_FATAL, "Couldn't register window class");	if (fullscreen)	{		exstyle = WS_EX_TOPMOST;		stylebits = WS_POPUP|WS_VISIBLE;	}	else	{		exstyle = 0;		stylebits = WINDOW_STYLE;	}	r.left = 0;	r.top = 0;	r.right  = width;	r.bottom = height;	AdjustWindowRect (&r, stylebits, FALSE);	w = r.right - r.left;	h = r.bottom - r.top;	if (fullscreen)	{		x = 0;		y = 0;	}	else	{		vid_xpos = ri.Cvar_Get ("vid_xpos", "0", 0);		vid_ypos = ri.Cvar_Get ("vid_ypos", "0", 0);		x = vid_xpos->value;		y = vid_ypos->value;	}	glw_state.hWnd = CreateWindowEx (		 exstyle, 		 WINDOW_CLASS_NAME,		 "Quake 2",		 stylebits,		 x, y, w, h,		 NULL,		 NULL,		 glw_state.hInstance,		 NULL);#endif // ndef __WXWINDOWS__	if (!glw_state.hWnd)		ri.Sys_Error (ERR_FATAL, "Couldn't create window");		ShowWindow( glw_state.hWnd, SW_SHOW );	UpdateWindow( glw_state.hWnd );	// init all the gl stuff for the window	if (!GLimp_InitGL ())	{		ri.Con_Printf( PRINT_ALL, "VID_CreateWindow() - GLimp_InitGL failed/n");		return false;	}	SetForegroundWindow( glw_state.hWnd );	SetFocus( glw_state.hWnd );	// let the sound and input subsystems know about the new window	ri.Vid_NewWindow (width, height);	return true;}
开发者ID:lambda,项目名称:wxQuake2,代码行数:94,


示例16: CreateAppWindow

BOOL CreateAppWindow(const char* title, int width, int height, int bits, bool fullscreenflag){    windowWidth  = width;    windowHeight = height;    windowName   = title;	GLuint		PixelFormat;			// Holds The Results After Searching For A Match	WNDCLASS	wc;						// Windows Class Structure	DWORD		dwExStyle;				// Window Extended Style	DWORD		dwStyle;				// Window Style	RECT		WindowRect;				// Grabs Rectangle Upper Left / Lower Right Values	WindowRect.left=(long)0;			// Set Left Value To 0	WindowRect.right=(long)width;		// Set Right Value To Requested Width	WindowRect.top=(long)0;				// Set Top Value To 0	WindowRect.bottom=(long)height;		// Set Bottom Value To Requested Height	gFullscreen=fullscreenflag;			// Set The Global Fullscreen Flag        HICON hIcon = (HICON)LoadImage(0,IDI_WINLOGO,IMAGE_ICON,0,0,LR_SHARED);	hInstance			= GetModuleHandle(NULL);				// Grab An Instance For Our Window	wc.style			= CS_HREDRAW | CS_VREDRAW | CS_OWNDC;	// Redraw On Size, And Own DC For Window.	wc.lpfnWndProc		= (WNDPROC) WndProc;					// WndProc Handles Messages	wc.cbClsExtra		= 0;									// No Extra Window Data	wc.cbWndExtra		= 0;									// No Extra Window Data	wc.hInstance		= hInstance;							// Set The Instance	wc.hIcon			= 0;	wc.hCursor			= LoadCursor(NULL, IDC_ARROW);			// Load The Arrow Pointer	wc.hbrBackground	= NULL;									// No Background Required For GL	wc.lpszMenuName		= NULL;									// We Don't Want A Menu	wc.lpszClassName	= "OpenGL";								// Set The Class Name	if (!RegisterClass(&wc))									// Attempt To Register The Window Class	{		MessageBox(NULL,"Failed To Register The Window Class.","ERROR",MB_OK|MB_ICONEXCLAMATION);		return FALSE;											// Return FALSE	}		if (gFullscreen)												// Attempt Fullscreen Mode?	{		DEVMODE dmScreenSettings;								// Device Mode		memset(&dmScreenSettings,0,sizeof(dmScreenSettings));	// Makes Sure Memory's Cleared		dmScreenSettings.dmSize=sizeof(dmScreenSettings);		// Size Of The Devmode Structure		dmScreenSettings.dmPelsWidth	= width;				// Selected Screen Width		dmScreenSettings.dmPelsHeight	= height;				// Selected Screen Height		dmScreenSettings.dmBitsPerPel	= bits;					// Selected Bits Per Pixel		dmScreenSettings.dmFields=DM_BITSPERPEL|DM_PELSWIDTH|DM_PELSHEIGHT;		// Try To Set Selected Mode And Get Results.  NOTE: CDS_FULLSCREEN Gets Rid Of Start Bar.		if (ChangeDisplaySettings(&dmScreenSettings,CDS_FULLSCREEN)!=DISP_CHANGE_SUCCESSFUL)		{			// If The Mode Fails, Offer Two Options.  Quit Or Use Windowed Mode.			if (MessageBox(NULL,"The Requested Fullscreen Mode Is Not Supported By/nYour Video Card. Use Windowed Mode Instead?","NeHe GL",MB_YESNO|MB_ICONEXCLAMATION)==IDYES)			{				gFullscreen=FALSE;		// Windowed Mode Selected.  Fullscreen = FALSE			}			else			{				// Pop Up A Message Box Letting User Know The Program Is Closing.				MessageBox(NULL,"Program Will Now Close.","ERROR",MB_OK|MB_ICONSTOP);				return FALSE;									// Return FALSE			}		}	}	if (gFullscreen)												// Are We Still In Fullscreen Mode?	{		dwExStyle=WS_EX_APPWINDOW;								// Window Extended Style		dwStyle=WS_POPUP;										// Windows Style		ShowCursor(FALSE);										// Hide Mouse Pointer	}	else	{		dwExStyle=WS_EX_APPWINDOW | WS_EX_WINDOWEDGE;			// Window Extended Style		dwStyle=WS_OVERLAPPEDWINDOW;							// Windows Style	}	AdjustWindowRectEx(&WindowRect, dwStyle, FALSE, dwExStyle);		// Adjust Window To True Requested Size	// Create The Window	if (!(hWnd=CreateWindowEx(	dwExStyle,							// Extended Style For The Window								"OpenGL",							// Class Name								title,								// Window Title								dwStyle |							// Defined Window Style								WS_CLIPSIBLINGS |					// Required Window Style								WS_CLIPCHILDREN,					// Required Window Style								0, 0,								// Window Position								WindowRect.right-WindowRect.left,	// Calculate Window Width								WindowRect.bottom-WindowRect.top,	// Calculate Window Height								NULL,								// No Parent Window								NULL,								// No Menu								hInstance,							// Instance								NULL)))								// Dont Pass Anything To WM_CREATE	{		CloseWindow();								// Reset The Display		MessageBox(NULL,"Window Creation Error.","ERROR",MB_OK|MB_ICONEXCLAMATION);		return FALSE;								// Return FALSE	}	static	PIXELFORMATDESCRIPTOR pfd=				// pfd Tells Windows How We Want Things To Be//.........这里部分代码省略.........
开发者ID:JoshMarino,项目名称:lims-hsv-system,代码行数:101,


示例17: WinMain

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,	LPSTR lpCmdLine, int nCmdShow){	int iResult;	// Initialize Winsock first	iResult = WSAStartup(MAKEWORD(2, 2), &wsaData);	if (iResult != 0) {		MessageBoxA(NULL, "Unable to initialize Winsock!", "Error!", MB_ICONERROR | MB_OK);		return 1;	}	HWND hwnd;	MSG Msg;	hDefaultFont = GetStockObject(DEFAULT_GUI_FONT);	gHBRBackground = CreateSolidBrush(RGB(0, 0xCC, 0));	wc.lpfnWndProc = WndProc;	wc.hInstance = hInstance;	if (!RegisterClassEx(&wc))	{		MessageBoxA(NULL, "Window Registration Failed!", "Error!", MB_ICONEXCLAMATION | MB_OK);		return 0;	}	hwnd = CreateWindowEx(0, wc.lpszClassName, L"cREST", WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, 		MASTER_WIDTH, MASTER_HEIGHT, NULL, NULL, hInstance, NULL);	if (hwnd == NULL)	{		MessageBoxA(NULL, "Window Creation Failed!", "Error!", MB_ICONEXCLAMATION | MB_OK);		return 0;	}	ShowWindow(hwnd, nCmdShow);	UpdateWindow(hwnd);	while (GetMessage(&Msg, NULL, 0, 0) > 0)	{		//Checks for thread communications		//TODO: move these out of the main msg loop		if (Msg.message == SET_RESPONSE_TEXT) {			if (Msg.lParam == THREAD_STATUS_CONNECTING) {				SendMessage(vControls[AREA_RESPONSE], WM_SETTEXT, NULL, (LPARAM)L"Connecting to server...");			} else if (Msg.lParam == THREAD_STATUS_WAITING) {				SendMessage(vControls[AREA_RESPONSE], WM_SETTEXT, NULL, (LPARAM)L"Waiting for server response...");			} else if (Msg.lParam == THREAD_STATUS_RECEIVING_RESPONSE) {				SendMessage(vControls[AREA_RESPONSE], WM_SETTEXT, NULL, (LPARAM)L"Receiving server response...");			} else if (Msg.lParam == THREAD_STATUS_DONE && gThreadBool) {				SendMessage(vControls[AREA_RESPONSE], WM_SETTEXT, NULL, (LPARAM)gThreadResponse.c_str());				gThreadBool = false;				gCanSend = true;			};		}		//Send the request whenever ENTER is pressed, regardless of keyboard focus		if (Msg.message == WM_KEYUP && Msg.wParam == VK_RETURN) {			SendMessage(hwnd, WM_COMMAND, (WPARAM)IDC_SEND_BUTTON, NULL); //Emulate clicking the SEND button		}		//Shut the beeper up when pressing ENTER		if (Msg.message == WM_KEYDOWN && Msg.wParam == VK_RETURN) {			continue;		}		TranslateMessage(&Msg);		DispatchMessage(&Msg);	}	return Msg.wParam;}
开发者ID:mgukowsky,项目名称:cREST,代码行数:70,


示例18: InitializeWindow

bool InitializeWindow(HINSTANCE hInstance, const RenderParams& renderParams, HWND* hwndOut){	WNDCLASSEX wc;	DEVMODE dmScreenSettings;	int posX, posY;	OutputDebugString("Initializing Window.../n");	// Setup the windows class with default settings.	wc.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC;	wc.lpfnWndProc = &WindowProc;	wc.cbClsExtra = 0;	wc.cbWndExtra = 0;	wc.hInstance = hInstance;	wc.hIcon = LoadIcon(nullptr, IDI_WINLOGO);	wc.hIconSm = wc.hIcon;	wc.hCursor = LoadCursor(nullptr, IDC_ARROW);	wc.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH);	wc.lpszMenuName = nullptr;	wc.lpszClassName = WINDOW_CLASS_NAME;	wc.cbSize = sizeof(WNDCLASSEX);	OutputDebugString("Registering Window Class.../n");	// Register the window class.	RegisterClassEx(&wc);	int windowWidth = renderParams.Extent.Width;	int windowHeight = renderParams.Extent.Height;	// Setup the screen settings depending on whether it is running in full screen or in windowed mode.	if (!renderParams.Windowed)	{		memset(&dmScreenSettings, 0, sizeof(dmScreenSettings));		dmScreenSettings.dmSize = sizeof(dmScreenSettings);		dmScreenSettings.dmPelsWidth = (unsigned long)GetSystemMetrics(SM_CXSCREEN);		dmScreenSettings.dmPelsHeight = (unsigned long)GetSystemMetrics(SM_CXSCREEN);		dmScreenSettings.dmBitsPerPel = 32;		dmScreenSettings.dmFields = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT;		// Change the display settings to full screen.		ChangeDisplaySettings(&dmScreenSettings, CDS_FULLSCREEN);		// Set the position of the window to the top left corner.		posX = 0;		posY = 0;	}	else	{		// Place the window in the middle of the screen.		posX = (GetSystemMetrics(SM_CXSCREEN) - windowWidth) / 2;		posY = (GetSystemMetrics(SM_CYSCREEN) - windowHeight) / 2;		RECT r = { 0, 0, windowWidth, windowHeight };		AdjustWindowRect(&r, WS_OVERLAPPEDWINDOW, FALSE);		windowWidth = r.right - r.left;		windowHeight = r.bottom - r.top;	}	DWORD windowStyle = 0;	if (!renderParams.Windowed)		windowStyle = WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_POPUP;	else		windowStyle = WS_OVERLAPPEDWINDOW;	OutputDebugString("Creating Window.../n");	// Create the window with the screen settings and get the handle to it.	*hwndOut = CreateWindowEx(WS_EX_APPWINDOW, WINDOW_CLASS_NAME, APPLICATION_NAME,		windowStyle,		posX, posY, windowWidth, windowHeight, nullptr, nullptr, hInstance, nullptr);	ShowWindow(*hwndOut, SW_HIDE);	if (hwndOut == nullptr)		return false;	return true;}
开发者ID:ConArtist141,项目名称:Engine,代码行数:79,


示例19: IORegView_Proc

LRESULT CALLBACK IORegView_Proc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam){	CIORegView* wnd = (CIORegView*)GetWindowLongPtr(hWnd, DWLP_USER);	if ((wnd == NULL) && (uMsg != WM_CREATE))		return DefWindowProc(hWnd, uMsg, wParam, lParam);	switch (uMsg)	{	case WM_CREATE:		{			RECT rc;			SIZE fontsize;			// Retrieve the CIORegView instance passed upon window creation			// and match it to the window			wnd = (CIORegView*)((CREATESTRUCT*)lParam)->lpCreateParams;			SetWindowLongPtr(hWnd, DWLP_USER, (LONG)wnd);			// Create the fixed-pitch font			wnd->hFont = CreateFont(16, 0, 0, 0, FW_MEDIUM, FALSE, FALSE, FALSE, DEFAULT_CHARSET, 				OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, GetFontQuality(), FIXED_PITCH, "Courier New");			// Create the vertical scrollbar			// The sizing and positioning of the scrollbar is done in WM_SIZE messages			wnd->vsbWidth = GetSystemMetrics(SM_CXVSCROLL);			wnd->hScrollbar = CreateWindow("Scrollbar", "",				WS_CHILD | WS_VISIBLE | WS_DISABLED | SBS_VERT,				0, 0, 0, 0, hWnd, NULL, hAppInst, NULL);			// Create the rebar that will hold all the controls			wnd->hRebar = CreateWindowEx(WS_EX_TOOLWINDOW, REBARCLASSNAME, NULL, 				WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | CCS_NODIVIDER | RBS_VARHEIGHT | RBS_BANDBORDERS, 				0, 0, 0, 0, hWnd, NULL, hAppInst, NULL);			// Create the CPU combobox and fill it			wnd->hCPUCombo = CreateWindow("ComboBox", "",				WS_CHILD | WS_VISIBLE | WS_VSCROLL | CBS_DROPDOWNLIST, 				0, 0, 0, 50, wnd->hRebar, (HMENU)IDC_CPU, hAppInst, NULL);			SendMessage(wnd->hCPUCombo, WM_SETFONT, (WPARAM)wnd->hFont, TRUE);			SendMessage(wnd->hCPUCombo, CB_ADDSTRING, 0, (LPARAM)"ARM9");			SendMessage(wnd->hCPUCombo, CB_ADDSTRING, 0, (LPARAM)"ARM7");			SendMessage(wnd->hCPUCombo, CB_SETCURSEL, 0, 0);			// Create the reg combobox and fill it			wnd->hRegCombo = CreateWindow("ComboBox", "",				WS_CHILD | WS_VISIBLE | WS_VSCROLL | CBS_DROPDOWNLIST, 				0, 0, 0, 400, wnd->hRebar, (HMENU)IDC_IOREG, hAppInst, NULL);			SendMessage(wnd->hRegCombo, WM_SETFONT, (WPARAM)wnd->hFont, TRUE);			SendMessage(wnd->hRegCombo, CB_SETDROPPEDWIDTH, 300, 0);			wnd->ChangeCPU(ARMCPU_ARM9);			SendMessage(wnd->hRegCombo, CB_SETCURSEL, 0, 0);			// Add all those nice controls to the rebar			REBARBANDINFO rbBand = { 80 };			rbBand.fMask = RBBIM_STYLE | RBBIM_TEXT | RBBIM_CHILD | RBBIM_CHILDSIZE | RBBIM_SIZE;			rbBand.fStyle = RBBS_CHILDEDGE | RBBS_NOGRIPPER;			GetWindowRect(wnd->hCPUCombo, &rc);			rbBand.lpText = "CPU: ";			rbBand.hwndChild = wnd->hCPUCombo;			rbBand.cxMinChild = 0;			rbBand.cyMinChild = rc.bottom - rc.top;			rbBand.cx = 100;			SendMessage(wnd->hRebar, RB_INSERTBAND, (WPARAM)-1, (LPARAM)&rbBand);			GetWindowRect(wnd->hRegCombo, &rc);			rbBand.lpText = "Registers: ";			rbBand.hwndChild = wnd->hRegCombo;			rbBand.cxMinChild = 0;			rbBand.cyMinChild = rc.bottom - rc.top;			rbBand.cx = 0;			SendMessage(wnd->hRebar, RB_INSERTBAND, (WPARAM)-1, (LPARAM)&rbBand);			GetWindowRect(wnd->hRebar, &rc);			wnd->rebarHeight = rc.bottom - rc.top;			GetFontSize(hWnd, wnd->hFont, &fontsize);			wnd->lineheight = kYMargin + fontsize.cy + kYMargin + 1;		}		return 0;	case WM_CLOSE:		CloseToolWindow(wnd);		return 0;	case WM_SIZE:		{			RECT rc;			// Resize and reposition the controls			SetWindowPos(wnd->hRebar, NULL, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, SWP_NOZORDER | SWP_NOMOVE);			GetClientRect(hWnd, &rc);			SetWindowPos(wnd->hScrollbar, NULL, rc.right-wnd->vsbWidth, wnd->rebarHeight, wnd->vsbWidth, rc.bottom-wnd->rebarHeight, SWP_NOZORDER);			// Keep the first rebar band width to a reasonable value			SendMessage(wnd->hRebar, RB_SETBANDWIDTH, 0, 100);//.........这里部分代码省略.........
开发者ID:Annovae,项目名称:desmume,代码行数:101,


示例20: Win32VoutCreateWindow

//.........这里部分代码省略.........    if( var_GetBool( vd, "video-deco" ) )    {        /* Open with window decoration */        AdjustWindowRect( &rect_window, WS_OVERLAPPEDWINDOW|WS_SIZEBOX, 0 );        i_style = WS_OVERLAPPEDWINDOW|WS_SIZEBOX|WS_VISIBLE|WS_CLIPCHILDREN;        i_stylex = 0;    }    else    {        /* No window decoration */        AdjustWindowRect( &rect_window, WS_POPUP, 0 );        i_style = WS_POPUP|WS_VISIBLE|WS_CLIPCHILDREN;        i_stylex = 0; // WS_EX_TOOLWINDOW; Is TOOLWINDOW really needed ?                      // It messes up the fullscreen window.    }    if( p_event->hparent )    {        i_style = WS_VISIBLE|WS_CLIPCHILDREN|WS_CHILD;        i_stylex = 0;        /* allow user to regain control over input events if requested */        bool b_mouse_support = var_InheritBool( vd, "mouse-events" );        bool b_key_support = var_InheritBool( vd, "keyboard-events" );        if( !b_mouse_support && !b_key_support )            i_style |= WS_DISABLED;    }    p_event->i_window_style = i_style;    /* Create the window */    p_event->hwnd =        CreateWindowEx( WS_EX_NOPARENTNOTIFY | i_stylex,                    p_event->class_main,             /* name of window class */                    _T(VOUT_TITLE) _T(" (VLC Video Output)"),  /* window title */                    i_style,                                 /* window style */                    (!p_event->wnd_cfg.x) ? (UINT)CW_USEDEFAULT :                        (UINT)p_event->wnd_cfg.x,   /* default X coordinate */                    (!p_event->wnd_cfg.y) ? (UINT)CW_USEDEFAULT :                        (UINT)p_event->wnd_cfg.y,   /* default Y coordinate */                    rect_window.right - rect_window.left,    /* window width */                    rect_window.bottom - rect_window.top,   /* window height */                    p_event->hparent,                       /* parent window */                    NULL,                          /* no menu in this window */                    hInstance,            /* handle of this program instance */                    (LPVOID)p_event );           /* send vd to WM_CREATE */    if( !p_event->hwnd )    {        msg_Warn( vd, "Win32VoutCreateWindow create window FAILED (err=%lu)", GetLastError() );        return VLC_EGENERIC;    }    InitGestures( p_event->hwnd, &p_event->p_gesture );    if( p_event->hparent )    {        LONG i_style;        /* We don't want the window owner to overwrite our client area */        i_style = GetWindowLong( p_event->hparent, GWL_STYLE );        if( !(i_style & WS_CLIPCHILDREN) )            /* Hmmm, apparently this is a blocking call... */            SetWindowLong( p_event->hparent, GWL_STYLE,
开发者ID:yexihu,项目名称:vlc-2.2.0-rc2.32-2013,代码行数:67,


示例21: CreateButton

HWND CreateButton(TCHAR *Titel, int x0, int y0, int w, int h, int ID, HWND hW, HINSTANCE hInst){	return CreateWindowEx(WS_EX_PALETTEWINDOW, L"BUTTON", Titel,		WS_VISIBLE | WS_CHILD,		x0, y0, w, h, hW, (HMENU)ID, hInst, NULL);}
开发者ID:arkiny,项目名称:DreamCoast2D,代码行数:6,


示例22: wWinMain

INT WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR szCmdLine, int iCmdShow){    WNDCLASSEX winClass ;    winClass.lpszClassName = "MaterialOnly";    winClass.cbSize        = sizeof(WNDCLASSEX);    winClass.style         = CS_HREDRAW | CS_VREDRAW;    winClass.lpfnWndProc   = MsgProc;    winClass.hInstance     = hInstance;    winClass.hIcon	       = NULL ;    winClass.hIconSm	   = NULL ;    winClass.hCursor       = LoadCursor(NULL, IDC_ARROW) ;    winClass.hbrBackground = NULL ;    winClass.lpszMenuName  = NULL ;    winClass.cbClsExtra    = 0;    winClass.cbWndExtra    = 0;    RegisterClassEx (&winClass) ;    HWND hWnd = CreateWindowEx(NULL,                               winClass.lpszClassName,		// window class name                               "MaterialOnly",			// window caption                               WS_OVERLAPPEDWINDOW, 		// window style                               32,							// initial x position                               32,							// initial y position                               600,						// initial window width                               600,						// initial window height                               NULL,						// parent window handle                               NULL,						// window menu handle                               hInstance,					// program instance handle                               NULL) ;						// creation parameters    // Create window failed    if(hWnd == NULL)    {        MessageBoxA(hWnd, "Create Window failed!", "Error", 0) ;        return -1 ;    }    // Initialize Direct3D    if( SUCCEEDED(InitD3D(hWnd)))    {        // Show the window        ShowWindow( hWnd, SW_SHOWDEFAULT );        UpdateWindow( hWnd );        MSG msg ;        ZeroMemory( &msg, sizeof(msg) );        PeekMessage( &msg, NULL, 0U, 0U, PM_NOREMOVE );        // Get last time        static DWORD lastTime = timeGetTime();        while (msg.message != WM_QUIT)        {            if(PeekMessage( &msg, NULL, 0U, 0U, PM_REMOVE ) != 0)            {                TranslateMessage (&msg) ;                DispatchMessage (&msg) ;            }            else // Render the game if there is no message to process            {                // Get current time                DWORD currTime  = timeGetTime();                // Calculate time elapsed                float timeDelta = (currTime - lastTime) * 0.001f;                // Render                Render(timeDelta) ;                // Update last time to current time for next loop                lastTime = currTime;            }        }    }    UnregisterClass(winClass.lpszClassName, hInstance) ;    return 0;}
开发者ID:BillyKim,项目名称:directxcode,代码行数:80,


示例23: WinMain

int WINAPI WinMain(	HINSTANCE hinstance,					HINSTANCE hprevinstance,					LPSTR lpcmdline,					int ncmdshow){WNDCLASSEX winclass; // this will hold the class we createHWND	   hwnd;	 // generic window handleMSG		   msg;		 // generic messageHDC        hdc;      // graphics device context// first fill in the window class stucturewinclass.cbSize         = sizeof(WNDCLASSEX);winclass.style			= CS_DBLCLKS | CS_OWNDC |                           CS_HREDRAW | CS_VREDRAW;winclass.lpfnWndProc	= WindowProc;winclass.cbClsExtra		= 0;winclass.cbWndExtra		= 0;winclass.hInstance		= hinstance;winclass.hIcon			= LoadIcon(NULL, IDI_APPLICATION);winclass.hCursor		= LoadCursor(NULL, IDC_ARROW); winclass.hbrBackground	= (HBRUSH)GetStockObject(BLACK_BRUSH);winclass.lpszMenuName	= NULL;winclass.lpszClassName	= WINDOW_CLASS_NAME;winclass.hIconSm        = LoadIcon(NULL, IDI_APPLICATION);// save hinstance in globalhinstance_app = hinstance;// register the window classif (!RegisterClassEx(&winclass))	return(0);// create the windowif (!(hwnd = CreateWindowEx(NULL,                  // extended style                            WINDOW_CLASS_NAME,     // class						    "DirectDraw 8-Bit Blitting Demo", // title						    WS_POPUP | WS_VISIBLE,					 	    0,0,	  // initial x,y						    SCREEN_WIDTH,SCREEN_HEIGHT,  // initial width, height						    NULL,	  // handle to parent 						    NULL,	  // handle to menu						    hinstance,// instance of this application						    NULL)))	// extra creation parmsreturn(0);// save main window handlemain_window_handle = hwnd;// initialize game hereGame_Init();// enter main event loopwhile(TRUE)	{    // test if there is a message in queue, if so get it	if (PeekMessage(&msg,NULL,0,0,PM_REMOVE))	   { 	   // test if this is a quit       if (msg.message == WM_QUIT)           break;		   // translate any accelerator keys	   TranslateMessage(&msg);	   // send the message to the window proc	   DispatchMessage(&msg);	   } // end if           // main game processing goes here       Game_Main();       	} // end while// closedown game hereGame_Shutdown();// return to Windows like thisreturn(msg.wParam);} // end WinMain
开发者ID:calyx,项目名称:windows-game-source-code,代码行数:81,


示例24: ClientToScreen

void ChangeInfoData::BeginListEdit(int iItem, RECT *rc, int iSetting, WORD wVKey){  int j,n;  POINT pt;  int itemHeight;  char str[MAX_PATH];  if (dataListEdit)    dataListEdit->EndListEdit(0);  pt.x=pt.y=0;  ClientToScreen(hwndList,&pt);  OffsetRect(rc,pt.x,pt.y);  InflateRect(rc,-2,-2);  rc->left-=2;  iEditItem = iItem;  ListView_RedrawItems(hwndList, iEditItem, iEditItem);  UpdateWindow(hwndList);  dataListEdit = this;  hwndListEdit = CreateWindowEx(WS_EX_TOOLWINDOW|WS_EX_TOPMOST, _T("LISTBOX"), _T(""), WS_POPUP|WS_BORDER|WS_VSCROLL, rc->left, rc->bottom, rc->right - rc->left, 150, NULL, NULL, hInst, NULL);  SendMessage(hwndListEdit, WM_SETFONT, (WPARAM)hListFont, 0);  itemHeight = SendMessage(hwndListEdit, LB_GETITEMHEIGHT, 0, 0);  FieldNamesItem *list = (FieldNamesItem*)setting[iSetting].pList;  if (list == countryField)  { // some country codes were changed leaving old details uknown, convert it for the user    if (settingData[iSetting].value == 420) settingData[iSetting].value = 42; // conversion of obsolete codes (OMG!)    else if (settingData[iSetting].value == 421) settingData[iSetting].value = 4201;    else if (settingData[iSetting].value == 102) settingData[iSetting].value = 1201;  }  n = ListBoxAddStringUtf(hwndListEdit, "Unspecified");  for (j=0; ; j++)    if (!list[j].text)    {      SendMessage(hwndListEdit, LB_SETITEMDATA, n, j);      if ((settingData[iSetting].value == 0 && list[j].code == 0)       || (setting[iSetting].dbType != DBVT_ASCIIZ && settingData[iSetting].value == list[j].code))        SendMessage(hwndListEdit, LB_SETCURSEL, n, 0);      break;    }  for (j=0; list[j].text; j++)   {    n = ListBoxAddStringUtf(hwndListEdit, list[j].text);    SendMessage(hwndListEdit, LB_SETITEMDATA, n, j);    if ((setting[iSetting].dbType == DBVT_ASCIIZ && (!strcmpnull((char*)settingData[iSetting].value, list[j].text))     || (setting[iSetting].dbType == DBVT_ASCIIZ && (!strcmpnull((char*)settingData[iSetting].value, ICQTranslateUtfStatic(list[j].text, str, MAX_PATH))))     || ((char*)settingData[iSetting].value == NULL && list[j].code == 0))     || (setting[iSetting].dbType != DBVT_ASCIIZ && settingData[iSetting].value == list[j].code))      SendMessage(hwndListEdit, LB_SETCURSEL, n, 0);  }  SendMessage(hwndListEdit, LB_SETTOPINDEX, SendMessage(hwndListEdit, LB_GETCURSEL, 0, 0) - 3, 0);  int listCount = SendMessage(hwndListEdit, LB_GETCOUNT, 0, 0);  if (itemHeight * listCount < 150)    SetWindowPos(hwndListEdit, 0, 0, 0, rc->right - rc->left, itemHeight * listCount + GetSystemMetrics(SM_CYBORDER) * 2, SWP_NOZORDER|SWP_NOMOVE);  OldListEditProc = (WNDPROC)SetWindowLongPtr(hwndListEdit, GWLP_WNDPROC, (LONG_PTR)ListEditSubclassProc);  if (MyAnimateWindow = (BOOL (WINAPI*)(HWND,DWORD,DWORD))GetProcAddress(GetModuleHandleA("user32"), "AnimateWindow"))   {    BOOL enabled;    SystemParametersInfo(SPI_GETCOMBOBOXANIMATION, 0, &enabled, FALSE);    if (enabled) MyAnimateWindow(hwndListEdit, 200, AW_SLIDE|AW_ACTIVATE|AW_VER_POSITIVE);  }  ShowWindow(hwndListEdit, SW_SHOW);  SetFocus(hwndListEdit);  if (wVKey)    PostMessage(hwndListEdit, WM_KEYDOWN, wVKey, 0);}
开发者ID:TonyAlloa,项目名称:miranda-dev,代码行数:71,


示例25: WinProc

LRESULT CALLBACK WinProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam) {    PAINTSTRUCT Ps;	switch(msg) {    case WM_CREATE: {		    /**		    * Create AddFood Button            */            HFONT hFont = CreateFont(30,0,0,0,FW_DONTCARE,FALSE,TRUE,FALSE,DEFAULT_CHARSET,OUT_OUTLINE_PRECIS,                CLIP_DEFAULT_PRECIS,NULL, VARIABLE_PITCH,TEXT("Impact"));            HWND hButtonAddFood = CreateWindowEx(NULL,                "BUTTON",                "ADD FOOD",                WS_TABSTOP|WS_VISIBLE|                WS_CHILD|BS_DEFPUSHBUTTON|BS_TOP,                10,                150,                100,                25,                hWnd,                (HMENU)BUTTON_ADD_FOOD,                GetModuleHandle(NULL),                NULL);            /**            * Create button ShowFoodNumber            */            HWND hShowFoodNumber = CreateWindowEx(NULL,                "BUTTON",                "Funny",                WS_TABSTOP|WS_VISIBLE|                WS_CHILD|BS_DEFPUSHBUTTON|BS_TOP,                10,                180,                300,                40,                hWnd,                (HMENU)BUTTON_DISPLAY_FOOD_NR,                GetModuleHandle(NULL),                NULL);            SendMessage (hShowFoodNumber, WM_SETFONT, WPARAM (hFont), TRUE);            /**            * Draw Food List (In a input box)            */            hFoodList = CreateWindowEx(WS_EX_CLIENTEDGE,                "EDIT",                "",                WS_CHILD|WS_VISIBLE|WS_VSCROLL|ES_READONLY|                ES_MULTILINE,                10,                40,                300,                100,                hWnd,                (HMENU)INPUT_TEXT_SHOW_FOOD,                GetModuleHandle(NULL),                NULL);            /**            * Draw main Input food field            */            hInputFood = CreateWindowEx(                (DWORD)NULL,                TEXT("edit"),                "",                WS_VISIBLE | WS_CHILD | WS_BORDER,                120,                150,                190,                25,                hWnd,                (HMENU)INPUT_TEXT_ADD_FOOD,                GetModuleHandle(NULL),                NULL);        }        break;		case WM_PAINT: {            HDC hdc = BeginPaint(hWnd, &Ps);            RECT rect;            /**            * Draw Text            */            // Second Text            char foodNrMessage[256] = "Number : ";            char nr[50];            strcat(foodNrMessage, itoa(foodNumber, nr, 10));            SetBkMode(hdc, TRANSPARENT);            SetRect(&updateRect, 210, 10, 300, 30);            DrawText( hdc, foodNrMessage, -1, &updateRect, DT_SINGLELINE | DT_NOCLIP  ) ;            // First Text            HFONT hFont = CreateFont(25,0,0,0,FW_DONTCARE,FALSE,TRUE,FALSE,DEFAULT_CHARSET,OUT_OUTLINE_PRECIS,//.........这里部分代码省略.........
开发者ID:TUM-FAF,项目名称:WP-FAF-111-Terman-Sergiu,代码行数:101,


示例26: GLW_CreateWindow

static qboolean GLW_CreateWindow( const char *drivername, int width, int height, int colorbits, qboolean cdsFullscreen ) {	RECT r;	cvar_t          *vid_xpos, *vid_ypos;	int stylebits;	int x, y, w, h;	int exstyle;	//	// register the window class if necessary	//	if ( !s_classRegistered ) {		WNDCLASS wc;		memset( &wc, 0, sizeof( wc ) );		wc.style         = 0;		wc.lpfnWndProc   = (WNDPROC) glw_state.wndproc;		wc.cbClsExtra    = 0;		wc.cbWndExtra    = 0;		wc.hInstance     = g_wv.hInstance;		wc.hIcon         = LoadIcon( g_wv.hInstance, MAKEINTRESOURCE( IDI_ICON1 ) );		wc.hCursor       = LoadCursor( NULL,IDC_ARROW );		wc.hbrBackground = (void *)COLOR_GRAYTEXT;		wc.lpszMenuName  = 0;		wc.lpszClassName = WINDOW_CLASS_NAME;		if ( !RegisterClass( &wc ) ) {			ri.Error( ERR_VID_FATAL, "GLW_CreateWindow: could not register window class" );		}		s_classRegistered = qtrue;		ri.Printf( PRINT_ALL, "...registered window class/n" );	}	//	// create the HWND if one does not already exist	//	if ( !g_wv.hWnd ) {		//		// compute width and height		//		r.left = 0;		r.top = 0;		r.right  = width;		r.bottom = height;		if ( cdsFullscreen || !Q_stricmp( _3DFX_DRIVER_NAME, drivername ) ) {			exstyle = WS_EX_TOPMOST;			stylebits = WS_POPUP | WS_VISIBLE | WS_SYSMENU;		} else		{			exstyle = 0;			stylebits = WINDOW_STYLE | WS_SYSMENU;			AdjustWindowRect( &r, stylebits, FALSE );		}		w = r.right - r.left;		h = r.bottom - r.top;		if ( cdsFullscreen || !Q_stricmp( _3DFX_DRIVER_NAME, drivername ) ) {			x = 0;			y = 0;		} else		{			vid_xpos = ri.Cvar_Get( "vid_xpos", "", 0 );			vid_ypos = ri.Cvar_Get( "vid_ypos", "", 0 );			x = vid_xpos->integer;			y = vid_ypos->integer;			// adjust window coordinates if necessary			// so that the window is completely on screen			if ( x < 0 ) {				x = 0;			}			if ( y < 0 ) {				y = 0;			}			if ( w < glw_state.desktopWidth &&				 h < glw_state.desktopHeight ) {				if ( x + w > glw_state.desktopWidth ) {					x = ( glw_state.desktopWidth - w );				}				if ( y + h > glw_state.desktopHeight ) {					y = ( glw_state.desktopHeight - h );				}			}		}		g_wv.hWnd = CreateWindowEx(			exstyle,			WINDOW_CLASS_NAME,			//"Wolfenstein",			"Enemy Territory - Omni-bot",			stylebits,			x, y, w, h,			NULL,			NULL,			g_wv.hInstance,			NULL );//.........这里部分代码省略.........
开发者ID:chegestar,项目名称:omni-bot,代码行数:101,


示例27: WinMain

//------------------------------------------------------------------------int WINAPI WinMain(	HINSTANCE	instance,	HINSTANCE	previnst,	LPSTR		cmdline,	int			cmdshow){MSG		msg;DWORD	win_style;int		win_width;int		win_height;	// Setup window stuff	g_win_instance = instance;	strcpy(g_win_class_name, "DreamGL_cls");	memset(&g_win_class, 0, sizeof(g_win_class));	g_win_class.cbSize        = sizeof(WNDCLASSEX);	g_win_class.lpfnWndProc   = MainWindowProc;	g_win_class.style         = CS_HREDRAW | CS_VREDRAW;//CS_CLASSDC;	g_win_class.cbClsExtra    = 0;	g_win_class.cbWndExtra    = 0;	g_win_class.hInstance     = g_win_instance;	g_win_class.hIcon         = LoadIcon(g_win_instance, MAKEINTRESOURCE(IDI_APPLICATION));	g_win_class.hIconSm       = g_win_class.hIcon;	g_win_class.hCursor       = LoadCursor(NULL, IDC_ARROW);	g_win_class.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH);	g_win_class.lpszClassName = g_win_class_name;	g_win_class.lpszMenuName  = NULL;	g_win_atom = RegisterClassEx(&g_win_class);	if(INVALID_ATOM == g_win_atom)	{		MessageBox(0, "Invalid ATOM returned by RegisterClassEx()!", "ERROR!", MB_OK);		return(0);	}	win_style = WS_OVERLAPPEDWINDOW;	if(g_full_screen) win_style = WS_POPUP;	// In windowed mode, account for window border and caption bar.	win_width  = g_screen_width;	win_height = g_screen_height;	if(!g_full_screen)	{		win_width  += (GetSystemMetrics(SM_CXFRAME)*2);		win_height += (GetSystemMetrics(SM_CYFRAME)*2)+GetSystemMetrics(SM_CYCAPTION);	}	g_win_h = CreateWindowEx(		WS_EX_APPWINDOW,		MAKEINTATOM(g_win_atom),		"DreamGL Demo",		win_style,		0, 0, win_width, win_height,		NULL, NULL, g_win_instance, NULL);	if(!IsWindow(g_win_h))	{		MessageBox(0, "Invalid HWND returned by CreateWindowEx()!", "ERROR!", MB_OK);		return(0);	}	ShowWindow(g_win_h, cmdshow);	UpdateWindow(g_win_h);	if(!init())	{		MessageBox(0, "Failed to initialize OpenGL!", "ERROR!", MB_OK);		return(0);	}	demo_init();	while(TRUE)	{		if(PeekMessage(&msg, 0, 0, 0, PM_REMOVE))		{			if(WM_QUIT == msg.message)			{				break;			}			else			{				TranslateMessage(&msg);				DispatchMessage(&msg);			}		}		else		{			demo_tick();		}	}	demo_end();	end();//.........这里部分代码省略.........
开发者ID:AzagraMac,项目名称:PS2_SDK,代码行数:101,


示例28: SelectDialogLayout

//.........这里部分代码省略.........		{			while(--bathyDimResult[c].width%16 != 0)				;			_ASSERT(bathyDimResult[c].width%16 == 0);			bathyDimResult[c].height = (int)(bathyDimResult[c].width * pBathyMapInf->heightMeters/pBathyMapInf->widthMeters);		}	}	_ASSERT(c >= 0 && c <=3);	// Get the configuration	//layoutConfig = GetDlgLayoutConfig(	//----------------------------------------------------------------------------------//	// Set up the bathymetry map size on the dialog box.	//-------------------------------------------------//	dlgLayout.bathy.width = bathyDimResult[c].width;	dlgLayout.bathy.height = bathyDimResult[c].height;	_ASSERT(bathyDimResult[c].width%16 == 0);	//----------------------------------------------------------------------------------//	// Set the slope and depth scale locations and size on the dialog box.	//--------------------------------------------------------------------//	// The X locations are a function of the space the bathymetry bitmap take up plus	// space inbetween	dlgLayout.depth.x = dlgLayout.bathy.x + dlgLayout.bathy.width + CONTRLSPACEPIXELS;	dlgLayout.depth.y = dlgLayout.bathy.y;	dlgLayout.depth.height = dlgLayout.bathy.height;#if 0	if(g_hwndDepthScale == NULL)	{		// Depth scale		g_hwndDepthScale = CreateWindowEx(			0,	// dwExStyle: The extended window style of the window being created.			SCALEBITMAPWINDOWCLASSNAME, // lpClassName: Pointer to a null-terminated string or a class atom			"ScaleBitmap", // lpWindowName: Pointer to a null-terminated string that specifies the window name			WS_CLIPCHILDREN | WS_BORDER | WS_VISIBLE | WS_CHILD, //dwStyle: Specifies the style of the window			dlgLayout.depth.x, // x: Initial horizontal position of the window			dlgLayout.depth.y, // y: Initial vertical position of the window			dlgLayout.depth.width + 2, // The width of the window in device units.  +2 for the border box.			dlgLayout.depth.height + 2, // The height of the window in device units.  +2 for the border box.			g_hDlgSeed, // hWndParent: Handle to the parent or owner window of the window being created.			(HMENU) NULL, //hMenu: Handle to a menu, or specifies a child-window identifier, depending on the window style. 			NULL,//hInstance: Handle to the instance of the module to be associated with the window.			(LPVOID)(pSeedInf)); // lpParam: Pointer to a value to be passed to the window through the CREATESTRUCT								 //          structure (lpCreateParams member) pointed to by the lParam param of								 //			 the WM_CREATE message	}	else	{		SetWindowPos(g_hwndDepthScale, HWND_TOP, dlgLayout.depth.x, dlgLayout.depth.y+2, dlgLayout.depth.width+2, dlgLayout.depth.height, SWP_SHOWWINDOW);	}#endif	dlgLayout.slope.x = dlgLayout.depth.x + dlgLayout.depth.width + CONTRLSPACEPIXELS;	dlgLayout.slope.y = dlgLayout.bathy.y;	dlgLayout.slope.height = dlgLayout.bathy.height;#if 0	if(g_hwndSlopeScale == NULL)	{		g_hwndSlopeScale  = CreateWindowEx(			0,	// dwExStyle: The extended window style of the window being created.			SCALEBITMAPWINDOWCLASSNAME, // lpClassName: Pointer to a null-terminated string or a class atom			"ScaleSlopeBitmap", // lpWindowName: Pointer to a null-terminated string that specifies the window name
开发者ID:AuditoryBiophysicsLab,项目名称:ESME-Workbench,代码行数:67,


示例29: CreateGLWindow

BOOL CreateGLWindow(char* title, int width, int height, int bits, BOOL fullscreenflag){	GLuint		PixelFormat;			// Holds The Results After Searching For A Match	WNDCLASS	wc;						// Windows Class Structure	DWORD		dwExStyle;				// Window Extended Style	DWORD		dwStyle;				// Window Style	RECT		WindowRect;				// Grabs Rectangle Upper Left / Lower Right Values	WindowRect.left=(long)0;			// Set Left Value To 0	WindowRect.right=(long)width;		// Set Right Value To Requested Width	WindowRect.top=(long)0;				// Set Top Value To 0	WindowRect.bottom=(long)height;		// Set Bottom Value To Requested Height	fullscreen=fullscreenflag;			// Set The Global Fullscreen Flag	hInstance			= GetModuleHandle(NULL);				// Grab An Instance For Our Window	wc.style			= CS_HREDRAW | CS_VREDRAW | CS_OWNDC;	// Redraw On Size, And Own DC For Window.	wc.lpfnWndProc		= (WNDPROC) WndProc;					// WndProc Handles Messages	wc.cbClsExtra		= 0;									// No Extra Window Data	wc.cbWndExtra		= 0;									// No Extra Window Data	wc.hInstance		= hInstance;							// Set The Instance	wc.hIcon			= LoadIcon(NULL, IDI_WINLOGO);			// Load The Default Icon	wc.hCursor			= LoadCursor(NULL, IDC_ARROW);			// Load The Arrow Pointer	wc.hbrBackground	= NULL;									// No Background Required For GL	wc.lpszMenuName		= NULL;									// We Don't Want A Menu	wc.lpszClassName	= "OpenGL";								// Set The Class Name	EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &DMsaved); // save the current display state (NEW)	if (fullscreen)												// Attempt Fullscreen Mode?	{		DEVMODE dmScreenSettings;								// Device Mode		memset(&dmScreenSettings,0,sizeof(dmScreenSettings));	// Makes Sure Memory's Cleared		dmScreenSettings.dmSize=sizeof(dmScreenSettings);		// Size Of The Devmode Structure		dmScreenSettings.dmPelsWidth	= width;				// Selected Screen Width		dmScreenSettings.dmPelsHeight	= height;				// Selected Screen Height		dmScreenSettings.dmBitsPerPel	= bits;					// Selected Bits Per Pixel		dmScreenSettings.dmFields=DM_BITSPERPEL|DM_PELSWIDTH|DM_PELSHEIGHT;		// Try To Set Selected Mode And Get Results.  NOTE: CDS_FULLSCREEN Gets Rid Of Start Bar.		if (ChangeDisplaySettings(&dmScreenSettings,CDS_FULLSCREEN)!=DISP_CHANGE_SUCCESSFUL)		{			// If The Mode Fails, Offer Two Options.  Quit Or Use Windowed Mode.			if (MessageBox(NULL,"The Requested Fullscreen Mode Is Not Supported By/nYour Video Card. Use Windowed Mode Instead?","NeHe GL",MB_YESNO|MB_ICONEXCLAMATION)==IDYES)			{				fullscreen=FALSE;		// Windowed Mode Selected.  Fullscreen = FALSE			}			else			{				// Pop Up A Message Box Letting User Know The Program Is Closing.				MessageBox(NULL,"Program Will Now Close.","ERROR",MB_OK|MB_ICONSTOP);				return FALSE;									// Return FALSE			}		}	}	if (!RegisterClass(&wc))									// Attempt To Register The Window Class	{		MessageBox(NULL,"Failed To Register The Window Class.","ERROR",MB_OK|MB_ICONEXCLAMATION);		return FALSE;											// Return FALSE	}	if (fullscreen)												// Are We Still In Fullscreen Mode?	{		dwExStyle=WS_EX_APPWINDOW;								// Window Extended Style		dwStyle=WS_POPUP;										// Windows Style		ShowCursor(FALSE);										// Hide Mouse Pointer	}	else	{		dwExStyle=WS_EX_APPWINDOW | WS_EX_WINDOWEDGE;			// Window Extended Style		dwStyle=WS_OVERLAPPEDWINDOW;							// Windows Style	}	AdjustWindowRectEx(&WindowRect, dwStyle, FALSE, dwExStyle);		// Adjust Window To True Requested Size	// Create The Window	if (!(hWnd=CreateWindowEx(	dwExStyle,							// Extended Style For The Window								"OpenGL",							// Class Name								title,								// Window Title								dwStyle |							// Defined Window Style								WS_CLIPSIBLINGS |					// Required Window Style								WS_CLIPCHILDREN,					// Required Window Style								0, 0,								// Window Position								WindowRect.right-WindowRect.left,	// Calculate Window Width								WindowRect.bottom-WindowRect.top,	// Calculate Window Height								NULL,								// No Parent Window								NULL,								// No Menu								hInstance,							// Instance								NULL)))								// Dont Pass Anything To WM_CREATE	{		KillGLWindow();								// Reset The Display		MessageBox(NULL,"Window Creation Error.","ERROR",MB_OK|MB_ICONEXCLAMATION);		return FALSE;								// Return FALSE	}    pfd.cColorBits = bits;    if (!(hDC=GetDC(hWnd)))                         // Did We Get A Device Context?	{		KillGLWindow();								// Reset The Display//.........这里部分代码省略.........
开发者ID:thierrydechaize,项目名称:NeHe_Lesson28,代码行数:101,


示例30: Button_WndProc

//.........这里部分代码省略.........			bct->hIcon = NULL;			bct->hBitmap = (HBITMAP)lParam;			InvalidateRect(bct->hwnd, NULL, TRUE);		}		else if (wParam == NULL && lParam == NULL) {			bct->hIcon = NULL;			bct->hBitmap = NULL;			InvalidateRect(bct->hwnd, NULL, TRUE);		}		break;	case BM_SETCHECK:		if (!(bct->dwStyle & MBS_PUSHBUTTON)) break;		if (wParam == BST_CHECKED) {			bct->pbState = 1;			bct->stateId = PBS_PRESSED;		}		else if (wParam == BST_UNCHECKED) {			bct->pbState = 0;			bct->stateId = PBS_NORMAL;		}		InvalidateRect(bct->hwnd, NULL, TRUE);		break;	case BM_GETCHECK:		if (bct->dwStyle & MBS_PUSHBUTTON) return bct->pbState ? BST_CHECKED : BST_UNCHECKED;		return 0;	case BUTTONSETDEFAULT:		bct->defbutton = (wParam != 0);		InvalidateRect(bct->hwnd, NULL, TRUE);		break;	case BUTTONADDTOOLTIP:		if (wParam) {						EnterCriticalSection(&csTips);			if (!hwndToolTips)				hwndToolTips = CreateWindowEx(WS_EX_TOPMOST, TOOLTIPS_CLASS, NULL, WS_POPUP, 0, 0, 0, 0, NULL, NULL, GetModuleHandle(NULL), NULL);			if (lParam == MBBF_UNICODE) {				TOOLINFOW ti;				ZeroMemory(&ti, sizeof(TOOLINFOW));				ti.cbSize = sizeof(TOOLINFOW);				ti.uFlags = TTF_IDISHWND;				ti.hwnd = bct->hwnd;				ti.uId = (UINT_PTR)bct->hwnd;				if (SendMessage(hwndToolTips, TTM_GETTOOLINFOW, 0, (LPARAM)&ti)) {					SendMessage(hwndToolTips, TTM_DELTOOLW, 0, (LPARAM)&ti);				}				ti.uFlags = TTF_IDISHWND|TTF_SUBCLASS;				ti.uId = (UINT_PTR)bct->hwnd;				ti.lpszText=(LPWSTR)wParam;				SendMessage(hwndToolTips, TTM_ADDTOOLW, 0, (LPARAM)&ti);			}			else {				TOOLINFOA ti;				ZeroMemory(&ti, sizeof(TOOLINFOA));				ti.cbSize = sizeof(TOOLINFOA);				ti.uFlags = TTF_IDISHWND;				ti.hwnd = bct->hwnd;				ti.uId = (UINT_PTR)bct->hwnd;				if (SendMessage(hwndToolTips, TTM_GETTOOLINFOA, 0, (LPARAM)&ti)) {					SendMessage(hwndToolTips, TTM_DELTOOLA, 0, (LPARAM)&ti);				}				ti.uFlags = TTF_IDISHWND|TTF_SUBCLASS;				ti.uId = (UINT_PTR)bct->hwnd;				ti.lpszText=(LPSTR)wParam;				SendMessage(hwndToolTips, TTM_ADDTOOLA, 0, (LPARAM)&ti);
开发者ID:MrtsComputers,项目名称:miranda-ng,代码行数:67,



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


C++ CreateWindowExA函数代码示例
C++ CreateWindowA函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。