Sunday, August 2, 2009

How do i create a shortcut using C++?

how do i make a shortcut to a file or folder in C++? i would like to be able to make a function to make the shortcut like:





CreateShortcut(char *File, char *Destination,);





File would be the file or folder and Destination is the directory where the shortcut is going to be saved

How do i create a shortcut using C++?
Linux:





#include %26lt;unistd.h%26gt;


int symlink(const char *oldpath, const char *newpath);





Windows:





BOOL CreateHardLink(


LPCTSTR lpFileName,


LPCTSTR lpExistingFileName,


LPSECURITY_ATTRIBUTES lpSecurityAttributes


);
Reply:Pull up a shortcut file in a hex editor. They're pretty simple and easy to replicate. Here's a link to the file fomat description, in case it isn't clear, and to a good (free) hex editor.
Reply:Ok, well, As I think, the shortcut is a LNK file. So possibly you culd make a file structure like that and add the details to it.


No comments:

Post a Comment