VC中的一些常用方法(20条) [转帖][1]

[入库:2005年8月19日] [更新:2007年3月24日]

本文简介:选择自 meteor135 的 blog


vc中的一些常用方法(20条)

//一、打开cd-rom

mcisendstring("set cdaudio door open wait",null,0,null);

//二、关闭cd_rom

mcisendstring("set cdaudio door closed wait",null,0,null);

//三、关闭计算机

osversioninfo osversioninfo; //包含操作系统版本信息的数据结构
osversioninfo.dwosversioninfosize = sizeof(osversioninfo);
getversionex(&osversioninfo); //获取操作系统版本信息
if(osversioninfo.dwplatformid == ver_platform_win32_windows)
{
    //windows98,调用exitwindowsex()函数重新启动计算机
    dword dwreserved;
    exitwindowsex(ewx_reboot,dwreserved); //可以改变第一个参数,实现注销用户、
    //关机、关闭电源等操作
    // 退出前的一些处理程序
}

//四、重启计算机

typedef int (callback *shutdowndlg)(int); //显示关机对话框函数的指针
hinstance hinst = loadlibrary("shell32.dll"); //装入shell32.dll
shutdowndlg shutdowndialog; //指向shell32.dll库中显示关机对话框函数的指针
if(hinst != null)
{
    //获得函数的地址并调用之
    shutdowndialog = (shutdowndlg)getprocaddress(hinst,(lpstr)60);
    
    (*shutdowndialog)(0);
}

//五、枚举所有字体

logfont lf;
lf.lfcharset = default_charset; // initialize the logfont structure
strcpy(lf.lffacename,"");
cclientdc dc (this);
// enumerate the font families
::enumfontfamiliesex((hdc) dc,&lf, (fontenumproc) enumfontfamproc,(lparam) this,0);
//枚举函数
			  
本文关键:VC中的一些常用方法(20条) [转帖]
  相关方案
Google
 

本站最佳浏览方式为 分辨率 1024x768 IE 6.0(或更高版本的 IE浏览器)

go top