<?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[problem mit com object in asp]]></title><description><![CDATA[<p>also ich hab folgendes problem: <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="🙂"
    /><br />
ich muss ein com object fuer asp entwickeln das etwas bestimmtes zeichnet. die funktion zum zeichnen ist jedoch in einem anderen com object desen source ich nicht veraendern kann. dieses com object stellt leider zum zeichnen nur die funktion</p>
<pre><code class="language-cpp">void PrintWnd((long) hWnd,long WndBreite)
</code></pre>
<p>zur verfuegung. die funktion zeichnet also normalerweise in einen dialog. Da man als Com object die vom asp aufgerufen wird kein fenster erzeugen kann faellt diese option weck.<br />
ich habs mit folgendem code probiert</p>
<pre><code class="language-cpp">try{
         CDC dc;
	CWnd *pWnd = CWnd::GetDesktopWindow();
	CDC *pDC = pWnd-&gt;GetDC();
	if( pDC == NULL ){
		_ASSERTE(false);
		return 0;
	}
	if( !dc.CreateCompatibleDC(pDC)){
		_ASSERTE(false);
		return 0;
	}

	CBitmap bm;
	if(!bm.CreateCompatibleBitmap(pDC, m_Width, m_Heigth)){
		_ASSERTE(false);
		return 0;	
	}

	CBitmap *pbmTmp =dc.SelectObject(&amp;bm);
	CoInitialize(NULL);
	ILdm2Ptr myptr(__uuidof(Document));
	myptr-&gt;PutSprache(m_Language);
	if(!myptr-&gt;OpenLayout(m_LayoutFileName.AllocSysString()))
		filename=m_ErrorImageFileName;
	if(!myptr-&gt;OpenLvk(0,m_LvkFileName.AllocSysString()))
		filename=m_ErrorImageFileName;
	CRect rcClient;
	pWnd-&gt;GetClientRect( rcClient );
	VARIANT_BOOL bReturn = myptr-&gt;PrintWnd((long)pWnd-&gt;m_hWnd,rcClient.Size().cx);

	CImage myImage;
	myImage.Attach(bm);
	myImage.Save(filename);
	myImage.Detach();
	myImage.Destroy();
	dc.SelectObject(pbmTmp);
	if( bm.m_hObject!=NULL )
		bm.DeleteObject();

	pWnd-&gt;ReleaseDC(pDC);
	dc.DeleteDC();
	myptr.Release();		
}
catch(_com_error &amp;err)
{
	_ASSERT(err.ErrorMessage());
}
</code></pre>
<p>wenn ich printwnd wecklasse wird ein bild erzeugt, auf dem dc herumzeichnen funktnioniert auch.<br />
sobald ich printwnd wieder verwende kann kein bild mehr erzeugt werden.</p>
<p>gibt es vielleicht eine moeglich keit dem hwnd ein dc &quot;unterzujubeln&quot;? <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>im voraus danke<br />
wuschu</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/43737/problem-mit-com-object-in-asp</link><generator>RSS for Node</generator><lastBuildDate>Sat, 25 Apr 2026 02:31:05 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/43737.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 24 Jul 2003 13:13:23 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to problem mit com object in asp on Thu, 24 Jul 2003 13:13:23 GMT]]></title><description><![CDATA[<p>also ich hab folgendes problem: <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="🙂"
    /><br />
ich muss ein com object fuer asp entwickeln das etwas bestimmtes zeichnet. die funktion zum zeichnen ist jedoch in einem anderen com object desen source ich nicht veraendern kann. dieses com object stellt leider zum zeichnen nur die funktion</p>
<pre><code class="language-cpp">void PrintWnd((long) hWnd,long WndBreite)
</code></pre>
<p>zur verfuegung. die funktion zeichnet also normalerweise in einen dialog. Da man als Com object die vom asp aufgerufen wird kein fenster erzeugen kann faellt diese option weck.<br />
ich habs mit folgendem code probiert</p>
<pre><code class="language-cpp">try{
         CDC dc;
	CWnd *pWnd = CWnd::GetDesktopWindow();
	CDC *pDC = pWnd-&gt;GetDC();
	if( pDC == NULL ){
		_ASSERTE(false);
		return 0;
	}
	if( !dc.CreateCompatibleDC(pDC)){
		_ASSERTE(false);
		return 0;
	}

	CBitmap bm;
	if(!bm.CreateCompatibleBitmap(pDC, m_Width, m_Heigth)){
		_ASSERTE(false);
		return 0;	
	}

	CBitmap *pbmTmp =dc.SelectObject(&amp;bm);
	CoInitialize(NULL);
	ILdm2Ptr myptr(__uuidof(Document));
	myptr-&gt;PutSprache(m_Language);
	if(!myptr-&gt;OpenLayout(m_LayoutFileName.AllocSysString()))
		filename=m_ErrorImageFileName;
	if(!myptr-&gt;OpenLvk(0,m_LvkFileName.AllocSysString()))
		filename=m_ErrorImageFileName;
	CRect rcClient;
	pWnd-&gt;GetClientRect( rcClient );
	VARIANT_BOOL bReturn = myptr-&gt;PrintWnd((long)pWnd-&gt;m_hWnd,rcClient.Size().cx);

	CImage myImage;
	myImage.Attach(bm);
	myImage.Save(filename);
	myImage.Detach();
	myImage.Destroy();
	dc.SelectObject(pbmTmp);
	if( bm.m_hObject!=NULL )
		bm.DeleteObject();

	pWnd-&gt;ReleaseDC(pDC);
	dc.DeleteDC();
	myptr.Release();		
}
catch(_com_error &amp;err)
{
	_ASSERT(err.ErrorMessage());
}
</code></pre>
<p>wenn ich printwnd wecklasse wird ein bild erzeugt, auf dem dc herumzeichnen funktnioniert auch.<br />
sobald ich printwnd wieder verwende kann kein bild mehr erzeugt werden.</p>
<p>gibt es vielleicht eine moeglich keit dem hwnd ein dc &quot;unterzujubeln&quot;? <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>im voraus danke<br />
wuschu</p>
]]></description><link>https://www.c-plusplus.net/forum/post/316509</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/316509</guid><dc:creator><![CDATA[wuschu]]></dc:creator><pubDate>Thu, 24 Jul 2003 13:13:23 GMT</pubDate></item><item><title><![CDATA[Reply to problem mit com object in asp on Fri, 25 Jul 2003 06:48:14 GMT]]></title><description><![CDATA[<p>Kommst Du net anders an die Daten ran, die PrintWnd auf das Fenster schreibt?</p>
<p>P.S.<br />
AllocSysString erzeugt einen BSTR, soweit richtig. Allerdings bist du für die Zerstörung verantwortlich</p>
<blockquote>
<p>Commonly, if this string is passed to a COM function (as an [in] parameter) this requires the caller to free the string. This can be done by using SysFreeString, as described in the Platform SDK.</p>
</blockquote>
]]></description><link>https://www.c-plusplus.net/forum/post/317116</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/317116</guid><dc:creator><![CDATA[RenéG]]></dc:creator><pubDate>Fri, 25 Jul 2003 06:48:14 GMT</pubDate></item><item><title><![CDATA[Reply to problem mit com object in asp on Fri, 25 Jul 2003 08:05:17 GMT]]></title><description><![CDATA[<p>danke erstmal das wenigsten jemand mal antwortet <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>nein leider komm ich nicht anderst an die daten ran, normalerweise zeichnet man ja auf ein dc<br />
keine ahnung warum dieser entwickler das anderst gemacht hat.</p>
<p>ja normalerweise verwende ich ja CComBSTR und lösche diese wieder mit ::SysFreeString</p>
<p>ich hab es jetzt mal probiert das hdc des desktops zu bekommen mit GetDC(NULL) und dan<br />
dem dc zu attachen. funktioniert leider auch nicht.<br />
es muss doch eine möglichkeit geben dem CWnd ein DC unterzuschieben.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/317171</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/317171</guid><dc:creator><![CDATA[wuschu]]></dc:creator><pubDate>Fri, 25 Jul 2003 08:05:17 GMT</pubDate></item><item><title><![CDATA[Reply to problem mit com object in asp on Fri, 25 Jul 2003 08:14:59 GMT]]></title><description><![CDATA[<p>Kannst Du mal die Schnittstelle posten?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/317184</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/317184</guid><dc:creator><![CDATA[RenéG]]></dc:creator><pubDate>Fri, 25 Jul 2003 08:14:59 GMT</pubDate></item><item><title><![CDATA[Reply to problem mit com object in asp on Fri, 25 Jul 2003 08:29:38 GMT]]></title><description><![CDATA[<p>weiss jetzt nicht so genau was du meinst aber alle infos die ich zu diesem com object hab sind im ersten posting drinnen. ich habe ein kleines testprog dafuer geschriben. dort hat das zeichnen ohne probleme funktioniert auch konnte ich das erzeugte bild speichern. abaer das testprog hatte ja auch ein fenster. <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>also dokumentation zu diesem com object hab ich auch nur ein word dokument mit den funktionen oben bekommen. die PrintWnd ist die einzige Funktion um irgend eine Ausgabe zu erstellen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/317203</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/317203</guid><dc:creator><![CDATA[wuschu]]></dc:creator><pubDate>Fri, 25 Jul 2003 08:29:38 GMT</pubDate></item><item><title><![CDATA[Reply to problem mit com object in asp on Fri, 25 Jul 2003 11:18:12 GMT]]></title><description><![CDATA[<p>Du hast wahrscheinlich die Typbibliothek mit '#import....' in dein Programm eingebunden. Daraufhin erstellt der Compiler im Ausgabeverzeichnis eine *.tlh-Datei. Diese geöffnet, steht das Interface mit allen Funktionen als struct drin. Und dieses postest du mal.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/317363</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/317363</guid><dc:creator><![CDATA[RenéG]]></dc:creator><pubDate>Fri, 25 Jul 2003 11:18:12 GMT</pubDate></item><item><title><![CDATA[Reply to problem mit com object in asp on Fri, 25 Jul 2003 11:24:05 GMT]]></title><description><![CDATA[<p>k verstanden was meinst</p>
<p>hier haste</p>
<pre><code class="language-cpp">// Created by Microsoft (R) C/C++ Compiler Version 13.00.9466 (59ef881f).
//
// c:\develop\webldm\iwebldm\debug\ldm2.tlh
//
// C++ source equivalent of Win32 type library ldm2.tlb
// compiler-generated file created 07/18/03 at 09:07:48 - DO NOT EDIT!

#pragma once
#pragma pack(push, 8)

#include &lt;comdef.h&gt;

//
// Forward references and typedefs
//

struct __declspec(uuid(&quot;2707b130-fc47-11d4-b84d-00d0b72347e2&quot;))
/* LIBID */ __Ldm2;
struct __declspec(uuid(&quot;2707b132-fc47-11d4-b84d-00d0b72347e2&quot;))
/* dispinterface */ ILdm2;
struct /* coclass */ Document;

//
// Smart pointer typedef declarations
//

_COM_SMARTPTR_TYPEDEF(ILdm2, __uuidof(ILdm2));

//
// Type library items
//

struct __declspec(uuid(&quot;2707b132-fc47-11d4-b84d-00d0b72347e2&quot;))
ILdm2 : IDispatch
{
    //
    // Property data
    //

    __declspec(property(get=GetHersteller,put=PutHersteller))
    _bstr_t Hersteller;
    __declspec(property(get=GetMessnummer,put=PutMessnummer))
    _bstr_t Messnummer;
    __declspec(property(get=GetBezeichnung,put=PutBezeichnung))
    _bstr_t Bezeichnung;
    __declspec(property(get=GetBestellnummer,put=PutBestellnummer))
    _bstr_t Bestellnummer;
    __declspec(property(get=GetUFaktor,put=PutUFaktor))
    double UFaktor;
    __declspec(property(get=GetMessneigung,put=PutMessneigung))
    double Messneigung;
    __declspec(property(get=GetDatum,put=PutDatum))
    _bstr_t Datum;

    //
    // Wrapper methods for error-handling
    //

    // Methods:
    HRESULT Beep ( );
    VARIANT_BOOL OpenLayout (
        _bstr_t LayoutName );
    HRESULT Show (
        short sShow );
    VARIANT_BOOL OpenLvk (
        long DatasetNumber,
        _bstr_t Filename );
    VARIANT_BOOL OpenBsv (
        long DatasetNumber,
        _bstr_t Filename );
    HRESULT PrintWnd (
        long hWnd,
        long WndBreite );
    VARIANT_BOOL PrintToFile (
        _bstr_t OutputFileName );
    VARIANT_BOOL PutAbmessungen (
        double Laenge,
        double Breite,
        double Hoehe );
    VARIANT_BOOL PutLichtaustritt (
        double Laenge,
        double Breite,
        double HoeheC0,
        double HoeheC90,
        double HoeheC180,
        double HoeheC270 );
    VARIANT_BOOL PutAnzahlBestueckungen (
        long Anzahl );
    VARIANT_BOOL PutLampentyp (
        long BestueckungsNr,
        _bstr_t Lampentyp );
    VARIANT_BOOL PutLichtstrom (
        long BestueckungsNr,
        double Lichtstrom );
    VARIANT_BOOL PutLichtfarbe (
        long BestueckungsNr,
        _bstr_t Lichtfarbe );
    VARIANT_BOOL PutAnschlussleistung (
        long BestueckungsNr,
        double Anschlussleistung );
    VARIANT_BOOL PutAnzahlLampen (
        long BestueckungsNr,
        long AnzahlLampen );
    HRESULT PutSprache (
        short SprachID );
    VARIANT_BOOL Print ( );
    VARIANT_BOOL SetLogo (
        _bstr_t Filename );
    double GetWirkungsgrad ( );
    double GetGesamtLichtstrom ( );
    double GetNennleistung ( );
    double GetUgr (
        short Richtung );
    short GetAnzahlLeuchten (
        double Laenge,
        double Breite,
        double Hoehe,
        double Beleuchtungsstaerke );
    _bstr_t GetLeuchtdichtebegrenzung ( );
    double GetDbMesslichtstromGesamt (
        _bstr_t Messnummer );
    double GetDbKurzMessLichtstrom (
        long Lampenlichtstrommessnummer );
    double GetDbLichtstromfaktor ( );
    double GetDbWirkungsgrad (
        short Typ );
    VARIANT_BOOL OpenLvkDb (
        long DatasetNumber,
        _bstr_t Messnummer );
    double GetMessLichtstromLampe ( );
    VARIANT_BOOL GetAbmessungen (
        BSTR * Typ,
        double * Laenge,
        double * Breite,
        double * Hoehe );
    VARIANT_BOOL GetLichtaustritt (
        BSTR * Typ,
        double * Laenge,
        double * Breite,
        double * HoeheC0,
        double * HoeheC90,
        double * HoeheC180,
        double * HoeheC270 );
    VARIANT_BOOL SetAbmessungsTyp (
        _bstr_t Typ );
    VARIANT_BOOL SetLichtaustrittsTyp (
        _bstr_t Typ );
    double GetBestueckungsLeistung (
        short BestueckungsNummer );
    _bstr_t GetLampenTyp (
        short BestueckungsNummer,
        short TypNummer );
    short GetLampenAnz (
        short BestueckungsNummer,
        short TypNummer );
    double GetLampenLichtstrom (
        short BestueckungsNummer,
        short TypNummer );
    VARIANT_BOOL SetLampenTyp (
        short BestueckungsNummer,
        short TypNummer,
        _bstr_t Typ );
    VARIANT_BOOL SetLampenAnz (
        short BestueckungsNummer,
        short TypNummer,
        short Anzahl );
    VARIANT_BOOL SetLampenLichtstrom (
        short BestueckungsNummer,
        short TypNummer,
        double Lichtstrom );
    VARIANT_BOOL SaveLvkAs (
        _bstr_t Filename,
        _bstr_t FileTyp );
    double GetWgPartiell (
        double Gamma1,
        double Gamma2,
        double C1,
        double C2 );
    _bstr_t GetBeschreibung ( );
    HRESULT SetBeschreibung (
        _bstr_t Beschreibung );

    // Properties:
    _bstr_t GetHersteller ( );
    void PutHersteller ( _bstr_t _val );
    _bstr_t GetMessnummer ( );
    void PutMessnummer ( _bstr_t _val );
    _bstr_t GetBezeichnung ( );
    void PutBezeichnung ( _bstr_t _val );
    _bstr_t GetBestellnummer ( );
    void PutBestellnummer ( _bstr_t _val );
    double GetUFaktor ( );
    void PutUFaktor ( double _val );
    double GetMessneigung ( );
    void PutMessneigung ( double _val );
    _bstr_t GetDatum ( );
    void PutDatum ( _bstr_t _val );
};

struct __declspec(uuid(&quot;2707b131-fc47-11d4-b84d-00d0b72347e2&quot;))
Document;
    // [ default ] dispinterface ILdm2

//
// Wrapper method implementations
//

#include &quot;c:\develop\webldm\iwebldm\debug\ldm2.tli&quot;

#pragma pack(pop)
</code></pre>
<p>ich glaub zwar nicht das dir das was hielft aber schaden kann es ja nicht<br />
zur info<br />
die Print() funktion druckt das nur<br />
und die PrintToFile() schreibt die anweiseungen des druckers in eine datei (keine ahnung wie ich das jetzt besser umschreiben koennte) die 2 funktionieren allerdings nicht im asp weil das ja kein zugriff auf den drucker zulaesst</p>
<p>mfg<br />
wuschu</p>
]]></description><link>https://www.c-plusplus.net/forum/post/317369</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/317369</guid><dc:creator><![CDATA[wuschu2]]></dc:creator><pubDate>Fri, 25 Jul 2003 11:24:05 GMT</pubDate></item><item><title><![CDATA[Reply to problem mit com object in asp on Fri, 25 Jul 2003 11:36:46 GMT]]></title><description><![CDATA[<p>Stehen jetzt in dem Fenster, welches von PrintWnd beschrieben wird, mehr Informationen als du über die Funktionen in der tlh bekommst?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/317381</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/317381</guid><dc:creator><![CDATA[RenéG]]></dc:creator><pubDate>Fri, 25 Jul 2003 11:36:46 GMT</pubDate></item><item><title><![CDATA[Reply to problem mit com object in asp on Fri, 25 Jul 2003 11:47:09 GMT]]></title><description><![CDATA[<p>ja stehen. auf dem fenster werden auch bilder und diagramme, tabellen gezeichnet<br />
sonst würde ich mir ja alles aus den anderen funktionen holen und das bild selber zeichen.</p>
<p>irgendwie muss es doch moeglich sein einem HWND ein dc unterzujubeln auf dem dann die funktion zeichnet. oder gibt es bessere möglichkeiten?</p>
<p>mfg<br />
wuschu</p>
]]></description><link>https://www.c-plusplus.net/forum/post/317398</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/317398</guid><dc:creator><![CDATA[wuschu2]]></dc:creator><pubDate>Fri, 25 Jul 2003 11:47:09 GMT</pubDate></item><item><title><![CDATA[Reply to problem mit com object in asp on Fri, 25 Jul 2003 12:20:38 GMT]]></title><description><![CDATA[<p>Kenn mich mit ASP net aus. Kann man da wenigstens Prozesse starten?<br />
Wenn ja, dann würde ich Dir empfehlen, einen Prozess mit einem Fenster zu starten, diesem dann das Interface übergeben und das Fenster zeichnen lassen.<br />
Wenn nein, weiss ich auch net weiter.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/317451</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/317451</guid><dc:creator><![CDATA[RenéG]]></dc:creator><pubDate>Fri, 25 Jul 2003 12:20:38 GMT</pubDate></item><item><title><![CDATA[Reply to problem mit com object in asp on Fri, 25 Jul 2003 13:26:17 GMT]]></title><description><![CDATA[<p>nein kann man nicht. als dll mal nicht und zugriff auf andere programme hat man auch nicht. also ich kann nicht einfach ein prog laufen lassen und auf das zugreifen. im asp läuft es in einem geschützten bereich.</p>
<p>hmm schade<br />
trotzdem danke, warscheinlich ist es sowiso gar nicht möglich und ich habe mich umsonst 2 wochen an diesem problem abgemüht <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>mfg<br />
wuschu</p>
]]></description><link>https://www.c-plusplus.net/forum/post/317534</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/317534</guid><dc:creator><![CDATA[wuschu]]></dc:creator><pubDate>Fri, 25 Jul 2003 13:26:17 GMT</pubDate></item></channel></rss>