• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>

            twzheng's cppblog

            『站在風(fēng)口浪尖緊握住鼠標(biāo)旋轉(zhuǎn)!』 http://www.cnblogs.com/twzheng

              C++博客 :: 首頁 :: 新隨筆 :: 聯(lián)系 :: 聚合  :: 管理 ::
              136 隨筆 :: 78 文章 :: 353 評論 :: 0 Trackbacks

            GetSystemInfo

            GetSystemInfo,Win32 API 函數(shù)。

            函數(shù)說明:
                     GetSystemInfo返回關(guān)于當(dāng)前系統(tǒng)的信息。


            函數(shù)原型:

            void GetSystemInfo(
              LPSYSTEM_INFO lpSystemInfo
            );


            參數(shù)表:
            lpSystemInfo 
                     [out] 指向一個供函數(shù)返回信息的SYSTEM_INFO結(jié)構(gòu)體。

            返回值:

                     這個函數(shù)不返回任何值。

            必備條件:

            Client Requires Windows XP, Windows 2000 Professional, Windows NT Workstation, Windows Me, Windows 98, or Windows 95.
            Server Requires Windows Server 2003, Windows 2000 Server, or Windows NT Server.
            Header

            Declared in Winbase.h; include Windows.h.

            Library

            Link to Kernel32.lib.

            DLL Requires Kernel32.dll.

            其他:

            SYSTEM_INFO 結(jié)構(gòu)體介紹

            示例代碼:

            Getting Hardware Information

            The following examples get or set hardware information.

            Example 1

            The following example uses the GetSystemInfo function to obtain hardware information such as the OEM identifier, processor type, page size, and so on. The example displays the information in the console.

            #include <windows.h>
            #include 
            <stdio.h>

            void main()
            {
               SYSTEM_INFO siSysInfo;
             
               
            // Copy the hardware information to the SYSTEM_INFO structure. 
             
               GetSystemInfo(
            &siSysInfo); 
             
               
            // Display the contents of the SYSTEM_INFO structure. 

               printf(
            "Hardware information: \n");  
               printf(
            "  OEM ID: %u\n", siSysInfo.dwOemId);
               printf(
            "  Number of processors: %u\n"
                  siSysInfo.dwNumberOfProcessors); 
               printf(
            "  Page size: %u\n", siSysInfo.dwPageSize); 
               printf(
            "  Processor type: %u\n", siSysInfo.dwProcessorType); 
               printf(
            "  Minimum application address: %lx\n"
                  siSysInfo.lpMinimumApplicationAddress); 
               printf(
            "  Maximum application address: %lx\n"
                  siSysInfo.lpMaximumApplicationAddress); 
               printf(
            "  Active processor mask: %u\n"
                  siSysInfo.dwActiveProcessorMask); 
            }


            Example 2

            The following example uses the GetSystemMetrics function to determine whether a mouse is installed and whether the mouse buttons are swapped. The example also uses the SystemParametersInfo function to retrieve the mouse threshold and speed. It displays the information in the console.

            #include <windows.h>
            #include 
            <stdio.h>

            void main()
            {
               BOOL fResult;
               
            int aMouseInfo[3];
             
               fResult 
            = GetSystemMetrics(SM_MOUSEPRESENT); 
             
               
            if (fResult == 0
                  printf(
            "No mouse installed.\n"); 
               
            else 
               

                  printf(
            "Mouse installed.\n");

                  
            // Determine whether the buttons are swapped. 

                  fResult 
            = GetSystemMetrics(SM_SWAPBUTTON); 
             
                  
            if (fResult == 0
                     printf(
            "Buttons not swapped.\n"); 
                  
            else printf("Buttons swapped.\n");
             
                  
            // Get the mouse speed and the threshold values. 
             
                  fResult 
            = SystemParametersInfo(
                     SPI_GETMOUSE,  
            // get mouse information 
                     0,             // not used 
                     &aMouseInfo,   // holds mouse information 
                     0);            // not used 

                  
            if( fResult )
                  

                     printf(
            "Speed: %d\n", aMouseInfo[2]); 
                     printf(
            "Threshold (x,y): %d,%d\n"
                        aMouseInfo[
            0], aMouseInfo[1]); 
                  }

               }
             
            }


            Example 3

            The following example uses SystemParametersInfo to double the mouse speed.

            #include <windows.h>
            #include 
            <stdio.h>

            void main()
            {
               BOOL fResult;
               
            int aMouseInfo[3];       // array for mouse information
             
               
            // Get the current mouse speed. 
             
               fResult 
            = SystemParametersInfo(
                  SPI_GETMOUSE,   
            // get mouse information 
                  0,              // not used 
                  &aMouseInfo,    // holds mouse information
                  0);             // not used 
               
               
            // Double it. 
             
               
            if( fResult )
               
            {
                  aMouseInfo[
            2= 2 * aMouseInfo[2]; 
             
                  
            // Change the mouse speed to the new value. 
             
                  SystemParametersInfo(
                     SPI_SETMOUSE,      
            // set mouse information
                     0,                 // not used 
                     aMouseInfo,        // mouse information 
                     SPIF_SENDCHANGE);  // update win.ini 
               }

            }



            參考MSDN.
            posted on 2007-06-02 22:34 譚文政 閱讀(8651) 評論(3)  編輯 收藏 引用 所屬分類: 網(wǎng)絡(luò)編程

            評論

            # re: GetSystemInfo函數(shù)介紹 2007-06-04 13:56 picasa
            很有價值的代碼  回復(fù)  更多評論
              

            # re: GetSystemInfo函數(shù)介紹 2007-06-04 18:16 Bin
            VOID GetSystemInfo(
            LPSYSTEM_INFO lpSystemInfo // address of system information structure
            );

            說明
            在一個SYSTEM_INFO結(jié)構(gòu)中載入與底層硬件平臺有關(guān)的信息

            參數(shù)表
            參數(shù) 類型及說明

            lpSystemInfo
            SYSTEM_INFO,指定一個結(jié)構(gòu),用于裝載適當(dāng)?shù)南到y(tǒng)信息



            typedef struct _SYSTEM_INFO { // sinf
            union {
            DWORD dwOemId;
            struct {
            WORD wProcessorArchitecture;
            WORD wReserved;
            };
            };
            DWORD dwPageSize;
            LPVOID lpMinimumApplicationAddress;
            LPVOID lpMaximumApplicationAddress;
            DWORD dwActiveProcessorMask;
            DWORD dwNumberOfProcessors;
            DWORD dwProcessorType;
            DWORD dwAllocationGranularity;
            WORD wProcessorLevel;
            WORD wProcessorRevision;
            } SYSTEM_INFO;  回復(fù)  更多評論
              

            # re: GetSystemInfo函數(shù)介紹 2008-11-16 15:51 安永輝
            很有代表性 和說明性  回復(fù)  更多評論
              

            精品久久久久久无码中文字幕| 99久久精品国产一区二区| 97久久综合精品久久久综合| 久久天堂电影网| 日本精品一区二区久久久| 久久夜色精品国产噜噜麻豆| 国产精品免费看久久久香蕉| 国产精品成人久久久| 91精品国产色综合久久| 伊色综合久久之综合久久| 99久久久精品| 亚洲中文久久精品无码ww16| 精品久久久久久无码人妻热| 99久久精品国内| 久久免费的精品国产V∧| 久久综合九色综合久99| 久久国产精品成人免费| 亚洲综合伊人久久综合| 久久综合给合综合久久| 亚洲国产精品久久久久网站| 人妻精品久久无码区| 亚洲精品tv久久久久| 狠狠色婷婷综合天天久久丁香 | 久久香蕉国产线看观看99| 久久综合鬼色88久久精品综合自在自线噜噜 | 人妻精品久久久久中文字幕69 | 亚洲AV日韩精品久久久久久 | 久久这里有精品| 精品久久久久久无码中文字幕| 国内精品久久国产大陆| 欧美噜噜久久久XXX| 伊人久久大香线蕉av不卡| 欧美精品九九99久久在观看| 女同久久| 99久久夜色精品国产网站| 综合久久精品色| 久久91精品国产91久| 国内精品伊人久久久影院| 亚洲乱码日产精品a级毛片久久| 久久久久国产精品麻豆AR影院| 欧美久久综合九色综合|