Link to home
Start Free TrialLog in
Avatar of michaelst
michaelst

asked on

Creating a shortcut to VPN from C++

I need to create a link of one of the VPN connection (I create in the same program) to the desktop. I'm using C++ console application.
Is there a simple way to do that without adding any dependencies?
Avatar of Jbamaral
Jbamaral

The example I'm sending was extracted from MSDN library and opens the connection dialog for any connection, including VPN.
You just call dial( "your connection name" ).

If you need more control over your connection you can use the class provided in the following link
http://www.codeguru.com/cpp/i-n/network/dial-upnetworking/article.php/c2445__1
With this class you can bypass the dialog and add your own UI.

dialdlg.txt
Avatar of michaelst

ASKER

I do not need to dial. I need to create a shortcut only.
ASKER CERTIFIED SOLUTION
Avatar of Jbamaral
Jbamaral

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
The code works with one problem - "linkPath" is a WCHAR. After I realized that everything is fine.
If you compile using multi byte chars instead of unicode it will work fine. I tested it before sending ( I did just one test but it worked fine ).
Note that TCHAR resolves to wchar_t if you use unicode and to char if you use multi byte.
But it was my bad anyways as I should have written the code using tprintf and the respective macros to cope with the consts.
As I said before this was just an example to understand the API's involved.
No worries, I needed an example  how it works.So, thank you for you help.