Windows API SystemParametersInfo函數

來源:互聯網
上載者:User
面對華麗的Windows案頭,工作的心情或許好很多,但是久了總會失去興趣,總想定期地更新案頭的圖片。軟體開發人員又面對這樣的需求了,需要怎麼樣去做呢?努力去找API函數吧。到目前為止,還有很多變案頭圖片的軟體,並且還能很掙錢的。其實設定案頭圖片的需求,在目前數位相片處理軟體也有現實的需求,比如當你去旅遊回來後,想把照片當作案頭圖片,就可以在處理圖片時就設定為案頭圖片。這樣就需要使用函數SystemParametersInfo來完成這項工作了,當然這個函數還有很多其它功能,比如擷取案頭工作區的大小。 函數SystemParametersInfo聲明如下:WINUSERAPIBOOLWINAPISystemParametersInfoA(    __in UINT uiAction,    __in UINT uiParam,    __inout_opt PVOID pvParam,    __in UINT fWinIni);WINUSERAPIBOOLWINAPISystemParametersInfoW(    __in UINT uiAction,    __in UINT uiParam,    __inout_opt PVOID pvParam,    __in UINT fWinIni);#ifdef UNICODE#define SystemParametersInfo SystemParametersInfoW#else#define SystemParametersInfo SystemParametersInfoA#endif // !UNICODE  uiAction是作不同的巨集指令引數。 uiParam是設定的參數。 pvParam是設定或返回的參數。 fWinIni是設定的參數。 調用函數的例子如下:#001 //#002  //擷取系統配置資訊。#003  //蔡軍生 2007/11/16 QQ:9073204 深圳#004  void GetSystemParam(void)#005  {#006         //擷取案頭牆紙的路徑。#007         //SPI_GETDESKWALLPAPER#008         TCHAR chPath[MAX_PATH]; #009        if (SystemParametersInfo(SPI_GETDESKWALLPAPER,MAX_PATH,chPath,0))#010         {#011               //#012               OutputDebugString(chPath);#013               OutputDebugString(_T(""r"n"));#014         }#015 #016         //擷取工作區的大小。#017         //SPI_GETWORKAREA#018         RECT rcWorkArea; #019        if (SystemParametersInfo(SPI_GETWORKAREA,0,&rcWorkArea,0))#020         {#021               //#022               const int nBufSize = 256;#023               TCHAR chBuf[nBufSize];#024 #025               wsprintf(chBuf,_T("%u,%u,%u,%u"),rcWorkArea.left,rcWorkArea.top,#026                    rcWorkArea.right,rcWorkArea.bottom);#027               #028               OutputDebugString(chBuf);#029               OutputDebugString(_T(""r"n"));#030         }#031 

#032  }

 

delphi 代碼

var rcWorkArea: TRect;

begin

  SystemParametersInfo(SPI_GETWORKAREA,0, Pointer(@rcWorkArea), 0);

  szTmp1 := Format( 'Left: %d top: %d  Right: %d bottom: %d ',
           [rcWorkArea.Left, rcWorkArea.Top, rcWorkArea.Right, rcWorkArea.Bottom]);

  Caption := szTmp1;

end;

 

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.