• <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

            『站在風口浪尖緊握住鼠標旋轉!』 http://www.cnblogs.com/twzheng

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

            GetSystemInfo

            GetSystemInfo,Win32 API 函數。

            函數說明:
                     GetSystemInfo返回關于當前系統的信息。


            函數原型:

            void GetSystemInfo(
              LPSYSTEM_INFO lpSystemInfo
            );


            參數表:
            lpSystemInfo 
                     [out] 指向一個供函數返回信息的SYSTEM_INFO結構體。

            返回值:

                     這個函數不返回任何值。

            必備條件:

            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 結構體介紹

            示例代碼:

            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 譚文政 閱讀(8630) 評論(3)  編輯 收藏 引用 所屬分類: 網絡編程

            評論

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

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

            說明
            在一個SYSTEM_INFO結構中載入與底層硬件平臺有關的信息

            參數表
            參數 類型及說明

            lpSystemInfo
            SYSTEM_INFO,指定一個結構,用于裝載適當的系統信息



            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;  回復  更多評論
              

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

            漂亮人妻被黑人久久精品| 狠狠色丁香久久综合五月| 久久亚洲精品无码播放| 久久久久人妻一区精品果冻| 无码人妻久久一区二区三区蜜桃| 色8久久人人97超碰香蕉987| 国产成人精品久久亚洲高清不卡| 亚洲精品成人久久久| 久久久久人妻精品一区二区三区| 国产高潮久久免费观看| 久久久久久国产精品无码下载| 久久久久久综合一区中文字幕| 久久精品国产男包| 伊人久久大香线蕉精品| 亚洲va国产va天堂va久久| 久久精品成人免费国产片小草| 久久精品国产亚洲AV麻豆网站 | 91精品国产91久久久久久| 国产精品中文久久久久久久| 人人狠狠综合久久亚洲88| 久久丫精品国产亚洲av| 久久婷婷国产剧情内射白浆| 久久久久亚洲爆乳少妇无| 狠狠色丁香婷婷综合久久来来去 | 国产69精品久久久久9999| 老色鬼久久亚洲AV综合| 伊人久久综合无码成人网| 伊人久久成人成综合网222| 久久久久九国产精品| 国产精品亚洲综合专区片高清久久久| 久久久久无码精品国产不卡| 亚洲国产精品18久久久久久| 99久久精品免费看国产一区二区三区| 亚洲国产天堂久久综合| 天天综合久久一二三区| 伊人 久久 精品| 色婷婷综合久久久中文字幕| 久久亚洲欧美国产精品| 麻豆AV一区二区三区久久| 99国产精品久久| 久久久久亚洲av毛片大|