Hello,
i'm trying to use COM to interface with iactivedesktop inorder to change wallpaper on my desktop but i seemed to be having problems converting a WChar to a Char or somthing along thoghts lines.
My code:
the error's i get from my complier are:Code:#include <stdio.h>
#include <Windows.h>
#include <WinInet.h>
#include <ShlObj.h>
#include <iostream>
using namespace std;
int main ()
{
CoInitialize (0) ;
HRESULT hr;
IActiveDesktop *pActiveDesktop;
hr = CoCreateInstance(CLSID_ActiveDesktop, NULL, CLSCTX_INPROC_SERVER,
IID_IActiveDesktop, (void**)&pActiveDesktop);
LPCWSTR FilePath[77];
FilePath = "C:/Documents and Settings/Michael Knights/My Documents/My Pictures/board.bmp";
pActiveDesktop -> SetWallpaper (FilePath,77);
WCHAR wcTemp[512] ;
hr = pActiveDesktop -> GetWallpaper (wcTemp, 512, 0);
MessageBoxW (0, wcTemp, 0, 0);
//cout << wcTemp;
pActiveDesktop->Release();
CoUninitialize ();
return 0;
}
Cpp1.cpp(23) : error C2734: 'FilePath' : const object must be initialized if not extern
Cpp1.cpp(24) : error C2440: '=' : cannot convert from 'char [77]' to 'const unsigned short [77]'
There is no context in which this conversion is possible
I would be greatful for any help,
Chears.