<?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[Eine Form in einer DLL soll angezeigt werden]]></title><description><![CDATA[<p>tach auch</p>
<p>ich habe eine DLL mit dem DLL Experten erstellt. also ein standard grundgerüst.<br />
Dann dem projekt ein neues formular hinzugefügt (Form2). nun möchte ich aus einer exe anwendung (ebenfalls BCB) die DLL laden und dann die Form2 aus der DLL anzeigen lassen. ich kriege aber eine schutzverletzung wenn ich in der exportierten funktion die form anzeigen will. wenn ich das ganze mit einer messagebox mache, klappt es.</p>
<p>DLL code:</p>
<pre><code class="language-cpp">#include &lt;vcl.h&gt;
#include &lt;windows.h&gt;
#include &quot;Unit2.h&quot;
#pragma hdrstop
//---------------------------------------------------------------------------
#pragma argsused
//---------------------------------------------------------------------------
__declspec(dllexport) void __stdcall Registration(); 
//---------------------------------------------------------------------------
void __stdcall Registration()
{
	//MessageBox(NULL,&quot;geht&quot;,&quot;&quot;,48);
	Form2-&gt;ShowModal();
}
//---------------------------------------------------------------------------
int WINAPI DllEntryPoint(HINSTANCE hinst, unsigned long reason, void* lpReserved)
{
	return 1;
}
</code></pre>
<p>EXE code:</p>
<pre><code class="language-cpp">#include &lt;vcl.h&gt;
#pragma hdrstop

#include &quot;Unit1.h&quot;
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource &quot;*.dfm&quot;
TForm1 *Form1;
//---------------------------------------------------------------------------
__declspec(dllimport) void __stdcall Registration();
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
	: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
    HWND LoadDLL = LoadLibrary(&quot;Project1.dll&quot;);
	if(LoadDLL)
    {
    	Registration();
        FreeLibrary(LoadDLL);	
    }	
    else
    {
    	MessageBox(NULL,&quot;DLL konnte nicht geladen werden!&quot;,&quot;Fehler&quot;,16);
    }
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/topic/111154/eine-form-in-einer-dll-soll-angezeigt-werden</link><generator>RSS for Node</generator><lastBuildDate>Sat, 18 Jul 2026 21:47:13 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/111154.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 28 May 2005 16:35:38 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Eine Form in einer DLL soll angezeigt werden on Sat, 28 May 2005 16:35:38 GMT]]></title><description><![CDATA[<p>tach auch</p>
<p>ich habe eine DLL mit dem DLL Experten erstellt. also ein standard grundgerüst.<br />
Dann dem projekt ein neues formular hinzugefügt (Form2). nun möchte ich aus einer exe anwendung (ebenfalls BCB) die DLL laden und dann die Form2 aus der DLL anzeigen lassen. ich kriege aber eine schutzverletzung wenn ich in der exportierten funktion die form anzeigen will. wenn ich das ganze mit einer messagebox mache, klappt es.</p>
<p>DLL code:</p>
<pre><code class="language-cpp">#include &lt;vcl.h&gt;
#include &lt;windows.h&gt;
#include &quot;Unit2.h&quot;
#pragma hdrstop
//---------------------------------------------------------------------------
#pragma argsused
//---------------------------------------------------------------------------
__declspec(dllexport) void __stdcall Registration(); 
//---------------------------------------------------------------------------
void __stdcall Registration()
{
	//MessageBox(NULL,&quot;geht&quot;,&quot;&quot;,48);
	Form2-&gt;ShowModal();
}
//---------------------------------------------------------------------------
int WINAPI DllEntryPoint(HINSTANCE hinst, unsigned long reason, void* lpReserved)
{
	return 1;
}
</code></pre>
<p>EXE code:</p>
<pre><code class="language-cpp">#include &lt;vcl.h&gt;
#pragma hdrstop

#include &quot;Unit1.h&quot;
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource &quot;*.dfm&quot;
TForm1 *Form1;
//---------------------------------------------------------------------------
__declspec(dllimport) void __stdcall Registration();
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
	: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
    HWND LoadDLL = LoadLibrary(&quot;Project1.dll&quot;);
	if(LoadDLL)
    {
    	Registration();
        FreeLibrary(LoadDLL);	
    }	
    else
    {
    	MessageBox(NULL,&quot;DLL konnte nicht geladen werden!&quot;,&quot;Fehler&quot;,16);
    }
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/797955</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/797955</guid><dc:creator><![CDATA[wurstkopf]]></dc:creator><pubDate>Sat, 28 May 2005 16:35:38 GMT</pubDate></item><item><title><![CDATA[Reply to Eine Form in einer DLL soll angezeigt werden on Sun, 29 May 2005 09:17:35 GMT]]></title><description><![CDATA[<p>Morgen kann ich dir meinen Code Posten mit dem ich das mal gemacht habe.<br />
Allerdings hatte ich keine Probleme damit. Liegt es evtl. an der ShowModal() Funktion?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/798136</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/798136</guid><dc:creator><![CDATA[Clip]]></dc:creator><pubDate>Sun, 29 May 2005 09:17:35 GMT</pubDate></item><item><title><![CDATA[Reply to Eine Form in einer DLL soll angezeigt werden on Sun, 29 May 2005 09:36:33 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>Steht im FAQ : <a href="http://www.c-plusplus.net/forum/viewtopic-var-t-is-39265.html" rel="nofollow">http://www.c-plusplus.net/forum/viewtopic-var-t-is-39265.html</a></p>
<p>Nash</p>
]]></description><link>https://www.c-plusplus.net/forum/post/798140</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/798140</guid><dc:creator><![CDATA[Nash]]></dc:creator><pubDate>Sun, 29 May 2005 09:36:33 GMT</pubDate></item></channel></rss>