设置壁纸方法 (C++ Builder)

来源(怡园)

From: http://yynets.best.163.com/cbuilder.htm

设置壁纸方法 (C++ Builder)

通过IActiveDesktop接口来实现

比如设置壁纸,就可以这样

IActiveDesktop *a;
CoInitialize(NULL);
if(SUCCEEDED(CoCreateInstance(
        Shlobj::CLSID_ActiveDesktop,
        NULL,
        CLSCTX_INPROC_SERVER,
        IID_IActiveDesktop,(void **)&a))) {
    WideString c = "C:\\My Documents\\yw2.jpg";
    OleCheck(a->SetWallpaper(c.c_bstr(),0));
    OleCheck(a->ApplyChanges(AD_APPLY_ALL));
    a->Release();
}

CoUninitialize();

其它接口可查看msdn

注意在cpp的第一行加入
#define NO_WIN32_LEAN_AND_MEAN


并要
#include <shlobj.h>

Link: http://www.asm32.net/article_details.aspx?id=1912


浏览次数 446 发布时间 2006-08-25 07:27:15 从属分类 C/C++ 【评论】【 】【打印】【关闭
 
| www.asm32.net | 2006版 | 资料中心 | linux | asm/asm32 | C/C++ | VC++ | java | Python | 书签 | ASP.Net书签 | 京ICP备09029108号-1