how to call other functions from code
ex:automatically log on net from code,play media player....
how to call other functions from code
ex:automatically log on net from code,play media player....
This should be asked in a Windows specific forum -- it's not a C language question.
Agreed - moved.
You can use ShellExecute/Ex to open media (it will open in media player if that is the default player for that file type) or open the player directly.
To change desktop wallpaper (when 'activeDesktop' is enabled):
To use, strPicPath is the path to the image, and flags is either WPSTYLE_CENTER or WPSTYLE_STRETCH. There are more, but I can't remember them for now... You can find them in the docs...Code:#include <shlobj.h>
extern const IID IID_IActiveDesktop = {
0xf490eb00,0x1240,0x11d1, {
0x98,0x88,0x00,0x60,0x97,0xde,0xac,0xf9 }
};
extern const IID CLSID_ActiveDesktop = {
0x75048700,0xef1f,0x11d0, {
0x98,0x88,0x00,0x60,0x97,0xDE,0xac,0xf9 }
};
int changeWallpaper(char *strPicPath, DWORD flags)
{
WCHAR tempstr[MAX_PATH];
char str[255]="";
HRESULT hr;
MultiByteToWideChar(CP_ACP, 0, strPicPath, -1, tempstr, sizeof(tempstr) );
IActiveDesktop *pActiveDesktop;
CoInitialize(NULL);
hr = CoCreateInstance(&CLSID_ActiveDesktop, NULL, CLSCTX_INPROC_SERVER,&IID_IActiveDesktop, (void**)&pActiveDesktop);
if(hr == S_OK ) {
hr = pActiveDesktop->SetWallpaper(tempstr, 0);
if(hr!=S_OK) {
return 0;
}
WALLPAPEROPT wpo;
wpo.dwSize = sizeof(WALLPAPEROPT);
wpo.dwStyle = flags;
pActiveDesktop->SetWallpaperOptions(&wpo,0);
pActiveDesktop->ApplyChanges(AD_APPLY_ALL);
pActiveDesktop->Release();
CoUninitialize();
return TRUE;
}
else {
return FALSE;
}
}
Hope this helps!
Franchie.