C Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesC Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old June 20th, 2003, 05:16 PM
ComputerGuy356 ComputerGuy356 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2003
Posts: 25 ComputerGuy356 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 51 m 4 sec
Reputation Power: 0
CoCreateInstance Fails in Windows XP

I am calling CoCreateInstance to create a shortcut in Windows using C++. My program compiles find, but when I run it in XP, it encounters an error and closes. I run it in Compatability Mode in Windows 98/ME and it works just fine. What do I need to do to make it compatable with XP?

Reply With Quote
  #2  
Old June 21st, 2003, 05:46 AM
BigBadBob BigBadBob is offline
status unknown
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2003
Posts: 262 BigBadBob User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 10
What error do you get when you run it in XP?

Reply With Quote
  #3  
Old June 21st, 2003, 08:17 PM
ComputerGuy356 ComputerGuy356 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2003
Posts: 25 ComputerGuy356 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 51 m 4 sec
Reputation Power: 0
The error message is:
"My Program has encountered a problem and needs to close. We are sorry for the inconvenience."
It allows you to debug, send an error report, or don't send an error report.

Reply With Quote
  #4  
Old June 22nd, 2003, 03:56 AM
BigBadBob BigBadBob is offline
status unknown
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2003
Posts: 262 BigBadBob User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 10
Do you know whether CoCreateInstance itself succeeds, do you test the return value? Have you been able to determine what point your program gets to before you get the error?

Reply With Quote
  #5  
Old June 22nd, 2003, 06:18 PM
ComputerGuy356 ComputerGuy356 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2003
Posts: 25 ComputerGuy356 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 51 m 4 sec
Reputation Power: 0
It fails when I try to use the pointer to set a path for my shortcut. The pointer equals NULL. Here's my code:

IShellLink* psl;
hres=CoCreateInstance(
CLSID_ShellLink,
NULL,
CLSCTX_INPROC_SERVER,
IID_IShellLink,
(LPVOID*)&psl
);
if (!SUCCEEDED(hres) || psl==NULL)
{
CoUninitialize();
}
IPersistFile* ppf;
psl->SetPath("C:\\Program Files\\My Program\\program.exe");
psl->SetDescription("Launch Program");
psl->SetIconLocation("C:\\Program Files\\My Program\\program.exe", 0);
psl->QueryInterface(IID_IPersistFile,(LPVOID*)&ppf);
ppf->Save(wLinkPath, FALSE);
ppf->Release();
CoUninitialize();

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesC Programming > CoCreateInstance Fails in Windows XP

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap