HTTPS SSH

CreateLNK

Small class/method to create Win32 shortcuts (LNK files)


Example

#include <iostream>
#include "CreateLNK.h"

using namespace std;

int main(int argc, char *argv[])
{
    std::wstring pathToObj = L"E:\\somepath\\my.file";
    std::wstring objArgs = L"";
    std::wstring dest = L"E:\\target\\shortcut.lnk";
    std::wstring workingDir = L"E:\\target";
    std::wstring desc = L"shortcut to my.file";

    HRESULT hr = CreateLNK::CreateIt(pathToObj, objArgs, dest, workingDir, desc);
    if(hr != S_OK) {
        std::cout << "Uh oh, something went wrong";
    } else {
        std::cout << "Shortcut created";
    }

    return 0;
}