<?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[Ressourcen entpacken]]></title><description><![CDATA[<p>Hi, ich möchte ein Programm schreiben, welches ressourcen enthält die ich dann später benutzten möchte.</p>
<p>Also, ich bin schonmal soweit, dass ich jede X-beliebige datei mitlinken lassen kann.</p>
<p>Nur ich komme an diese mitgelikten Daten nichtmehr rann.</p>
<p>Das ist mein momentaner Code:</p>
<p>main.c</p>
<pre><code class="language-cpp">#include &lt;windows.h&gt;
#include &quot;resource.h&quot;

int APIENTRY WinMain(HINSTANCE hInstance,
                     HINSTANCE hPrevInstance,
                     LPSTR     lpCmdLine,
                     int       nCmdShow)
{
  HRSRC hRes = FindResource(NULL,MAKEINTRESOURCE(ID_MOD_02),&quot;CUSTOM&quot;);
  HGLOBAL hResLoaded = LoadResource(NULL, hRes);
  DWORD dwResSize = SizeofResource(NULL, hRes);
  LPVOID pData = LockResource(hResLoaded);
  HANDLE hTemp = CreateFile(&quot;NEU.mod&quot;, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL);
  DWORD dwBytesWritten;
  WriteFile(hTemp, pData, dwResSize, &amp;dwBytesWritten, NULL);
  CloseHandle(hTemp);
  UnlockResource(hResLoaded);
//  DeleteFile(szNewFile);
  CloseHandle(hTemp);
  UnlockResource(hResLoaded);
  return 0;
}
</code></pre>
<p>bla.rc :</p>
<pre><code>ID_MOD_02 CUSTOM &quot;02.MOD&quot;
</code></pre>
<p>resource.h</p>
<pre><code class="language-cpp">#define ID_MOD_02 1000
</code></pre>
<p>Nunja, wenn man das Programm startet, erstellt sich die &quot;NEU.mod&quot;, aber sie ist völlig leer.</p>
<p>Was mache ich falsch?</p>
<p>Danke schonmal</p>
<p>mfg codeworx</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/176880/ressourcen-entpacken</link><generator>RSS for Node</generator><lastBuildDate>Sat, 18 Apr 2026 20:36:09 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/176880.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 26 Mar 2007 04:16:56 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Ressourcen entpacken on Mon, 26 Mar 2007 04:16:56 GMT]]></title><description><![CDATA[<p>Hi, ich möchte ein Programm schreiben, welches ressourcen enthält die ich dann später benutzten möchte.</p>
<p>Also, ich bin schonmal soweit, dass ich jede X-beliebige datei mitlinken lassen kann.</p>
<p>Nur ich komme an diese mitgelikten Daten nichtmehr rann.</p>
<p>Das ist mein momentaner Code:</p>
<p>main.c</p>
<pre><code class="language-cpp">#include &lt;windows.h&gt;
#include &quot;resource.h&quot;

int APIENTRY WinMain(HINSTANCE hInstance,
                     HINSTANCE hPrevInstance,
                     LPSTR     lpCmdLine,
                     int       nCmdShow)
{
  HRSRC hRes = FindResource(NULL,MAKEINTRESOURCE(ID_MOD_02),&quot;CUSTOM&quot;);
  HGLOBAL hResLoaded = LoadResource(NULL, hRes);
  DWORD dwResSize = SizeofResource(NULL, hRes);
  LPVOID pData = LockResource(hResLoaded);
  HANDLE hTemp = CreateFile(&quot;NEU.mod&quot;, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL);
  DWORD dwBytesWritten;
  WriteFile(hTemp, pData, dwResSize, &amp;dwBytesWritten, NULL);
  CloseHandle(hTemp);
  UnlockResource(hResLoaded);
//  DeleteFile(szNewFile);
  CloseHandle(hTemp);
  UnlockResource(hResLoaded);
  return 0;
}
</code></pre>
<p>bla.rc :</p>
<pre><code>ID_MOD_02 CUSTOM &quot;02.MOD&quot;
</code></pre>
<p>resource.h</p>
<pre><code class="language-cpp">#define ID_MOD_02 1000
</code></pre>
<p>Nunja, wenn man das Programm startet, erstellt sich die &quot;NEU.mod&quot;, aber sie ist völlig leer.</p>
<p>Was mache ich falsch?</p>
<p>Danke schonmal</p>
<p>mfg codeworx</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1252602</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1252602</guid><dc:creator><![CDATA[codeworx]]></dc:creator><pubDate>Mon, 26 Mar 2007 04:16:56 GMT</pubDate></item><item><title><![CDATA[Reply to Ressourcen entpacken on Mon, 26 Mar 2007 07:27:07 GMT]]></title><description><![CDATA[<p>Wieso hast Du bei keinem der Statments hInstance angegeben?<br />
Was sagen den die Handles bei der Rückgabe. Sind die denn !=0?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1252661</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1252661</guid><dc:creator><![CDATA[Martin Richter]]></dc:creator><pubDate>Mon, 26 Mar 2007 07:27:07 GMT</pubDate></item><item><title><![CDATA[Reply to Ressourcen entpacken on Mon, 26 Mar 2007 13:25:14 GMT]]></title><description><![CDATA[<p>Hm, hab das grad noch bei meinen Code-Snippets gefunden, vllt. hilfts:</p>
<pre><code class="language-cpp">#include &lt;iostream&gt;
#include &lt;windows.h&gt;
#include &lt;conio.h&gt;

#include &quot;resource.h&quot;

bool ExtractReSrcFile(const TCHAR*,WORD,const TCHAR*,HINSTANCE);

int main()
{
    ExtractReSrcFile(TEXT(&quot;FILE&quot;), IDR_FILE, TEXT(&quot;C:\\Demo.wav&quot;));

    while(!kbhit());
    return (0);
}

bool ExtractReSrcFile(const TCHAR* pszType, WORD wReSrcID, const TCHAR* pszLocation, HINSTANCE hInst = GetModuleHandle(NULL))
{
    if(pszType == NULL || pszLocation == NULL)
       return (false);
    HRSRC hSrcFile = FindResource(hInst, MAKEINTRESOURCE(wReSrcID), pszType);
    if(hSrcFile != NULL)
    {
        HGLOBAL hSrcFileLoad  = LoadResource(hInst, hSrcFile);
        void*   pvSrcFileData = LockResource(hSrcFileLoad);
        size_t  stSrcFileSize = SizeofResource(hInst, hSrcFile);
        HANDLE  hReSrcFile    = CreateFile(pszLocation, GENERIC_WRITE, FILE_SHARE_READ, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
        if(hReSrcFile == INVALID_HANDLE_VALUE)
           return (false);
        WriteFile(hReSrcFile, pvSrcFileData, stSrcFileSize, NULL, NULL);
        CloseHandle(hReSrcFile);

        return (true);
    }
    return (false);
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1252969</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1252969</guid><dc:creator><![CDATA[CodeFinder]]></dc:creator><pubDate>Mon, 26 Mar 2007 13:25:14 GMT</pubDate></item><item><title><![CDATA[Reply to Ressourcen entpacken on Mon, 26 Mar 2007 14:10:14 GMT]]></title><description><![CDATA[<p>CodeFinder, ich habe deinen Code mal ausprobiert, aber da entsteht nur ne Endlosschleife.</p>
<p>Ich muss auch dabei sagen, dass ich zum ersten mal mit Ressourcen arbeite und von WinAPi sogut wie keine Ahnung (bis auf Winsock) habe.</p>
<p>Ich bin mir auch garnicht sicher, ob meine .rc oder resource.h dateien richtig sind, weil ich habe mal die FindResource() funktion abgefragt und anscheinend wird meine Resource nicht gefunden (falsch deklariert/gelinkt)? (Mit gelinkt wird die Resource auf jedenfall, wenn ich zB ne .mp3 von 3 mb mitlinke, wächst das Programm um 3mb)</p>
<p>Wäre nett wenn mir jemand ganz genau sagen würde was ich in die .rc und resource.h reinmachen muss.</p>
<p>mfg</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1253011</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1253011</guid><dc:creator><![CDATA[codeworx]]></dc:creator><pubDate>Mon, 26 Mar 2007 14:10:14 GMT</pubDate></item><item><title><![CDATA[Reply to Ressourcen entpacken on Mon, 26 Mar 2007 14:42:50 GMT]]></title><description><![CDATA[<p>Ich wiederhole mich: Solange Du den hInst Parameter nicht an die entsprechenden Funktionen übergibst geht es nicht!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1253047</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1253047</guid><dc:creator><![CDATA[Martin Richter]]></dc:creator><pubDate>Mon, 26 Mar 2007 14:42:50 GMT</pubDate></item><item><title><![CDATA[Reply to Ressourcen entpacken on Mon, 26 Mar 2007 15:47:31 GMT]]></title><description><![CDATA[<p>entschuldigung, aber ich habe über winapi sogut wie keine ahnung (nur winsock)</p>
<p>und ich weis nicht wie das jetzt genau gehen soll, wäre aber nett wenn du mir den code richtig schreiben könntest :&gt;</p>
<p>Danke schonmal falls du es machst.</p>
<p>mfg</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1253117</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1253117</guid><dc:creator><![CDATA[codeworx]]></dc:creator><pubDate>Mon, 26 Mar 2007 15:47:31 GMT</pubDate></item><item><title><![CDATA[Reply to Ressourcen entpacken on Mon, 26 Mar 2007 18:21:30 GMT]]></title><description><![CDATA[<p>Versuch es doch einfach mal mit Lesen der Anleitung.<br />
Das ist die Funktion FindResource, diese Funktion nimmt einen ersten Parameter. Dieser Parameter ist die hInstance Deine Programmes. Ohne die weiß FindResource nicht wo es suchen soll!</p>
<p>Lesen bitte!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1253253</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1253253</guid><dc:creator><![CDATA[Martin Richter]]></dc:creator><pubDate>Mon, 26 Mar 2007 18:21:30 GMT</pubDate></item><item><title><![CDATA[Reply to Ressourcen entpacken on Mon, 26 Mar 2007 18:29:00 GMT]]></title><description><![CDATA[<p>welche anleitung?!</p>
<p>bei msdn steht:</p>
<p>HRSRC FindResource(<br />
HMODULE hModule,<br />
LPCTSTR lpName,<br />
LPCTSTR lpType<br />
);</p>
<p>nix hInstace, wobei ich nichtmal weiß was &quot;hInstace&quot; ist.</p>
<p>Ich habe auchnicht vor mich mit WinApi zu beschäftigen im moment, da ich andersweitig beschäftigt bin.</p>
<p>Ich habe eigentlich nur vor ressourcen mitzulinken und diese dann zu entpacken, ich wollte jetzt nicht WinApi lernen, sondern nur diese eine sache...</p>
<p>mfg</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1253258</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1253258</guid><dc:creator><![CDATA[codeworx]]></dc:creator><pubDate>Mon, 26 Mar 2007 18:29:00 GMT</pubDate></item><item><title><![CDATA[Reply to Ressourcen entpacken on Mon, 26 Mar 2007 18:52:35 GMT]]></title><description><![CDATA[<p>naja hInstance sollte mit GetModuleHandle(NULL) (wie codefinder sagte) sich schon zufrieden geben. Sollte dir aber trotzdem schon bei FindResource raushauen, weil dein Resourcetype nicht richtig ist (da CodeFinder &quot;FILE&quot; angegeben hat).</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1253283</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1253283</guid><dc:creator><![CDATA[*D*Evil]]></dc:creator><pubDate>Mon, 26 Mar 2007 18:52:35 GMT</pubDate></item><item><title><![CDATA[Reply to Ressourcen entpacken on Mon, 26 Mar 2007 19:15:18 GMT]]></title><description><![CDATA[<p>so, habe mir sagen lassen, das mein typ RT_RCDATA für RawData sein muss, und nix Custom oder FILE.</p>
<p>das mit hInst will immernochnicht (falsche typen hier, does not match da, usw. usf.).</p>
<p>Leute, ich suche schon seit mehreren tagen (schon alleine wie man dateien mitlinkt hat mich 2 tage gekostet)</p>
<p>das mit dem entpacken hab ich bist jetzt nochnet geschafft,...</p>
<p>Ich habe auchnoch anderes zu tun als nur mich dieser einen Sache zuzuwenden bin bin langsam völlig gernervt.</p>
<p>Ich weiss ja, man soll google benutzen, man soll die forum suche benutzen, etc pp. hat ich alles gemacht, ich habe seit mehr als 3 tagenfür das mitlinken und entpacken gesucht.</p>
<p>Sorry, dass ich einfach so &quot;dreist&quot; frage, aber kann mir nicht jemand ein fertiges beispiel (mit .rc file und resource.h) schreiben, was auch funktioniert?</p>
<p>Ich wäre sehr dankbar.</p>
<p>mfg</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1253300</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1253300</guid><dc:creator><![CDATA[codeworx]]></dc:creator><pubDate>Mon, 26 Mar 2007 19:15:18 GMT</pubDate></item><item><title><![CDATA[Reply to Ressourcen entpacken on Mon, 26 Mar 2007 21:26:57 GMT]]></title><description><![CDATA[<p>codeworx schrieb:</p>
<blockquote>
<p>CodeFinder, ich habe deinen Code mal ausprobiert, aber da entsteht nur ne Endlosschleife.[...]</p>
</blockquote>
<p>lol ?! hm klingt irgendwie unglaubwürdig, da da ja gar keine Schleife (explizit) verwendet wurde... . Was sagt Dir denn der Debugger ?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1253399</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1253399</guid><dc:creator><![CDATA[CodeFinder]]></dc:creator><pubDate>Mon, 26 Mar 2007 21:26:57 GMT</pubDate></item><item><title><![CDATA[Reply to Ressourcen entpacken on Tue, 27 Mar 2007 02:04:23 GMT]]></title><description><![CDATA[<p>natürlich ist da ne schleife:</p>
<p>while(!kbhit());</p>
<p>Das Prog funzt wie es ist nicht bei mir.</p>
<p>Ich weis auch garnicht ob ic hdie ressourcen richtig im resource script (die .rc) datei richtig deklariert habe, oder ob das was in der resource.h steht richtig ist...</p>
<p>Ich will einfach nur nen kleinen resourcen entpacker, der die mitgelinkten ressourcen entpackt, mit möglichst wenig aufwand.</p>
<p>mfg</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1253447</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1253447</guid><dc:creator><![CDATA[codeworx]]></dc:creator><pubDate>Tue, 27 Mar 2007 02:04:23 GMT</pubDate></item><item><title><![CDATA[Reply to Ressourcen entpacken on Tue, 27 Mar 2007 02:26:30 GMT]]></title><description><![CDATA[<p>Mannomann...</p>
<pre><code>// In bla.rc
#include &quot;resource.h&quot;
ID_MOD_02  BINARY  &quot;MyFile.xxx&quot;
</code></pre>
<pre><code class="language-cpp">#include &lt;windows.h&gt;
#include &quot;resource.h&quot;

int APIENTRY WinMain(HINSTANCE hInstance,
                     HINSTANCE hPrevInstance,
                     LPSTR     lpCmdLine,
                     int       nCmdShow)
{
   HRSRC hrsrc = FindResource((HMODULE)hInstance, 
                              MAKEINTRESOURCE(ID_MOD_02), 
                              &quot;BINARY&quot;);
   if(!hrsrc)
      MessageBox(NULL, &quot;Could not find resource&quot;, &quot;ERROR&quot;, MB_OK|MB_ICONERROR);

   LPVOID pData = (LPVOID)LoadResource((HMODULE)hInstance, hrsrc);
   if(!pData)
      MessageBox(NULL, &quot;Could not load resource&quot;, &quot;ERROR&quot;, MB_OK|MB_ICONERROR);

   return 0;
}
</code></pre>
<p>EDIT: Deine resource.h war schon OK. Du musst sie natürlich noch in bla.rc inkludieren (s.o.)</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1253449</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1253449</guid><dc:creator><![CDATA[WebFritzi]]></dc:creator><pubDate>Tue, 27 Mar 2007 02:26:30 GMT</pubDate></item><item><title><![CDATA[Reply to Ressourcen entpacken on Tue, 27 Mar 2007 06:34:46 GMT]]></title><description><![CDATA[<p><a class="plugin-mentions-user plugin-mentions-a" href="https://www.c-plusplus.net/forum/uid/358">@webfritzi</a>:<br />
Warum castest Du hInstance? Das irritiert doch nur und ist Quelle für üble Fehler. Und wenn wäre höchstens ein static_cast hier erlaubt um diese Fehler zu vermeiden... <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f576.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--sunglasses"
      title=":sunglasses:"
      alt="🕶"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1253494</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1253494</guid><dc:creator><![CDATA[Martin Richter]]></dc:creator><pubDate>Tue, 27 Mar 2007 06:34:46 GMT</pubDate></item><item><title><![CDATA[Reply to Ressourcen entpacken on Tue, 27 Mar 2007 07:25:17 GMT]]></title><description><![CDATA[<p>webfritzi ich liebe dich, ich will ein kind von dir^^ funzt 1a und das mit createfile und writefile konnte ich wie gehabt benutzen....</p>
<p>mfg</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1253521</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1253521</guid><dc:creator><![CDATA[codeworx]]></dc:creator><pubDate>Tue, 27 Mar 2007 07:25:17 GMT</pubDate></item><item><title><![CDATA[Reply to Ressourcen entpacken on Tue, 27 Mar 2007 10:40:44 GMT]]></title><description><![CDATA[<p>Martin Richter schrieb:</p>
<blockquote>
<p><a class="plugin-mentions-user plugin-mentions-a" href="https://www.c-plusplus.net/forum/uid/358">@webfritzi</a>:<br />
Warum castest Du hInstance? Das irritiert doch nur und ist Quelle für üble Fehler. Und wenn wäre höchstens ein static_cast hier erlaubt um diese Fehler zu vermeiden... <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f576.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--sunglasses"
      title=":sunglasses:"
      alt="🕶"
    /></p>
</blockquote>
<p>Deswegen:</p>
<p>codeworx schrieb:</p>
<blockquote>
<p>das mit hInst will immernochnicht (falsche typen hier, does not match da, usw. usf.).</p>
</blockquote>
]]></description><link>https://www.c-plusplus.net/forum/post/1253692</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1253692</guid><dc:creator><![CDATA[WebFritzi]]></dc:creator><pubDate>Tue, 27 Mar 2007 10:40:44 GMT</pubDate></item><item><title><![CDATA[Reply to Ressourcen entpacken on Tue, 27 Mar 2007 12:33:50 GMT]]></title><description><![CDATA[<p>codeworx schrieb:</p>
<blockquote>
<p>natürlich ist da ne schleife:</p>
<p>while(!kbhit());</p>
<p>Das Prog funzt wie es ist nicht bei mir.</p>
<p>Ich weis auch garnicht ob ic hdie ressourcen richtig im resource script (die .rc) datei richtig deklariert habe, oder ob das was in der resource.h steht richtig ist...</p>
<p>Ich will einfach nur nen kleinen resourcen entpacker, der die mitgelinkten ressourcen entpackt, mit möglichst wenig aufwand.</p>
<p>mfg</p>
</blockquote>
<p>OMG! Ich rede von der Funktion die main-Funktion soll doch nur die Verwendung verdeutlichen! Dass das noch anzupassen ist, ist doch wohl klar.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1253782</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1253782</guid><dc:creator><![CDATA[CodeFinder]]></dc:creator><pubDate>Tue, 27 Mar 2007 12:33:50 GMT</pubDate></item><item><title><![CDATA[Reply to Ressourcen entpacken on Tue, 27 Mar 2007 12:39:16 GMT]]></title><description><![CDATA[<p>Egal, CodeFinder. Du hast ihm nichts neues gegeben. Den Code hatte er doch (in etwa) auch schon.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1253791</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1253791</guid><dc:creator><![CDATA[WebFritzi]]></dc:creator><pubDate>Tue, 27 Mar 2007 12:39:16 GMT</pubDate></item><item><title><![CDATA[Reply to Ressourcen entpacken on Tue, 27 Mar 2007 12:42:05 GMT]]></title><description><![CDATA[<p>Ne egal ist das nicht. Er soll ja auch verstehen, dass es mir um die Funktion ('ExtractReSrcFile') ging, nicht um die main <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f644.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--face_with_rolling_eyes"
      title=":rolling_eyes:"
      alt="🙄"
    /> .</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1253795</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1253795</guid><dc:creator><![CDATA[CodeFinder]]></dc:creator><pubDate>Tue, 27 Mar 2007 12:42:05 GMT</pubDate></item><item><title><![CDATA[Reply to Ressourcen entpacken on Tue, 27 Mar 2007 12:44:45 GMT]]></title><description><![CDATA[<p>Ich denke, das war ihm klar. Mit seinem Statement wollte er nur ausdrücken, dass außer einer Endlosschleife da nicht viel passiert. Wie vorher halt auch schon.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1253800</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1253800</guid><dc:creator><![CDATA[WebFritzi]]></dc:creator><pubDate>Tue, 27 Mar 2007 12:44:45 GMT</pubDate></item><item><title><![CDATA[Reply to Ressourcen entpacken on Tue, 27 Mar 2007 13:17:37 GMT]]></title><description><![CDATA[<p>WebFritzi schrieb:</p>
<blockquote>
<p>Deswegen:</p>
<p>codeworx schrieb:</p>
<blockquote>
<p>das mit hInst will immernochnicht (falsche typen hier, does not match da, usw. usf.).</p>
</blockquote>
</blockquote>
<p>Und das glaubst Du?<br />
1. HMODULE==HINSTANCE siehe defines in windows.h. Der Code funktioniert bei mir ohne cast!<br />
2. Überflüssige casts sind immer ein Problem<br />
3. Jederr cast will sehr wohl überlegt sein.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1253848</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1253848</guid><dc:creator><![CDATA[Martin Richter]]></dc:creator><pubDate>Tue, 27 Mar 2007 13:17:37 GMT</pubDate></item><item><title><![CDATA[Reply to Ressourcen entpacken on Tue, 27 Mar 2007 13:29:21 GMT]]></title><description><![CDATA[<p>Martin Richter schrieb:</p>
<blockquote>
<p>Und das glaubst Du?<br />
1. HMODULE==HINSTANCE siehe defines in windows.h.</p>
</blockquote>
<p>War zu faul nachzuschauen. <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /></p>
<p>Martin Richter schrieb:</p>
<blockquote>
<p>2. Überflüssige casts sind immer ein Problem<br />
3. Jederr cast will sehr wohl überlegt sein.</p>
</blockquote>
<p>Mag so sein. Ich sehe es aber nicht so, weil ich noch nie (und damit meine ich auch NIE) Probleme mit Casts hatte. Ich verwende stets C-Casts.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1253861</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1253861</guid><dc:creator><![CDATA[WebFritzi]]></dc:creator><pubDate>Tue, 27 Mar 2007 13:29:21 GMT</pubDate></item><item><title><![CDATA[Reply to Ressourcen entpacken on Tue, 27 Mar 2007 13:36:10 GMT]]></title><description><![CDATA[<p>ich mach das jetzt letzen endes so:</p>
<p>#include &lt;windows.h&gt;<br />
#include &quot;resource.h&quot;</p>
<p>int APIENTRY WinMain(HINSTANCE hInstance,<br />
HINSTANCE hPrevInstance,<br />
LPSTR lpCmdLine,<br />
int nCmdShow)<br />
{<br />
LPVOID ldata = LockResource(LoadResource(0,FindResource(0,MAKEINTRESOURCE(ID_MOD_02),&quot;BINARY&quot;)));</p>
<p>//tu irgendwas (bspweise mit ldata irgendwas anfangen (entpacken, mit anderen funktionen abspielen, ...</p>
<p>UnlockResource(ldata);<br />
return 0;<br />
}</p>
<p>funzt 1a und bin glücklich, hat das denn so seine richtigkeit?</p>
<p>mfg</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1253866</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1253866</guid><dc:creator><![CDATA[codeworx]]></dc:creator><pubDate>Tue, 27 Mar 2007 13:36:10 GMT</pubDate></item><item><title><![CDATA[Reply to Ressourcen entpacken on Tue, 27 Mar 2007 15:02:24 GMT]]></title><description><![CDATA[<p>Naja, du solltest schon auf Fehler prüfen. Und UnlockResource() brauchst du nicht in Win32.</p>
<p>@Schlaue Leute: Wozu eigentlich das LockResource? Man kann doch auch das Handle von LoadResource nach LPVOID casten. Funzt doch auch.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1253938</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1253938</guid><dc:creator><![CDATA[WebFritzi]]></dc:creator><pubDate>Tue, 27 Mar 2007 15:02:24 GMT</pubDate></item><item><title><![CDATA[Reply to Ressourcen entpacken on Tue, 27 Mar 2007 16:32:07 GMT]]></title><description><![CDATA[<p>WebFritzi schrieb:</p>
<blockquote>
<p>Martin Richter schrieb:</p>
<blockquote>
<p>2. Überflüssige casts sind immer ein Problem<br />
3. Jederr cast will sehr wohl überlegt sein.</p>
</blockquote>
<p>Mag so sein. Ich sehe es aber nicht so, weil ich noch nie (und damit meine ich auch NIE) Probleme mit Casts hatte. Ich verwende stets C-Casts.</p>
</blockquote>
<p>Das hat nix mit C oder C++ Casts zu tun: Da wo man ohne Casts auskommt, sollte man auch keine verwenden!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1254012</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1254012</guid><dc:creator><![CDATA[CodeFinder]]></dc:creator><pubDate>Tue, 27 Mar 2007 16:32:07 GMT</pubDate></item><item><title><![CDATA[Reply to Ressourcen entpacken on Tue, 27 Mar 2007 17:14:38 GMT]]></title><description><![CDATA[<p>codeworx schrieb:</p>
<blockquote>
<p>#include &lt;windows.h&gt;<br />
#include &quot;resource.h&quot;</p>
<p>int APIENTRY WinMain(HINSTANCE hInstance,<br />
HINSTANCE hPrevInstance,<br />
LPSTR lpCmdLine,<br />
int nCmdShow)<br />
{<br />
LPVOID ldata = LockResource(LoadResource(0,FindResource(0,MAKEINTRESOURCE(ID_MOD_02),&quot;BINARY&quot;)));</p>
<p>//tu irgendwas (bspweise mit ldata irgendwas anfangen (entpacken, mit anderen funktionen abspielen, ...</p>
<p>UnlockResource(ldata);<br />
return 0;<br />
}</p>
<p>funzt 1a und bin glücklich, hat das denn so seine richtigkeit?</p>
</blockquote>
<p>Nein! Ich würde immer das hInstance Handle übergeben! Weder LoadResource noch FindResource bekommen bei Dir das hInstance Handle!<br />
Dieser Code würde in einem DLL-Modul kläglichst versagen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1254044</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1254044</guid><dc:creator><![CDATA[Martin Richter]]></dc:creator><pubDate>Tue, 27 Mar 2007 17:14:38 GMT</pubDate></item></channel></rss>