<?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[GetModuleFileName !!!]]></title><description><![CDATA[<p>hallo,<br />
ich lese mit der enumwindow function verschiedene informationen der gefundenen elemente in meine struct. dann kann ich mir auch den title, die process ID und den classen namen anzeigen lassen. doch ich bekomme es nicht hin den pfad mit exe und das handle anzeigen zu lassen. habe aber noch 2 probleme:<br />
1. wie kann ich das handle in ein format bringen sodass ich mir es auch ausgeben lassen kann?<br />
2. der file bzw. pfad name ist immer leer, gebe ich anstatt hwnd NULL an, wir mir immer der name des aktuell aktivem prozesses zurückgegeben. möchte aber den des zuletzt gefundnen eintrags</p>
<pre><code class="language-cpp">struct win{
 char title[110],classname[100],file[MAX_PATH];
 HWND handle;
 char procid[8];
};
win window[255];
int winnr;

BOOL CALLBACK ShowAllWindows(HWND hwnd,LPARAM lParam)
{
unsigned long* id;
unsigned long ulid;
void *hg;

if(!GetWindow(hwnd, GW_OWNER))
{
 hg = GlobalAlloc(GMEM_SHARE,sizeof(unsigned long));
 id = (unsigned long *)GlobalLock(hg);
 GetWindowText(hwnd, window[winnr].title, 110);
 GetWindowThreadProcessId(hwnd, id);ulid =        *id;ultoa(ulid,window[winnr].procid,10);
 GetClassName(hwnd, window[winnr].classname,100);
 GetModuleFileName(hwnd, window[winnr].file, sizeof(window[winnr].file));
 window[winnr].handle = hwnd;
 winnr++;
 GlobalUnlock(hg);
 GlobalFree(hg);

 char all[255]=&quot;&quot;;
 strcat(all,window[winnr-1].title);
 strcat(all,&quot;:      &quot;);
 strcat(all,window[winnr-1].procid);
 strcat(all,&quot;:      &quot;);
 strcat(all,window[winnr-1].classname);
 strcat(all,&quot;:      &quot;);
 strcat(all,window[winnr-1].file);
 Form1-&gt;ListBox1-&gt;Items-&gt;Add((AnsiString)all);
}
return true;
}
</code></pre>
<p><strong>Edit:</strong><br />
Bitte die <strong><a href="http://c-plusplus.net/forum/faq.php?mode=bbcode" rel="nofollow">Code-Tags</a></strong> benutzen. Danke!</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/100408/getmodulefilename</link><generator>RSS for Node</generator><lastBuildDate>Tue, 28 Apr 2026 18:54:31 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/100408.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 07 Feb 2005 04:15:29 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to GetModuleFileName !!! on Mon, 07 Feb 2005 13:04:23 GMT]]></title><description><![CDATA[<p>hallo,<br />
ich lese mit der enumwindow function verschiedene informationen der gefundenen elemente in meine struct. dann kann ich mir auch den title, die process ID und den classen namen anzeigen lassen. doch ich bekomme es nicht hin den pfad mit exe und das handle anzeigen zu lassen. habe aber noch 2 probleme:<br />
1. wie kann ich das handle in ein format bringen sodass ich mir es auch ausgeben lassen kann?<br />
2. der file bzw. pfad name ist immer leer, gebe ich anstatt hwnd NULL an, wir mir immer der name des aktuell aktivem prozesses zurückgegeben. möchte aber den des zuletzt gefundnen eintrags</p>
<pre><code class="language-cpp">struct win{
 char title[110],classname[100],file[MAX_PATH];
 HWND handle;
 char procid[8];
};
win window[255];
int winnr;

BOOL CALLBACK ShowAllWindows(HWND hwnd,LPARAM lParam)
{
unsigned long* id;
unsigned long ulid;
void *hg;

if(!GetWindow(hwnd, GW_OWNER))
{
 hg = GlobalAlloc(GMEM_SHARE,sizeof(unsigned long));
 id = (unsigned long *)GlobalLock(hg);
 GetWindowText(hwnd, window[winnr].title, 110);
 GetWindowThreadProcessId(hwnd, id);ulid =        *id;ultoa(ulid,window[winnr].procid,10);
 GetClassName(hwnd, window[winnr].classname,100);
 GetModuleFileName(hwnd, window[winnr].file, sizeof(window[winnr].file));
 window[winnr].handle = hwnd;
 winnr++;
 GlobalUnlock(hg);
 GlobalFree(hg);

 char all[255]=&quot;&quot;;
 strcat(all,window[winnr-1].title);
 strcat(all,&quot;:      &quot;);
 strcat(all,window[winnr-1].procid);
 strcat(all,&quot;:      &quot;);
 strcat(all,window[winnr-1].classname);
 strcat(all,&quot;:      &quot;);
 strcat(all,window[winnr-1].file);
 Form1-&gt;ListBox1-&gt;Items-&gt;Add((AnsiString)all);
}
return true;
}
</code></pre>
<p><strong>Edit:</strong><br />
Bitte die <strong><a href="http://c-plusplus.net/forum/faq.php?mode=bbcode" rel="nofollow">Code-Tags</a></strong> benutzen. Danke!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/716356</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/716356</guid><dc:creator><![CDATA[darkshadow1979]]></dc:creator><pubDate>Mon, 07 Feb 2005 13:04:23 GMT</pubDate></item><item><title><![CDATA[Reply to GetModuleFileName !!! on Mon, 07 Feb 2005 06:44:38 GMT]]></title><description><![CDATA[<p>falsches Forum! und nicht mal die C++-Tags benutzt! kann ja kein mensch lesen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/716368</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/716368</guid><dc:creator><![CDATA[Sunday]]></dc:creator><pubDate>Mon, 07 Feb 2005 06:44:38 GMT</pubDate></item><item><title><![CDATA[Reply to GetModuleFileName !!! on Mon, 07 Feb 2005 13:04:39 GMT]]></title><description><![CDATA[<p>Dieser Thread wurde von Moderator/in <a href="http://www.c-plusplus.net/forum/profile.php?mode=viewprofile&amp;u=437" rel="nofollow">Jansen</a> aus dem Forum <a href="http://www.c-plusplus.net/forum/viewforum.php?f=2" rel="nofollow">Borland C++ Builder (VCL/CLX)</a> in das Forum <a href="http://www.c-plusplus.net/forum/viewforum.php?f=4" rel="nofollow">WinAPI</a> verschoben.</p>
<p>Im Zweifelsfall bitte auch folgende Hinweise beachten:<br />
<a href="http://www.c-plusplus.net/forum/viewtopic.php?t=39405" rel="nofollow">C/C++ Forum :: FAQ - Sonstiges :: Wohin mit meiner Frage?</a></p>
<p><em>Dieses Posting wurde automatisch erzeugt.</em></p>
]]></description><link>https://www.c-plusplus.net/forum/post/716689</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/716689</guid><dc:creator><![CDATA[C++ Forumbot]]></dc:creator><pubDate>Mon, 07 Feb 2005 13:04:39 GMT</pubDate></item><item><title><![CDATA[Reply to GetModuleFileName !!! on Mon, 07 Feb 2005 14:52:57 GMT]]></title><description><![CDATA[<p>darkshadow1979 schrieb:</p>
<blockquote>
<p>1. wie kann ich das handle in ein format bringen sodass ich mir es auch ausgeben lassen kann?</p>
</blockquote>
<p>Versuch es mal mit wsprintf <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":)"
      alt="🙂"
    /></p>
<p>darkshadow1979 schrieb:</p>
<blockquote>
<p>2. der file bzw. pfad name ist immer leer, gebe ich anstatt hwnd NULL an, wir mir immer der name des aktuell aktivem prozesses zurückgegeben. möchte aber den des zuletzt gefundnen eintrags</p>
</blockquote>
<p><a href="http://www.c-plusplus.net/forum/viewtopic.php?t=99242" rel="nofollow">http://www.c-plusplus.net/forum/viewtopic.php?t=99242</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/716815</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/716815</guid><dc:creator><![CDATA[flenders]]></dc:creator><pubDate>Mon, 07 Feb 2005 14:52:57 GMT</pubDate></item></channel></rss>