【windows程序设计】系列02:显示屏幕分辨率
2012-11-28 13:21
489 查看
#include <windows.h> #include <tchar.h> #include <stdio.h> int CDECL MessageBoxPrintf (TCHAR * szCaption, TCHAR * szFormat, ...) { TCHAR szBuffer [1024] ; va_list pArgList ; // The va_start macro (defined in STDARG.H) is usually equivalent to: // pArgList = (char *) &szFormat + sizeof (szFormat) ; va_start (pArgList, szFormat) ;// 得到第一个可变参数地址 // The last argument to wvsprintf points to the arguments _vsntprintf (szBuffer, sizeof (szBuffer) / sizeof (TCHAR), szFormat, pArgList) ; // The va_end macro just zeroes out pArgList for no good reason va_end (pArgList) ; return MessageBox (NULL, szBuffer, szCaption, 0) ; } int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow) { int cxScreen, cyScreen ; cxScreen = GetSystemMetrics (SM_CXSCREEN) ;//以像素为单位的屏幕尺寸 cyScreen = GetSystemMetrics (SM_CYSCREEN) ; MessageBoxPrintf (TEXT ("ScrnSize"), TEXT ("The screen is %i pixels wide by %i pixels high."), cxScreen, cyScreen) ; return 0 ; }
相关文章推荐
- Windows屏幕广播编程技术系列一
- [C# 开发技巧系列]如何动态设置屏幕分辨率
- Webview--如何让加载进来的页面自适应手机屏幕分辨率居中显示
- Windows程序设计:位图的显示
- VGA分辨率无法识别或错误通过添加自定义配置参数正确显示(Ubuntu/Windows)
- 如何得到屏幕和可用显示区域的大小尺寸及运用分辨率无关的编程
- Android文档学习02_屏幕分辨率
- 显示屏幕分辨率
- Android文档学习02_屏幕分辨率
- Windows 8.1 为了适应更高分辨率的屏幕,具体做了哪些改进?
- [C# 开发技巧系列]如何动态设置屏幕分辨率
- win32汇编窗口程序设计[05]-获取屏幕分辨率
- 如何让windows上的两个屏幕显示不同页面
- 【windows程序设计】系列04:文本输出
- JS-009-屏幕分辨率、浏览器显示区域、元素位置获取
- Direct3D成长日记(02):显示三角形(屏幕坐标)
- 自定义RatingBar,不同分辨率屏幕下图片拉伸或者显示不完整问题解决
- python2.x系列在windows控制台显示中文的问题
- 在显示opengl三维场景的屏幕上也就是windows窗体上画线
- Webview--如何让加载进来的页面自适应手机屏幕分辨率居中显示