Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Managed C++ / January 2005

Tip: Looking for answers? Try searching our database.

How to create a Shortcut File by programming in C++?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Ping - 28 Jan 2005 02:03 GMT
Hi, All,

How to create a Shortcut File by programming in C++?
To use whitch function or Windows API?

Thinks.
William DePalo [MVP VC++] - 28 Jan 2005 02:21 GMT
> How to create a Shortcut File by programming in C++?
> To use whitch function or Windows API?

You need to use a few shell interfaces. At this link you will find examples
of links to file and non-file objects as well:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platfor
m/shell/programmersguide/shell_int/shell_int_programming/shortcuts/shortcut.asp


Regards,
Will
Ping - 28 Jan 2005 05:22 GMT
Hello Will,

I try the example for creating the shortcut file. but the following function
return fail.
Can you tell me the reason?

hres = CoCreateInstance(CLSID_ShellLink, NULL,
CLSCTX_INPROC_SERVER,IID_IShellLink, (LPVOID*)&psl);

Thanks

>> How to create a Shortcut File by programming in C++?
>> To use whitch function or Windows API?
[quoted text clipped - 6 lines]
> Regards,
> Will
William DePalo [MVP VC++] - 28 Jan 2005 05:41 GMT
> I try the example for creating the shortcut file. but the following
> function return fail.
> Can you tell me the reason?
>
> hres = CoCreateInstance(CLSID_ShellLink, NULL,
> CLSCTX_INPROC_SERVER,IID_IShellLink, (LPVOID*)&psl);

Here is a tip for some self-help: take a look at the value of hres in the
watch window. Then plug that value into the error lookup tool from the menu
to see the text of the message.

Did you remember to call CoInitialize[Ex]()?

Regards,
Will
Ping - 28 Jan 2005 06:03 GMT
Hi Will,

Yes, i'm missing to call CoInitializeEx(...).
Now it's OK!

Thank you very much

>> I try the example for creating the shortcut file. but the following
>> function return fail.
[quoted text clipped - 11 lines]
> Regards,
> Will

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.