<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[MsiGetShortcutTargetA: Ich krieg&#x27;s nicht hin! :mad]]></title><description><![CDATA[<p>Hi,</p>
<p>gestern hab' ich mir den ganzen Abend um die Ohren geschlagen um dieses &quot;simple&quot; (?) Problem zu lösen: Ich möchte das Ziel eines Shortcuts (.lnk) mittels der MSI.dll Function MsiGetShortcutTargetA auslesen. Damit das heute nicht schon wieder passiert, bitte ich jetzt doch mal um Hilfe <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f603.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--grinning_face_with_big_eyes"
      title=":D"
      alt="😃"
    /></p>
<p>Das Problem: Das Programm steigt immer an der Stelle &quot;Could not find shortcut target&quot; aus, obwohl argv[1] einen gültigen Shortcut mitkriegt.</p>
<pre><code class="language-cpp">#include &lt;windows.h&gt;
#include &lt;iostream&gt;
using namespace std;

typedef unsigned int (*DLLFUNC)(const char*, char*, char*, char*);

int main(int args, char* argv[])
{
char productCode[39];
char componentCode[39];

    if (args &lt;= 1)
       return -1;

    HINSTANCE hinstMSI = NULL;
    hinstMSI = LoadLibrary(&quot;msi.dll&quot;);     // handle to MSI.dll
    if (!hinstMSI)
    {
        MessageBox(NULL,&quot;Could not find MSI.dll!&quot;, &quot;Error&quot;, MB_OK);
        return -1;
    }
    DLLFUNC GetShortcutTarget = (DLLFUNC)GetProcAddress(hinstMSI, &quot;MsiGetShortcutTargetA&quot;);
    if (!GetShortcutTarget)
    {
        MessageBox(NULL,&quot;Error using MSI.dll function!&quot;, &quot;Error&quot;, MB_OK);
        return -1;
    }

    if (GetShortcutTarget(argv[1],productCode,NULL,componentCode) == ERROR_FUNCTION_FAILED)
    {
        MessageBox(NULL,&quot;Could not find shortcut target!&quot;, NULL, MB_OK);
        return -1;
    }

// ab hier würde dann MsiGetComponentPath kommen, wenn das Programm bis hierhin käme...

    FreeLibrary(hinstMSI);

    return 0;
}
</code></pre>
<p>Mir geht's nicht um alternative Lösungswege (ich weiß da gibt es einige), sondern ich möchte wissen, warum mein Programm nicht funktioniert <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f615.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--confused_face"
      title=":confused:"
      alt="😕"
    /></p>
<p>Danke für jeden Hinweis!!!<br />
-ZenJu</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/208146/msigetshortcuttargeta-ich-krieg-s-nicht-hin-mad</link><generator>RSS for Node</generator><lastBuildDate>Fri, 24 Apr 2026 09:30:58 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/208146.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 15 Mar 2008 11:38:58 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to MsiGetShortcutTargetA: Ich krieg&#x27;s nicht hin! :mad on Thu, 27 Mar 2008 12:19:26 GMT]]></title><description><![CDATA[<p>Hi,</p>
<p>gestern hab' ich mir den ganzen Abend um die Ohren geschlagen um dieses &quot;simple&quot; (?) Problem zu lösen: Ich möchte das Ziel eines Shortcuts (.lnk) mittels der MSI.dll Function MsiGetShortcutTargetA auslesen. Damit das heute nicht schon wieder passiert, bitte ich jetzt doch mal um Hilfe <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f603.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--grinning_face_with_big_eyes"
      title=":D"
      alt="😃"
    /></p>
<p>Das Problem: Das Programm steigt immer an der Stelle &quot;Could not find shortcut target&quot; aus, obwohl argv[1] einen gültigen Shortcut mitkriegt.</p>
<pre><code class="language-cpp">#include &lt;windows.h&gt;
#include &lt;iostream&gt;
using namespace std;

typedef unsigned int (*DLLFUNC)(const char*, char*, char*, char*);

int main(int args, char* argv[])
{
char productCode[39];
char componentCode[39];

    if (args &lt;= 1)
       return -1;

    HINSTANCE hinstMSI = NULL;
    hinstMSI = LoadLibrary(&quot;msi.dll&quot;);     // handle to MSI.dll
    if (!hinstMSI)
    {
        MessageBox(NULL,&quot;Could not find MSI.dll!&quot;, &quot;Error&quot;, MB_OK);
        return -1;
    }
    DLLFUNC GetShortcutTarget = (DLLFUNC)GetProcAddress(hinstMSI, &quot;MsiGetShortcutTargetA&quot;);
    if (!GetShortcutTarget)
    {
        MessageBox(NULL,&quot;Error using MSI.dll function!&quot;, &quot;Error&quot;, MB_OK);
        return -1;
    }

    if (GetShortcutTarget(argv[1],productCode,NULL,componentCode) == ERROR_FUNCTION_FAILED)
    {
        MessageBox(NULL,&quot;Could not find shortcut target!&quot;, NULL, MB_OK);
        return -1;
    }

// ab hier würde dann MsiGetComponentPath kommen, wenn das Programm bis hierhin käme...

    FreeLibrary(hinstMSI);

    return 0;
}
</code></pre>
<p>Mir geht's nicht um alternative Lösungswege (ich weiß da gibt es einige), sondern ich möchte wissen, warum mein Programm nicht funktioniert <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f615.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--confused_face"
      title=":confused:"
      alt="😕"
    /></p>
<p>Danke für jeden Hinweis!!!<br />
-ZenJu</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1474752</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1474752</guid><dc:creator><![CDATA[ZenJu]]></dc:creator><pubDate>Thu, 27 Mar 2008 12:19:26 GMT</pubDate></item><item><title><![CDATA[Reply to MsiGetShortcutTargetA: Ich krieg&#x27;s nicht hin! :mad on Thu, 27 Mar 2008 12:20:36 GMT]]></title><description><![CDATA[<p>Keiner 'ne Ahnung?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1481312</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1481312</guid><dc:creator><![CDATA[ZenJu]]></dc:creator><pubDate>Thu, 27 Mar 2008 12:20:36 GMT</pubDate></item><item><title><![CDATA[Reply to MsiGetShortcutTargetA: Ich krieg&#x27;s nicht hin! :mad on Thu, 27 Mar 2008 12:50:32 GMT]]></title><description><![CDATA[<p>Das geht nur mit speziellen Shortcuts, bei einem Shortcut von MS Word funktioniert es zum Beispiel.</p>
<p>Bei deinem typdef muss du noch die Calling Konvention auf __stdcall ändern, z.B. in dem du WINAPI hinzufügst.</p>
<pre><code class="language-cpp">typedef unsigned int (WINAPI *DLLFUNC)(const char*, char*, char*, char*);
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1481348</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1481348</guid><dc:creator><![CDATA[.............]]></dc:creator><pubDate>Thu, 27 Mar 2008 12:50:32 GMT</pubDate></item><item><title><![CDATA[Reply to MsiGetShortcutTargetA: Ich krieg&#x27;s nicht hin! :mad on Thu, 27 Mar 2008 13:33:27 GMT]]></title><description><![CDATA[<p>Das geht natprlich nur mit Shortcuts, die in irgendeiner Beziehugn zu MSI (Installer, bzw. installierten Programmen) stehen... z.B. mit den Shortcuts des Desktops...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1481402</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1481402</guid><dc:creator><![CDATA[Jochen Kalmbach]]></dc:creator><pubDate>Thu, 27 Mar 2008 13:33:27 GMT</pubDate></item></channel></rss>