<?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[VCL-Komponenten in der DLL und die Applikation lässt sich nicht mehr minimieren]]></title><description><![CDATA[<p>Hallöchen!</p>
<p>Ich habe in meine Hauptapplikation eine DLL mit VCL-Komponenten eingebunden. Sobald ich jetzt innerhalb der DLL z.B. einen TTimer nutze (das Anlegen mit new und das sofortige Löschen mit delete reicht aus), kann ich meine Hauptapplikation nicht mehr minimieren. Geht einfach nicht. Das Fenster verschwindet zwar im Hintergrund, bzw. wird deaktiviert, aber minimiert wird es eben nicht.</p>
<p>Das Ganze konnte ich auch nachvollziehen, indem ich einfach eine neue Applikation und ein Dll-Projekt erstellt habe. Innerhalb der Dll habe ich eine Funktion exportiert, die nix anderes macht als einen Timer anzulegen und wieder zu löschen.</p>
<p>Sobald ich diese Funktion in die Hauptapplikation einbinde und ausführe kann ich nicht mehr minimieren.</p>
<p>Jemand von euch ne Idee?</p>
<p>Ich habe von allein schon heraus gefunden, dass ich das Problem mit dem Timer lösen kann, indem ich in der DLL von der VCL auf die CLX umsteige, aber ich habe innerhalb meine ursprünglichen DLL auch noch einen TComPort und dort hilft das gar nix.</p>
<p>Hier mal kurz die Quellen zur DLL:</p>
<pre><code class="language-cpp">//---------------------------------------------------------------------------

#include &lt;vcl.h&gt;
#include &lt;windows.h&gt;
#pragma hdrstop
//---------------------------------------------------------------------------
//   Important note about DLL memory management when your DLL uses the
//   static version of the RunTime Library:
//
//   If your DLL exports any functions that pass String objects (or structs/
//   classes containing nested Strings) as parameter or function results,
//   you will need to add the library MEMMGR.LIB to both the DLL project and
//   any other projects that use the DLL.  You will also need to use MEMMGR.LIB
//   if any other projects which use the DLL will be performing new or delete
//   operations on any non-TObject-derived classes which are exported from the
//   DLL. Adding MEMMGR.LIB to your project will change the DLL and its calling
//   EXE's to use the BORLNDMM.DLL as their memory manager.  In these cases,
//   the file BORLNDMM.DLL should be deployed along with your DLL.
//
//   To avoid using BORLNDMM.DLL, pass string information using &quot;char *&quot; or
//   ShortString parameters.
//
//   If your DLL uses the dynamic version of the RTL, you do not need to
//   explicitly add MEMMGR.LIB as this will be done implicitly for you
//---------------------------------------------------------------------------

#pragma argsused
int WINAPI DllEntryPoint(HINSTANCE hinst, unsigned long reason, void* lpReserved)
{
        return 1;
}
//---------------------------------------------------------------------------

void __declspec(dllexport) __stdcall DoItDll(TObject *Owner)
{
  TTimer *tmr = new TTimer((TComponent*)Owner);
  //TTimer *tmr = new TTimer(NULL);       //gleiches Ergebnis :-(  
  delete tmr;
}
//---------------------------------------------------------------------------
</code></pre>
<p>Hier der Header vom Hauptformular:</p>
<pre><code class="language-cpp">//---------------------------------------------------------------------------

#ifndef MainH
#define MainH
//---------------------------------------------------------------------------
#include &lt;Classes.hpp&gt;
#include &lt;Controls.hpp&gt;
#include &lt;StdCtrls.hpp&gt;
#include &lt;Forms.hpp&gt;
//---------------------------------------------------------------------------

__declspec(dllimport) void __stdcall DoItDll(TObject *Owner);
//---------------------------------------------------------------------------

class TMainForm : public TForm
{
__published:	// IDE-managed Components
private:	// User declarations
public:		// User declarations
        __fastcall TMainForm(TComponent* Owner);
};
//---------------------------------------------------------------------------
extern PACKAGE TMainForm *MainForm;
//---------------------------------------------------------------------------
#endif
</code></pre>
<p>Und hier noch das Hauptformular selbst:</p>
<pre><code class="language-cpp">//---------------------------------------------------------------------------

#include &lt;vcl.h&gt;
#pragma hdrstop

#include &quot;Main.h&quot;
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource &quot;*.dfm&quot;
TMainForm *MainForm;
//---------------------------------------------------------------------------
__fastcall TMainForm::TMainForm(TComponent* Owner)
        : TForm(Owner)
{
  DoItDll(Owner);
}
//---------------------------------------------------------------------------
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/topic/96829/vcl-komponenten-in-der-dll-und-die-applikation-lässt-sich-nicht-mehr-minimieren</link><generator>RSS for Node</generator><lastBuildDate>Sat, 11 Jul 2026 12:32:32 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/96829.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 05 Jan 2005 14:09:35 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to VCL-Komponenten in der DLL und die Applikation lässt sich nicht mehr minimieren on Wed, 05 Jan 2005 14:09:35 GMT]]></title><description><![CDATA[<p>Hallöchen!</p>
<p>Ich habe in meine Hauptapplikation eine DLL mit VCL-Komponenten eingebunden. Sobald ich jetzt innerhalb der DLL z.B. einen TTimer nutze (das Anlegen mit new und das sofortige Löschen mit delete reicht aus), kann ich meine Hauptapplikation nicht mehr minimieren. Geht einfach nicht. Das Fenster verschwindet zwar im Hintergrund, bzw. wird deaktiviert, aber minimiert wird es eben nicht.</p>
<p>Das Ganze konnte ich auch nachvollziehen, indem ich einfach eine neue Applikation und ein Dll-Projekt erstellt habe. Innerhalb der Dll habe ich eine Funktion exportiert, die nix anderes macht als einen Timer anzulegen und wieder zu löschen.</p>
<p>Sobald ich diese Funktion in die Hauptapplikation einbinde und ausführe kann ich nicht mehr minimieren.</p>
<p>Jemand von euch ne Idee?</p>
<p>Ich habe von allein schon heraus gefunden, dass ich das Problem mit dem Timer lösen kann, indem ich in der DLL von der VCL auf die CLX umsteige, aber ich habe innerhalb meine ursprünglichen DLL auch noch einen TComPort und dort hilft das gar nix.</p>
<p>Hier mal kurz die Quellen zur DLL:</p>
<pre><code class="language-cpp">//---------------------------------------------------------------------------

#include &lt;vcl.h&gt;
#include &lt;windows.h&gt;
#pragma hdrstop
//---------------------------------------------------------------------------
//   Important note about DLL memory management when your DLL uses the
//   static version of the RunTime Library:
//
//   If your DLL exports any functions that pass String objects (or structs/
//   classes containing nested Strings) as parameter or function results,
//   you will need to add the library MEMMGR.LIB to both the DLL project and
//   any other projects that use the DLL.  You will also need to use MEMMGR.LIB
//   if any other projects which use the DLL will be performing new or delete
//   operations on any non-TObject-derived classes which are exported from the
//   DLL. Adding MEMMGR.LIB to your project will change the DLL and its calling
//   EXE's to use the BORLNDMM.DLL as their memory manager.  In these cases,
//   the file BORLNDMM.DLL should be deployed along with your DLL.
//
//   To avoid using BORLNDMM.DLL, pass string information using &quot;char *&quot; or
//   ShortString parameters.
//
//   If your DLL uses the dynamic version of the RTL, you do not need to
//   explicitly add MEMMGR.LIB as this will be done implicitly for you
//---------------------------------------------------------------------------

#pragma argsused
int WINAPI DllEntryPoint(HINSTANCE hinst, unsigned long reason, void* lpReserved)
{
        return 1;
}
//---------------------------------------------------------------------------

void __declspec(dllexport) __stdcall DoItDll(TObject *Owner)
{
  TTimer *tmr = new TTimer((TComponent*)Owner);
  //TTimer *tmr = new TTimer(NULL);       //gleiches Ergebnis :-(  
  delete tmr;
}
//---------------------------------------------------------------------------
</code></pre>
<p>Hier der Header vom Hauptformular:</p>
<pre><code class="language-cpp">//---------------------------------------------------------------------------

#ifndef MainH
#define MainH
//---------------------------------------------------------------------------
#include &lt;Classes.hpp&gt;
#include &lt;Controls.hpp&gt;
#include &lt;StdCtrls.hpp&gt;
#include &lt;Forms.hpp&gt;
//---------------------------------------------------------------------------

__declspec(dllimport) void __stdcall DoItDll(TObject *Owner);
//---------------------------------------------------------------------------

class TMainForm : public TForm
{
__published:	// IDE-managed Components
private:	// User declarations
public:		// User declarations
        __fastcall TMainForm(TComponent* Owner);
};
//---------------------------------------------------------------------------
extern PACKAGE TMainForm *MainForm;
//---------------------------------------------------------------------------
#endif
</code></pre>
<p>Und hier noch das Hauptformular selbst:</p>
<pre><code class="language-cpp">//---------------------------------------------------------------------------

#include &lt;vcl.h&gt;
#pragma hdrstop

#include &quot;Main.h&quot;
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource &quot;*.dfm&quot;
TMainForm *MainForm;
//---------------------------------------------------------------------------
__fastcall TMainForm::TMainForm(TComponent* Owner)
        : TForm(Owner)
{
  DoItDll(Owner);
}
//---------------------------------------------------------------------------
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/687561</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/687561</guid><dc:creator><![CDATA[DasLachendeKnie]]></dc:creator><pubDate>Wed, 05 Jan 2005 14:09:35 GMT</pubDate></item><item><title><![CDATA[Reply to VCL-Komponenten in der DLL und die Applikation lässt sich nicht mehr minimieren on Wed, 05 Jan 2005 14:27:07 GMT]]></title><description><![CDATA[<p>nur so ganz dumm in den Raum geworfen:</p>
<p>Gibt es das gleiche Problem wenn Du nicht die VCL-Timer-Komponente verwendest, sondern den Win-API-Timer?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/687582</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/687582</guid><dc:creator><![CDATA[[[global:guest]]]]></dc:creator><pubDate>Wed, 05 Jan 2005 14:27:07 GMT</pubDate></item><item><title><![CDATA[Reply to VCL-Komponenten in der DLL und die Applikation lässt sich nicht mehr minimieren on Wed, 05 Jan 2005 14:47:28 GMT]]></title><description><![CDATA[<p>Joe_M. schrieb:</p>
<blockquote>
<p>nur so ganz dumm in den Raum geworfen:</p>
<p>Gibt es das gleiche Problem wenn Du nicht die VCL-Timer-Komponente verwendest, sondern den Win-API-Timer?</p>
</blockquote>
<p>Ich war ganz kurz in Versuchung mal nen Win-API-Timer auszuprobieren, doch dann holte mich die Wirklichkeit wieder ein -&gt; Ich hab vorhin das Gleiche mit nem TButton probiert, Effekt war der gleiche, Minimieren geht nimmer <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f61e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--disappointed_face"
      title=":("
      alt="😞"
    /></p>
<p>Ich habe noch die Vermutung, dass es etwas mit dem Botschaftenaustausch zu tun haben könnte. Ich habe vorhin irgendwo gelesen, dass der bei der CLX anders abläuft als in der VCL (welche ja das Botschaftssystem der Win-API nutzt).</p>
<p>Als ich mir eben mal den Quelltext vom TTimer in VCL und CLX angeschaut habe und ein paar Zeilen Code davon einzeln in meine DLL gapackt habe, hab ich auch gefunden dass der Aufruf: &quot;Application.HandleException(Self);&quot; für das Nicht-Minimieren-Können veranwortlich ist. Es reicht, wenn die Zeile mit Compiliert wird. Sie muss nichtmal aufgerufen werden.. <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>
<pre><code class="language-cpp">procedure TTimer.WndProc(var Msg: TMessage);
begin
  with Msg do
    if Msg = WM_TIMER then
      try
        Timer;
      except
        Application.HandleException(Self);
      end
    else
      Result := DefWindowProc(FWindowHandle, Msg, wParam, lParam);
end;
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/687618</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/687618</guid><dc:creator><![CDATA[DasLachendeKnie]]></dc:creator><pubDate>Wed, 05 Jan 2005 14:47:28 GMT</pubDate></item></channel></rss>