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

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

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

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

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

示例1: WndProc

LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam){    static CHOOSEFONT cf ;    static int        iPage ;    static LOGFONT    lf ;    HDC               hdc ;    int               cxChar, cyChar, x, y, i, cxLabels ;    PAINTSTRUCT       ps ;    SIZE              size ;    TCHAR             szBuffer [8] ;    TEXTMETRIC        tm ;    WCHAR             ch ;    switch (message)    {    case WM_CREATE:        hdc = GetDC (hwnd) ;        lf.lfHeight = - GetDeviceCaps (hdc, LOGPIXELSY) / 6 ;  // 12 points        lstrcpy (lf.lfFaceName, TEXT ("Lucida Sans Unicode")) ;        ReleaseDC (hwnd, hdc) ;        cf.lStructSize = sizeof (CHOOSEFONT) ;        cf.hwndOwner   = hwnd ;        cf.lpLogFont   = &lf ;        cf.Flags       = CF_INITTOLOGFONTSTRUCT | CF_SCREENFONTS ;        SetScrollRange (hwnd, SB_VERT, 0, 255, FALSE) ;        SetScrollPos   (hwnd, SB_VERT, iPage,  TRUE ) ;        return 0 ;    case WM_COMMAND:        switch (LOWORD (wParam))        {        case IDM_FONT:            if (ChooseFont (&cf))                InvalidateRect (hwnd, NULL, TRUE) ;            return 0 ;        }        return 0 ;    case WM_VSCROLL:        switch (LOWORD (wParam))        {        case SB_LINEUP:            iPage -=  1 ;            break ;        case SB_LINEDOWN:            iPage +=  1 ;            break ;        case SB_PAGEUP:            iPage -= 16 ;            break ;        case SB_PAGEDOWN:            iPage += 16 ;            break ;        case SB_THUMBPOSITION:            iPage = HIWORD (wParam) ;            break ;        default:            return 0 ;        }        iPage = max (0, min (iPage, 255)) ;        SetScrollPos (hwnd, SB_VERT, iPage, TRUE) ;        InvalidateRect (hwnd, NULL, TRUE) ;        return 0 ;    case WM_PAINT:        hdc = BeginPaint (hwnd, &ps) ;        SelectObject (hdc, CreateFontIndirect (&lf)) ;        GetTextMetrics (hdc, &tm) ;        cxChar = tm.tmMaxCharWidth ;        cyChar = tm.tmHeight + tm.tmExternalLeading ;        cxLabels = 0 ;        for (i = 0 ; i < 16 ; i++)        {            wsprintf (szBuffer, TEXT (" 000%1X: "), i) ;            GetTextExtentPoint (hdc, szBuffer, 7, &size) ;            cxLabels = max (cxLabels, size.cx) ;        }        for (y = 0 ; y < 16 ; y++)        {            wsprintf (szBuffer, TEXT (" %03X_: "), 16 * iPage + y) ;            TextOut (hdc, 0, y * cyChar, szBuffer, 7) ;            for (x = 0 ; x < 16 ; x++)            {                ch = (WCHAR) (256 * iPage + 16 * y + x) ;                TextOutW (hdc, x * cxChar + cxLabels,                          y * cyChar, &ch, 1);            }        }//.........这里部分代码省略.........
开发者ID:joway,项目名称:WindowsProgrammingNotes,代码行数:101,


示例2: glutGameModeString

void GLUTAPIENTRYglutGameModeString(const char *string){  Criterion *criteria;  int ncriteria[4], requestedMask, queries = 1;#if _WIN32  int bpp, width, height, hertz, n;#endif  initGameModeSupport();#if _WIN32  XHDC = GetDC(GetDesktopWindow());  bpp = GetDeviceCaps(XHDC, BITSPIXEL);  /* Note that Windows 95 and 98 systems always return zero     for VREFRESH so be prepared to ignore values of hertz     that are too low. */  hertz = GetDeviceCaps(XHDC, VREFRESH);  width = GetSystemMetrics(SM_CXSCREEN);  height = GetSystemMetrics(SM_CYSCREEN);#endif  criteria = parseGameModeString(string, &ncriteria[0], &requestedMask);#if _WIN32  /* Build an extra set of default queries.  If no pixel depth is     explicitly specified, prefer a display mode that doesn't change     the display mode.  Likewise for the width and height.  Likewise for     the display frequency. */  n = ncriteria[0];  if (!(requestedMask & (1 << DM_PIXEL_DEPTH))) {    criteria[n].capability = DM_PIXEL_DEPTH;    criteria[n].comparison = EQ;    criteria[n].value = bpp;    n += 1;    ncriteria[queries] = n;    queries++;  }  if (!(requestedMask & ((1<<DM_WIDTH) | (1<<DM_HEIGHT)) )) {    criteria[n].capability = DM_WIDTH;    criteria[n].comparison = EQ;    criteria[n].value = width;    criteria[n].capability = DM_HEIGHT;    criteria[n].comparison = EQ;    criteria[n].value = height;    n += 2;    ncriteria[queries] = n;    queries++;  }  /* Assume a display frequency of less than 50 is to be ignored. */  if (hertz >= 50) {    if (!(requestedMask & (1 << DM_HERTZ))) {      criteria[n].capability = DM_HERTZ;      criteria[n].comparison = EQ;      criteria[n].value = hertz;      n += 1;      ncriteria[queries] = n;      queries++;    }  }#endif  /* Perform multiple queries until one succeeds or no more queries. */  do {    queries--;    currentDm = findMatch(dmodes, ndmodes, criteria, ncriteria[queries]);  } while((currentDm == NULL) && (queries > 0));  free(criteria);}
开发者ID:ghub,项目名称:NVprSDK,代码行数:68,


示例3: memset

	void PropSheet::Show(HINSTANCE hInstance, HWND hParent, std::string title, int startpage, bool floating, bool wizard)	{			HPROPSHEETPAGE *pages = new HPROPSHEETPAGE[list.size()];		PROPSHEETPAGE page;		//common settings		memset((void*)&page,0,sizeof(PROPSHEETPAGE));		page.dwSize = sizeof(PROPSHEETPAGE);		page.hInstance = hInstance;		int i=0;		for (DlgList::iterator iter = list.begin(); iter != list.end(); iter++, i++)		{			if (wizard)			{				if (i == 0 || i == list.size()-1)					page.dwFlags = PSP_HIDEHEADER;				else					page.dwFlags = PSP_USEHEADERTITLE|PSP_USEHEADERSUBTITLE;			}			else			{				page.dwFlags = PSP_USETITLE;			}			page.pszTemplate = iter->resource;			page.pfnDlgProc = Tab::TabDlgProc;			page.pszTitle = iter->title;			page.pszHeaderTitle = wizard?iter->title:0;			page.pszHeaderSubTitle = wizard?iter->hdrSubTitle:0;			page.lParam = (LPARAM)iter->tab;			pages[i] = CreatePropertySheetPage(&page);		}		PROPSHEETHEADER sheet;		memset(&sheet,0,sizeof(sheet));		sheet.dwSize = sizeof(PROPSHEETHEADER);		sheet.hInstance = hInstance;		sheet.hwndParent = hParent;		sheet.pszbmWatermark = watermark;		sheet.pszbmHeader = header;				if (icon)			sheet.hIcon = icon;		if (wizard)			sheet.dwFlags = PSH_USECALLBACK | PSH_WIZARD97 | (watermark?PSH_WATERMARK:0) | (header?PSH_HEADER:0);		else			sheet.dwFlags = PSH_USECALLBACK | PSH_PROPTITLE;		if (floating)			sheet.dwFlags |= PSH_MODELESS;		//else		//	sheet.dwFlags |= PSH_NOAPPLYNOW;		if (icon) 			sheet.dwFlags |= PSH_USEHICON;		sheet.pszCaption = ConvertUTF8ToWString(title).c_str();		sheet.nPages = (UINT)list.size();		sheet.phpage = pages;		sheet.nStartPage = startpage;		sheet.pfnCallback = (PFNPROPSHEETCALLBACK)Callback;				if (wizard)		{			NONCLIENTMETRICS ncm = {0};			ncm.cbSize = sizeof(ncm);			SystemParametersInfo(SPI_GETNONCLIENTMETRICS, 0, &ncm, 0);			//Create the intro/end title font			LOGFONT TitleLogFont = ncm.lfMessageFont;			TitleLogFont.lfWeight = FW_BOLD;			lstrcpy(TitleLogFont.lfFaceName, TEXT("Verdana Bold"));			//StringCchCopy(TitleLogFont.lfFaceName, 32, TEXT("Verdana Bold"));			HDC hdc = GetDC(NULL); //gets the screen DC			INT FontSize = 12;			TitleLogFont.lfHeight = 0 - GetDeviceCaps(hdc, LOGPIXELSY) * FontSize / 72;			hTitleFont = CreateFontIndirect(&TitleLogFont);			ReleaseDC(NULL, hdc);		}		else			hTitleFont = 0;		centered=false;		PropertySheet(&sheet);		if (!floating)		{			for (DlgList::iterator iter = list.begin(); iter != list.end(); iter++)			{				delete iter->tab;			}			DeleteObject(hTitleFont);		}		delete [] pages;	}
开发者ID:18859966862,项目名称:ppsspp,代码行数:95,


示例4: winQueryRGBBitsAndMasks

staticBoolwinQueryRGBBitsAndMasks (ScreenPtr pScreen){  winScreenPriv(pScreen);  BITMAPINFOHEADER	*pbmih = NULL;  Bool			fReturn = TRUE;  LPDWORD		pdw = NULL;  DWORD			dwRedBits, dwGreenBits, dwBlueBits;  /* Color masks for 8 bpp are standardized */  if (GetDeviceCaps (pScreenPriv->hdcScreen, RASTERCAPS) & RC_PALETTE)    {      /*        * RGB BPP for 8 bit palletes is always 8       * and the color masks are always 0.       */      pScreenPriv->dwBitsPerRGB = 8;      pScreenPriv->dwRedMask = 0x0L;      pScreenPriv->dwGreenMask = 0x0L;      pScreenPriv->dwBlueMask = 0x0L;      return TRUE;    }  /* Color masks for 24 bpp are standardized */  if (GetDeviceCaps (pScreenPriv->hdcScreen, PLANES)      * GetDeviceCaps (pScreenPriv->hdcScreen, BITSPIXEL) == 24)    {      ErrorF ("winQueryRGBBitsAndMasks - GetDeviceCaps (BITSPIXEL) "	      "returned 24 for the screen.  Using default 24bpp masks./n");      /* 8 bits per primary color */      pScreenPriv->dwBitsPerRGB = 8;      /* Set screen privates masks */      pScreenPriv->dwRedMask = WIN_24BPP_MASK_RED;      pScreenPriv->dwGreenMask = WIN_24BPP_MASK_GREEN;      pScreenPriv->dwBlueMask = WIN_24BPP_MASK_BLUE;            return TRUE;    }  /* Allocate a bitmap header and color table */  pbmih = (BITMAPINFOHEADER*) malloc (sizeof (BITMAPINFOHEADER)				      + 256  * sizeof (RGBQUAD));  if (pbmih == NULL)    {      ErrorF ("winQueryRGBBitsAndMasks - malloc failed/n");      return FALSE;    }  /* Get screen description */  if (winQueryScreenDIBFormat (pScreen, pbmih))    {      /* Get a pointer to bitfields */      pdw = (DWORD*) ((CARD8*)pbmih + sizeof (BITMAPINFOHEADER));      #if CYGDEBUG      winDebug ("%s - Masks: %08x %08x %08x/n", __FUNCTION__,	      pdw[0], pdw[1], pdw[2]);      winDebug ("%s - Bitmap: %dx%d %d bpp %d planes/n", __FUNCTION__,              pbmih->biWidth, pbmih->biHeight, pbmih->biBitCount, pbmih->biPlanes);      winDebug ("%s - Compression: %d %s/n", __FUNCTION__,              pbmih->biCompression,              (pbmih->biCompression == BI_RGB?"(BI_RGB)":               (pbmih->biCompression == BI_RLE8?"(BI_RLE8)":                (pbmih->biCompression == BI_RLE4?"(BI_RLE4)":                 (pbmih->biCompression == BI_BITFIELDS?"(BI_BITFIELDS)":""                 )))));#endif      /* Handle BI_RGB case, which is returned by Wine */      if (pbmih->biCompression == BI_RGB)        {	  dwRedBits = 5;	  dwGreenBits = 5;	  dwBlueBits = 5;	  	  pScreenPriv->dwBitsPerRGB = 5;	  	  /* Set screen privates masks */	  pScreenPriv->dwRedMask = 0x7c00;	  pScreenPriv->dwGreenMask = 0x03e0;	  pScreenPriv->dwBlueMask = 0x001f;        }      else         {          /* Count the number of bits in each mask */          dwRedBits = winCountBits (pdw[0]);          dwGreenBits = winCountBits (pdw[1]);          dwBlueBits = winCountBits (pdw[2]);	  /* Find maximum bits per red, green, blue */	  if (dwRedBits > dwGreenBits && dwRedBits > dwBlueBits)	    pScreenPriv->dwBitsPerRGB = dwRedBits;	  else if (dwGreenBits > dwRedBits && dwGreenBits > dwBlueBits)	    pScreenPriv->dwBitsPerRGB = dwGreenBits;	  else	    pScreenPriv->dwBitsPerRGB = dwBlueBits;//.........这里部分代码省略.........
开发者ID:OpenInkpot-archive,项目名称:iplinux-xorg-server,代码行数:101,


示例5: LConProc

LRESULT CALLBACK LConProc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam){	HWND view;	HDC hdc;	HBRUSH hbr;	HGDIOBJ oldfont;	RECT rect;	int titlelen;	SIZE size;	LOGFONT lf;	TEXTMETRIC tm;	HINSTANCE inst = (HINSTANCE)(LONG_PTR)GetWindowLongPtr(hWnd, GWLP_HINSTANCE);	DRAWITEMSTRUCT *drawitem;	CHARFORMAT2W format;	switch (msg)	{	case WM_CREATE:		// Create game title static control		memset (&lf, 0, sizeof(lf));		hdc = GetDC (hWnd);		lf.lfHeight = -MulDiv(12, GetDeviceCaps(hdc, LOGPIXELSY), 72);		lf.lfCharSet = ANSI_CHARSET;		lf.lfWeight = FW_BOLD;		lf.lfPitchAndFamily = VARIABLE_PITCH | FF_ROMAN;		strcpy (lf.lfFaceName, "Trebuchet MS");		GameTitleFont = CreateFontIndirect (&lf);		oldfont = SelectObject (hdc, GetStockObject (DEFAULT_GUI_FONT));		GetTextMetrics (hdc, &tm);		DefaultGUIFontHeight = tm.tmHeight;		if (GameTitleFont == NULL)		{			GameTitleFontHeight = DefaultGUIFontHeight;		}		else		{			SelectObject (hdc, GameTitleFont);			GetTextMetrics (hdc, &tm);			GameTitleFontHeight = tm.tmHeight;		}		SelectObject (hdc, oldfont);		// Create log read-only edit control		view = CreateWindowEx (WS_EX_NOPARENTNOTIFY, "RichEdit20W", NULL,			WS_CHILD | WS_VISIBLE | WS_VSCROLL |			ES_LEFT | ES_MULTILINE | WS_CLIPSIBLINGS,			0, 0, 0, 0,			hWnd, NULL, inst, NULL);		HRESULT hr;		hr = GetLastError();		if (view == NULL)		{			ReleaseDC (hWnd, hdc);			return -1;		}		SendMessage (view, EM_SETREADONLY, TRUE, 0);		SendMessage (view, EM_EXLIMITTEXT, 0, 0x7FFFFFFE);		SendMessage (view, EM_SETBKGNDCOLOR, 0, RGB(70,70,70));		// Setup default font for the log.		//SendMessage (view, WM_SETFONT, (WPARAM)GetStockObject (DEFAULT_GUI_FONT), FALSE);		format.cbSize = sizeof(format);		format.dwMask = CFM_BOLD | CFM_COLOR | CFM_FACE | CFM_SIZE | CFM_CHARSET;		format.dwEffects = 0;		format.yHeight = 200;		format.crTextColor = RGB(223,223,223);		format.bCharSet = ANSI_CHARSET;		format.bPitchAndFamily = FF_SWISS | VARIABLE_PITCH;		wcscpy(format.szFaceName, L"DejaVu Sans");	// At least I have it. :p		SendMessageW(view, EM_SETCHARFORMAT, SCF_ALL, (LPARAM)&format);		ConWindow = view;		ReleaseDC (hWnd, hdc);		view = CreateWindowEx (WS_EX_NOPARENTNOTIFY, "STATIC", NULL, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | SS_OWNERDRAW, 0, 0, 0, 0, hWnd, NULL, inst, NULL);		if (view == NULL)		{			return -1;		}		SetWindowLong (view, GWL_ID, IDC_STATIC_TITLE);		GameTitleWindow = view;		return 0;	case WM_SIZE:		if (wParam != SIZE_MAXHIDE && wParam != SIZE_MAXSHOW)		{			LayoutMainWindow (hWnd, ErrorPane);		}		return 0;	case WM_DRAWITEM:		// Draw title banner.		if (wParam == IDC_STATIC_TITLE && DoomStartupInfo.Name.IsNotEmpty())		{			const PalEntry *c;			// Draw the game title strip at the top of the window.			drawitem = (LPDRAWITEMSTRUCT)lParam;//.........这里部分代码省略.........
开发者ID:emileb,项目名称:gzdoom,代码行数:101,


示例6: readscreen

static void readscreen(void){  HDC		hScrDC;		/* screen DC */  HDC		hMemDC;		/* memory DC */  HBITMAP	hBitmap;	/* handle for our bitmap */  HBITMAP	hOldBitmap;	/* handle for previous bitmap */  BITMAP	bm;		/* bitmap properties */  unsigned int	size;		/* size of bitmap */  char		*bmbits;	/* contents of bitmap */  int		w;		/* screen width */  int		h;		/* screen height */  int		y;		/* y-coordinate of screen lines to grab */  int		n = 16;		/* number of screen lines to grab at a time */  /* Create a screen DC and a memory DC compatible to screen DC */  hScrDC = CreateDC("DISPLAY", NULL, NULL, NULL);  hMemDC = CreateCompatibleDC(hScrDC);  /* Get screen resolution */  w = GetDeviceCaps(hScrDC, HORZRES);  h = GetDeviceCaps(hScrDC, VERTRES);  /* Create a bitmap compatible with the screen DC */  hBitmap = CreateCompatibleBitmap(hScrDC, w, n);  /* Select new bitmap into memory DC */  hOldBitmap = SelectObject(hMemDC, hBitmap);  /* Get bitmap properties */  GetObject(hBitmap, sizeof(BITMAP), (LPSTR)&bm);  size = (unsigned int)bm.bmWidthBytes * bm.bmHeight * bm.bmPlanes;  bmbits = OPENSSL_malloc(size);  if (bmbits) {    /* Now go through the whole screen, repeatedly grabbing n lines */    for (y = 0; y < h-n; y += n)    	{	unsigned char md[MD_DIGEST_LENGTH];	/* Bitblt screen DC to memory DC */	BitBlt(hMemDC, 0, 0, w, n, hScrDC, 0, y, SRCCOPY);	/* Copy bitmap bits from memory DC to bmbits */	GetBitmapBits(hBitmap, size, bmbits);	/* Get the hash of the bitmap */	MD(bmbits,size,md);	/* Seed the random generator with the hash value */	RAND_add(md, MD_DIGEST_LENGTH, 0);	}    OPENSSL_free(bmbits);  }  /* Select old bitmap back into memory DC */  hBitmap = SelectObject(hMemDC, hOldBitmap);  /* Clean up */  DeleteObject(hBitmap);  DeleteDC(hMemDC);  DeleteDC(hScrDC);}
开发者ID:jhbsz,项目名称:actiontec_opensource_mi424wr-rev-acd-56-0-10-14-4,代码行数:63,


示例7: GLimp_SetMode

bool GLimp_SetMode(unsigned *pwidth, unsigned *pheight, int mode, bool fullscreen){	int		width, height, colorBits;	if (!Vid_GetModeInfo(&width, &height, mode))	{		appWPrintf("Invalid mode: %d/n", mode);		return false;	}	appPrintf("Mode %d: %dx%d (%s)/n", mode, width, height, fullscreen ? "fullscreen" : "windowed");	// destroy the existing window	if (gl_hWnd)		GLimp_Shutdown(false);	colorBits = gl_bitdepth->integer;	gl_bitdepth->modified = false;	// do a CDS if needed	if (fullscreen)	{		DEVMODE dm;		memset(&dm, 0, sizeof(dm));		dm.dmSize       = sizeof(dm);		dm.dmPelsWidth  = width;		dm.dmPelsHeight = height;		dm.dmFields     = DM_PELSWIDTH|DM_PELSHEIGHT;		if (colorBits)		{			dm.dmBitsPerPel = colorBits;			dm.dmFields |= DM_BITSPERPEL;			appPrintf("...using color depth of %d/n", colorBits);		}		else		{			HDC hdc = GetDC(NULL);			int bitspixel = GetDeviceCaps(hdc, BITSPIXEL);			ReleaseDC(0, hdc);			appPrintf("...using desktop color depth of %d/n", bitspixel);		}		MSGLOG(("CDS(%dx%d, FS)/n", dm.dmPelsWidth, dm.dmPelsHeight));		if (ChangeDisplaySettings(&dm, CDS_FULLSCREEN) != DISP_CHANGE_SUCCESSFUL)		{			appWPrintf("...fullscreen unavailable in this mode/n");			appPrintf("...setting windowed mode/n");			fullscreen = false;			MSGLOG(("CDS(NULL)/n"));			ChangeDisplaySettings(NULL, 0);		}	}	else	// not fullscreen	{		appPrintf("...setting windowed mode/n");		MSGLOG(("CDS(NULL)/n"));		ChangeDisplaySettings(NULL, 0);	}	*pwidth  = width;	*pheight = height;	gl_config.fullscreen = fullscreen;	gl_hWnd = (HWND) Vid_CreateWindow(width, height, fullscreen);	if (!gl_hWnd) return false;	if (!GLimp_InitGL()) return false;	//?? may try to DestroyWindow(force) + CreateWindow() again	// init gamma	ReadGamma();	appPrintf("Gamma: %s/n", gammaStored ? "hardware" : "software");	return true;}
开发者ID:RkShaRkz,项目名称:Quake2,代码行数:75,


示例8: Sys_CreateConsole

/*** Sys_CreateConsole*/void Sys_CreateConsole( void ){	HDC hDC;	WNDCLASS wc;	RECT rect;	const char *DEDCLASS = "JK2MP WinConsole";	int nHeight;	int swidth, sheight;	int DEDSTYLE = WS_POPUPWINDOW | WS_CAPTION | WS_MINIMIZEBOX;	memset( &wc, 0, sizeof( wc ) );	wc.style         = 0;	wc.lpfnWndProc   = (WNDPROC) ConWndProc;	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 = (HBRUSH__ *)COLOR_INACTIVEBORDER;//(HBRUSH__ *)COLOR_WINDOW;	wc.lpszMenuName  = 0;	wc.lpszClassName = DEDCLASS;	if ( !RegisterClass (&wc) ) {		return;	}	rect.left = 0;	rect.right = 600;	rect.top = 0;	rect.bottom = 450;	AdjustWindowRect( &rect, DEDSTYLE, FALSE );	hDC = GetDC( GetDesktopWindow() );	swidth = GetDeviceCaps( hDC, HORZRES );	sheight = GetDeviceCaps( hDC, VERTRES );	ReleaseDC( GetDesktopWindow(), hDC );	s_wcd.windowWidth = rect.right - rect.left + 1;	s_wcd.windowHeight = rect.bottom - rect.top + 1;	s_wcd.hWnd = CreateWindowEx( 0,							   DEDCLASS,							   "OpenJK Singleplayer Console",							   DEDSTYLE,							   ( swidth - 600 ) / 2, ( sheight - 450 ) / 2 , rect.right - rect.left + 1, rect.bottom - rect.top + 1,							   NULL,							   NULL,							   g_wv.hInstance,							   NULL );	if ( s_wcd.hWnd == NULL )	{		return;	}	//	// create fonts	//	hDC = GetDC( s_wcd.hWnd );	nHeight = -MulDiv( 8, GetDeviceCaps( hDC, LOGPIXELSY), 72);	s_wcd.hfBufferFont = CreateFont( nHeight,									  0,									  0,									  0,									  FW_LIGHT,									  0,									  0,									  0,									  DEFAULT_CHARSET,									  OUT_DEFAULT_PRECIS,									  CLIP_DEFAULT_PRECIS,									  DEFAULT_QUALITY,									  FF_MODERN | FIXED_PITCH,									  "Consolas" );	ReleaseDC( s_wcd.hWnd, hDC );	//	// create the input line	//	s_wcd.hwndInputLine = CreateWindow( "edit", NULL, WS_CHILD | WS_VISIBLE | WS_BORDER | 												ES_LEFT | ES_AUTOHSCROLL | WS_TABSTOP,												6, 400, s_wcd.windowWidth-20, 20,												s_wcd.hWnd, 												( HMENU ) INPUT_ID,	// child window ID												g_wv.hInstance, NULL );	//	// create the buttons	//	s_wcd.hwndButtonCopy = CreateWindow( "button", NULL, BS_PUSHBUTTON | WS_VISIBLE | WS_CHILD | BS_DEFPUSHBUTTON,												5, 425, 72, 24,												s_wcd.hWnd, 												( HMENU ) COPY_ID,	// child window ID												g_wv.hInstance, NULL );//.........这里部分代码省略.........
开发者ID:Razish,项目名称:OpenJK-Speed,代码行数:101,


示例9: VersionProc

LRESULT CALLBACK VersionProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam){  switch (message)  {  case WM_INITDIALOG:    {      HWND h = GetDlgItem(hDlg,IDC_DEVICEINFO);      std::string buf;      buf += "* * * * * * * */r/n";      buf += "* ディスプレイ情
C++ GetDeviceGammaRamp函数代码示例
C++ GetDesignSettings函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。