CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Jun 2003
    Posts
    86

    shortcut with parameters

    I am trying to create a shortcut with parameters but it doesnt work. when I give up the parameters the shortcut work perfect.

    i create a shortcut with this line:
    FileLink("C:\\winnt\\system32\\control.exe" "appwiz.cpl" ,m_sDesktopDir+"\\Add-Remove Programs.lnk");

    here is the function:
    BOOL FileLink(const CString strPathObj,const CString strPathLink)
    {

    BOOL bRet = FALSE;
    IShellLink *psl;
    //CreateLink(strPathObj,strPathLink,"EmailResponder ACT!");


    if (SUCCEEDED( CoCreateInstance(CLSID_ShellLink,
    NULL,
    CLSCTX_INPROC_SERVER,
    IID_IShellLink,
    (LPVOID*) &psl))
    )
    {
    IPersistFile* ppf;

    psl->SetPath(strPathObj);

    if (SUCCEEDED(psl->QueryInterface( IID_IPersistFile, (LPVOID *) &ppf)))
    {

    WORD wsz[MAX_PATH];
    MultiByteToWideChar(CP_ACP,
    MB_PRECOMPOSED,
    strPathLink,
    -1,
    wsz,
    MAX_PATH);

    if ( SUCCEEDED ( ppf->Save(wsz, TRUE) ) )
    bRet = TRUE;

    ppf->Release();
    }
    psl->Release();
    }
    return bRet;
    }

    any idea?

  2. #2
    Join Date
    May 2001
    Location
    Madrid-Spain
    Posts
    1,123
    Look this function in MSDN:
    IShellLink::SetArguments
    I am Miss Maiden... Miss Iron Maiden :-D

  3. #3
    Join Date
    Jun 2003
    Posts
    86

    Talking 10x

    I miss it.
    i used the setarguments function and ti si working fine.
    rgrds megetron

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured