Click here to Skip to main content
15,889,595 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Questionhai Pin
roopa.n7-Apr-09 20:39
roopa.n7-Apr-09 20:39 
AnswerRe: hai Pin
TinyDevices7-Apr-09 22:26
professionalTinyDevices7-Apr-09 22:26 
JokeRe: hai Pin
Nelek8-Apr-09 0:30
protectorNelek8-Apr-09 0:30 
AnswerRe: hai Pin
0x3c08-Apr-09 1:32
0x3c08-Apr-09 1:32 
Questionhai Pin
roopa.n7-Apr-09 20:38
roopa.n7-Apr-09 20:38 
AnswerRe: hai Pin
Cedric Moonen7-Apr-09 21:01
Cedric Moonen7-Apr-09 21:01 
AnswerRe: hai Pin
Rajesh R Subramanian7-Apr-09 22:31
professionalRajesh R Subramanian7-Apr-09 22:31 
QuestionAddScanPackageService is retruning E_INVALIDARG Pin
ashish8patil7-Apr-09 20:29
ashish8patil7-Apr-09 20:29 
Hello All ,
My following Code is in cpp and use COM interfaces, My complile and build with 0 errors and 0 warnings .But at run it gives exception .In code line
hr=serviceManager->AddScanPackageService(BSTR("Offline SyncService"),BSTR("c:\\wsusscan.cab"),0,&service);

when this line exicute value of hr is E_INVALIDARG.
plz help my code is as folloing .

/////////////////////////////////////////////////////////////////////

{
IUpdateSession * session = 0;
IUpdateServiceManager * serviceManager = 0;
IUpdateService * service = 0;
IUpdateSearcher * searcher = 0;
ISearchResult * searchResult = 0;
IUpdateCollection *collection=0;
IUpdate *update=0;
HRESULT hr;
CoInitialize(NULL);
hr = CoCreateInstance(CLSID_UpdateServiceManager, 0, CLSCTX_ALL,
IID_IUpdateServiceManager,(LPVOID *)&serviceManager);

hr=CoCreateInstance(CLSID_UpdateSession,0,CLSCTX_ALL,IID_IUpdateSession,
(LPVOID *)&session);
////////////////////////////////////////////
hr=serviceManager->AddScanPackageService(BSTR("Offline Sync Service"),BSTR("c:\\wsusscan.cab"),0,&service);
//////////////////////////////////////////////////////////
hr=session->CreateUpdateSearcher(&searcher);

ServerSelection ss={ ssOthers } ;
BSTR str=0;
hr=searcher->put_ServerSelection(ss);
hr=service->get_ServiceID(&str);
hr=searcher->put_ServiceID(str);
hr=searcher->Search(L"IsInstalled=0",&searchResult );
hr=searchResult->get_Updates(&collection);
LONG count;
hr=collection->get_Count(&count);

for(LONG i=0;i<count;i++)
{
collection->get_Item(i,&update);
update->get_Title(&str);
printf("%s",(char *)str);
}

}


///////////////////////////////////////////////////////////////////////



Thanks for reading this
question/ replying answer.
AnswerRe: AddScanPackageService is retruning E_INVALIDARG Pin
Stuart Dootson7-Apr-09 21:30
professionalStuart Dootson7-Apr-09 21:30 
GeneralRe: AddScanPackageService is retruning E_INVALIDARG Pin
ashish8patil7-Apr-09 21:44
ashish8patil7-Apr-09 21:44 
QuestionDatabase Server \Client model Pin
krishnan.s7-Apr-09 19:41
krishnan.s7-Apr-09 19:41 
AnswerRe: Database Server \Client model Pin
Stuart Dootson7-Apr-09 21:38
professionalStuart Dootson7-Apr-09 21:38 
QuestionHow can load dll in project? Pin
Le@rner7-Apr-09 19:10
Le@rner7-Apr-09 19:10 
AnswerRe: How can load dll in project? Pin
«_Superman_»7-Apr-09 19:20
professional«_Superman_»7-Apr-09 19:20 
GeneralRe: How can load dll in project? Pin
Le@rner7-Apr-09 20:19
Le@rner7-Apr-09 20:19 
GeneralRe: How can load dll in project? Pin
«_Superman_»7-Apr-09 20:53
professional«_Superman_»7-Apr-09 20:53 
GeneralRe: How can load dll in project? Pin
Le@rner7-Apr-09 20:56
Le@rner7-Apr-09 20:56 
GeneralRe: How can load dll in project? Pin
«_Superman_»7-Apr-09 22:08
professional«_Superman_»7-Apr-09 22:08 
AnswerRe: How can load dll in project? Pin
Rajesh R Subramanian8-Apr-09 0:11
professionalRajesh R Subramanian8-Apr-09 0:11 
GeneralRe: How can load dll in project? Pin
Le@rner8-Apr-09 0:50
Le@rner8-Apr-09 0:50 
GeneralRe: How can load dll in project? Pin
Rajesh R Subramanian8-Apr-09 2:06
professionalRajesh R Subramanian8-Apr-09 2:06 
QuestionMy xp application can't support vista Pin
tyr20007-Apr-09 16:53
tyr20007-Apr-09 16:53 
AnswerRe: My xp application can't support vista Pin
Stuart Dootson7-Apr-09 21:41
professionalStuart Dootson7-Apr-09 21:41 
QuestionMFC Conversion to Unicode in VS2008 Pin
Selumbei7-Apr-09 16:32
Selumbei7-Apr-09 16:32 
AnswerRe: MFC Conversion to Unicode in VS2008 Pin
Stuart Dootson7-Apr-09 21:44
professionalStuart Dootson7-Apr-09 21:44 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.