DLL in einer HTML-Datei



  • Ihr kennt sicherlich alle diese Funktion für Foren usw. von ICQ die eine Blume via DLL ausgibt. Beispiel: http://wwp.icq.com/scripts/online.dll?icq=nummer&img=5. Ich habe die DLL im Borland C++ Builder 6 gemacht und es auch schon geschafft, dass die Dll auf meinem Server eine Datei namens Test.txt anlegt. Das war net weiter schwierig nur wie kann ich:
    a) Daten vom Browser an die DLL weitergeben
    b) Daten an das Bild senden (z.B.: Das das Bild einer Blume angezeigt wird)

    Hier mein Code bislang (ich weiß sehr primitiv)

    //---------------------------------------------------------------------------
    
    #include <vcl.h>
    #include <windows.h>
    #pragma hdrstop
    //---------------------------------------------------------------------------
    
    //---------------------------------------------------------------------------
    #pragma argsused
    int WINAPI DllEntryPoint(HINSTANCE hinst, unsigned long reason, void* lpReserved, int gesendet) //gesendet sollte die gesendeten Daten erhalten
    {
    TMemo *Memo1 = new TMemo(hinst);
    Memo1->Text=IntToStr(gesendet);
    Memo1->Lines->SaveToFile("C:\\Jana\\HTML\\MarkusLoad\\test.txt");
    return 1;
    }
    //---------------------------------------------------------------------------
    

    Hier mein HTML Code:

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    
    <html>
    <head>
    	<title>Untitled</title>
    </head>
    <body>
    <img src="MusicLoad.dll?testing=555" border="0">
    </body>
    </html>
    

    Nach meiner Logik müsste die Datei test.txt jetzt 555 enthalten.
    Sie enthält aber: 17223612 😕

    Hoffe ihr könnt mir helfen.



  • Mit der Indy Komponente TIdHTTPServer



  • Mit

    TIdHTTPServer *HTTPServer = new TIdHTTPServer(hinst);
    

    klappt das aber net

    [C++ Error] DLL.cpp(31): E2451 Undefined symbol 'TIdHTTPServer'
    

    und mit TIdHTTPCostumServer hab ichs auch schon versucht.
    Welche Header oder Lib muss ich einbinden und wie?



  • Hab mittlerweile herausgefunden welche Header Dateien ich includen muss:

    //---------------------------------------------------------------------------
    
    #include <vcl.h>
    #include <windows.h>
    #include <IdHTTPServer.hpp>
    #include <IdBaseComponent.hpp>
    #include <IdComponent.hpp>
    #include <IdHTTPServer.hpp>
    #include <IdTCPServer.hpp>
    #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 "char *" 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, int testing)
    {
    TMemo *Memo1 = new TMemo(hinst);
    TIdHTTPServer *Server = new TIdHTTPServer(Memo1);
    Memo1->Text=IntToStr(testing);
    Memo1->Lines->SaveToFile("C:\\Jana\\HTML\\MarkusLoad\\test.txt");
    return 1;
    }
    
    //---------------------------------------------------------------------------
    

    Ich weiß nur nicht wie ich das Richtig abfange.



  • Was willst du eigentlich machen?

    Mit der Komponente TIdHTTPServer, die du z.B. einen Server (als .exe File) proggen, der auf Anforderung deine .dll lädt und ausführt.

    Oder wer der was soll deine .dll laden?



  • Ich habe einen HTTP-Server (www.janaserver.de) der HTTP-Server ist zu vergleichen mit dem von Apache. Ich lade auf meinem Server die Datei test.html in der folgender Quelltext steht:

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    
    <html>
    <head>
        <title>Untitled</title>
    </head>
    <body>
    <img src="MusicLoad.dll?testing=555" border="0">
    </body>
    </html>
    

    Durch das Bild wird auf meinem Server die Datei MusicLoad.dll ausgeführt.
    Und ich wüsste jetzt gerne wie ich die DLL dazu kriegen kann den parameter testing zu kriegen.
    Außerdem würde mich interessieren wie die DLL der HTML vortäuschen kann das sie ein Bild ist und je nach meiner Wahl ein Bild beinhaltet.



  • Das ist Aufgabe des HTTP Servers, falls er .dll's überhaupt unterstützt.
    Wohl eher eine Frage für das janaforum.



  • Hi,
    ich schätze mal du willst irgendetwas in Richtung CGI machen! Suche mal im Webzeugs Forum nach CGI!

    MfG

    Alexander Sulfrian


Anmelden zum Antworten