ºìÁªLinuxÃÅ»§
Linux°ïÖú

ÓÃC++ Builder¼ì²âWindowsµÄÆô¶¯Ä£Ê½

·¢²¼Ê±¼ä:2006-05-03 12:19:41À´Ô´:ºìÁª×÷Õß:°®µÄ±ßÔµ
Windows 95/98µÄÆô¶¯Ä£Ê½¿ÉÒÔ·ÖΪÕý³£Ä£Ê½ºÍ°²È«Ä£Ê½£¬ÔÚ°²È«Ä£Ê½Ï£¬Óкܶ๦Äܱ»ÏÞÖÆʹÓ㬱ÈÈç¶àýÌ幦ÄÜ¡¢ÍøÂ繦Äܵȡ£ÓÐʱ£¬ÎÒÃDZàдµÄ³ÌÐòÕýºÃÐèÒªÕâЩ±»ÏÞÖƵŦÄÜ£¬Òò´ËÎÒÃÇÏ£Íûµ±³ÌÐòÔËÐÐʱÄÜ×Ô¶¯¼ì²âµ±Ç°WindowsËù´¦µÄÆô¶¯Ä£Ê½ÊDz»ÊÇ°²È«Ä£Ê½£¬ÒÔÈ·¶¨ÊÇ·ñ¼ÌÐøÔËÐгÌÐò¡£

ÄÇôÈçºÎÔÚC++ Builder³ÌÐòÖмì²âµ±Ç°µÄWindowsÊÇÒÔÕý³£Ä£Ê½»¹ÊÇ°²È«Ä£Ê½Æô¶¯µÄ£¿ÕâÐèҪʹÓõ½APIº¯ÊýGetSystemMetricsÀ´½øÐмì²â¡£ APIº¯ÊýGetSystemMetrics¿ÉÒÔÈ¡µÃWindowsµÄһЩÅäÖÃÐÅÏ¢£¬±ÈÈ磬Êó±êµÄ°´¼üÊý¡¢´°ÌåµÄ±ß½ç¿í¶È£¬ËüÒ²¿ÉÒÔ²âµÃµ±Ç° WindowsËù´¦µÄÆô¶¯Ä£Ê½¡£

ÔÚWindows APIÖУ¬¸Ãº¯ÊýµÄ¶¨ÒåÈçÏ£º

int GetSystemMetrics( int nIndex );

ÆäÖвÎÊýnIndexµÄÈ¡ÖµºÜ¶à£¬Èç¹ûÖ»Ïë¼ì²âWindowsµÄÆô¶¯Ä£Ê½£¬Ö»ÒªÈ¡²ÎÊýֵΪSM_CLEANBOOT¼´¿É£¬¸ÃÖµ½«È·Èϵ±Ç°µÄWindowsÊÇÒÔºÎÖÖģʽÆô¶¯µÄ¡£ËüµÄ·µ»ØÖµÓÐÈý¸ö£º

0£ºÕý³£Æô¶¯Ä£Ê½£»
1£º°²È«Ä£Ê½Æô¶¯Windows£»
2£ºÒÔ°²È«Ä£Ê½Æô¶¯£¬µ«ÊÇÓµÓÐÍøÂ繦ÄÜ¡£

ÎÒÃÇ¿ÉÒÔÔÚ³ÌÐòµÄÆðʼ²¿·ÖʹÓøú¯Êý£¬ÈçÏÂÃæµÄʾÀýÖУ¬ÎÒÃǸù¾ÝWindowsÆô¶¯Ä£Ê½µÄ²»Í¬£¬Ó¦ÓóÌÐòÏÔʾ³ö²»Í¬µÄÌáʾÐÅÏ¢£¬Óû§¿ÉÒÔÔÚʵ¼Ê±à³ÌÖоßÌåÌí¼ÓеĴ¦Àí´úÂë¡£



void __fastcall TForm1::Button1Click(TObject *Sender)

{

switch(GetSystemMetrics(SM_CLEANBOOT))

{

case 0:

ShowMessage("Õý³£Ä£Ê½Æô¶¯");

break;

case 1:

ShowMessage("°²È«Ä£Ê½Æô¶¯");

break;

case 2:

ShowMessage("°²È«Ä£Ê½Æô¶¯£¬µ«´øÍøÂ總´ø¹¦ÄÜ");

break;

default:

ShowMessage("´íÎó£¬ÏµÍ³Æô¶¯ÓÐÎÊÌâ¡£");

break;

}

}
ÎÄÕÂÆÀÂÛ

¹²ÓÐ 0 ÌõÆÀÂÛ