Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. International
  3. Portuguese
  4. Dll Qt para Delphi
Forum Updated to NodeBB v4.3 + New Features

Dll Qt para Delphi

Scheduled Pinned Locked Moved Portuguese
2 Posts 2 Posters 2.3k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • F Offline
    F Offline
    flaviomarcio
    wrote on last edited by
    #1

    Olá boa tarde

    Estou tentando utilizar uma Dll feita em QT mas não estou me saindo muito bem, estou tendo dificuldades de importar o tipo correto no Delphi se é que esse e o problema mesmo.

    O que ocorre um um erro aparentemente na Dll do QT, pois lá aparece Microsoft Visual C++ Error informando que o programa vai terminar inesperadamente, como a mensagem não é comum de forma nenhum no Delphi penso que poderia ser no QT ou algo do tipo, já que ocorre quando tento executar a função extraída da DLL Qt.

    OS dados são:

    #define QDLL_EXPORT Q_DECL_EXPORT
    #ifndef QDLL_EXPORT_000_GLOBAL_H
    #define QDLL_EXPORT_000_GLOBAL_H

    .H
    #include <shlobj.h>
    #include <iostream>

    extern "C"
    {
    QDLL_EXPORT bool compressFile(PWCHAR *cfileSource, PWCHAR *cfileDestine);
    QDLL_EXPORT bool UncompressFile(PWCHAR *cfileSource, PWCHAR *cfileDestine);
    }

    #endif // SW_COMPRESS_FILES_DLL_000_GLOBAL_H

    .CPP

    #include <QFile>
    #include <QtCore/qglobal.h>
    #include <QMessageBox>
    #include "sw_compress_files_dll_000_global.h"

    bool compressFile(PWCHAR *cfileSource, PWCHAR *cfileDestine)
    {
    Q_UNUSED(cfileSource);
    Q_UNUSED(cfileDestine);

    QMessageBox::warning(0,"A","A");
    

    }

    bool UncompressFile(PWCHAR *cfileSource, PWCHAR *cfileDestine)
    {
    Q_UNUSED(cfileSource);
    Q_UNUSED(cfileDestine);
    QMessageBox::warning(0,"B","B");
    return true;
    }

    Delphi:

    type TQCompress =function(cfileSource:PWChar;cfileDestine:PWChar):BOOL stdcall;

    procedure TForm1.XPButton1Click(Sender: TObject);
    const dll='c:\test\sw_compress_files_dll_000.dll';
    var com:TQCompress;
    var dec:TQCompress;
    var iqt:THandle;

      function GetFun(fName:String):FARPROC;
      var F:FARPROC;
    
      begin
    
           F:=GetProcAddress(iqt, PChar(Trim(fName)));
           Result:=F;
      end;
    

    const filesource:PWChar='C:\temp\notacred[8497].pdf';
    const filedesctine:PWChar='C:\temp\notacred[8497].com';

    begin
    iqt:=LoadLibrary(dll);

     com:=GetFun('compressFile');
     dec:=GetFun('UncompressFile');
    
     com(PWChar(filesource), PWChar(filedesctine));
    
     dec(PWChar(filesource),PWChar(filedesctine));
    
    
     FreeLibrary(iqt);
    

    end;

    end.

    Flavio Portela

    1 Reply Last reply
    0
    • R Offline
      R Offline
      Rodrigocg
      wrote on last edited by
      #2

      vc tem o header da dll?

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved