Solved

Can you call a OOP C++ DLL function ?????

Posted on 2002-04-09
3
258 Views
Last Modified: 2013-11-23
Hi
I have to interface a OOP DLL to get an address.
Here's The Header:

---------
/*
** RCAgent.h - Common interface for Radiocor Agent DLL
*/

#if ! defined (_RCAGENT_H_)
#define _RCAGENT_H_

#if defined (RCAGENT_EXPORT)
#define RCAGENT_EXT_CLASS     __declspec(dllexport)
#else
#define RCAGENT_EXT_CLASS     __declspec(dllimport)
#endif

// To be used to get user's credentials
class RCAGENT_EXT_CLASS CRCDLogon
{
private:
     bool m_bFlgPutCert;      // Per avere il mac address pulito senza nessuna lettera davanti

public:
     CRCDLogon(void)
     {
          Init();
     };
     
     CRCDLogon(bool bOldStyle, bool bInitCert=true)
     {
          Init();
          m_bFlgPutCert = bInitCert;
     }

     virtual ~CRCDLogon(){};

     void Init()
     {
          m_bFlgPutCert = true;
     }

     // this method must be called during client login
     //
     // Return codes:
     // -1 +Arena must terminate
     //  0 username and password to be passed to RAPI
     //  1 +Arena asks username/password to user

     int Logon(HANDLE hWnd, CString& UserName, CString& Password, bool bServer = false);
     int GetVersion(CString& Version);
};

//
class RCAGENT_EXT_CLASS CRCDAgent
{
public:
     CRCDAgent(void);
     virtual ~CRCDAgent();

     int Start(int idSvc = 0, long flType = 0);
     int Stop(void);

     int PutData(const char* pName, const char* pbData);

     int GetItemList (CStringArray& itemList);
     int OnIdle(void);

     int GetVersion(CString& Version);
};

#endif     // _RCAGENT_H_


---------

And here's a C++ sample

--------
// TestCertificato.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include "RCAgent.h"


int main(int argc, char* argv[])
{
     CString strCert, strPassword;
     CRCDLogon* pLogonInfo = new CRCDLogon;
     pLogonInfo->Logon(NULL, strCert, strPassword, FALSE);
     printf("\nIl sertificato e': %s", strCert);
     delete pLogonInfo;

     return 0;
}

--------

Logon is the only function I need to call

Can it be done in Delphi 6 Ent.

Thanks in advance
Marco
0
Comment
Question by:mgesiot
  • 2
3 Comments
 
LVL 11

Accepted Solution

by:
robert_marquardt earned 200 total points
Comment Utility
Normally not, because like in Delphi a hidden Self/This parameter is handed to the method and these objects are incompatible.
Making a C++ API for a DLL is a common abuse of the DLL concept.
0
 
LVL 11

Expert Comment

by:robert_marquardt
Comment Utility
The header does not contain any obvious calls to a DLL function.
0
 

Author Comment

by:mgesiot
Comment Utility
Thanks
I ednded up having the DLL programmers to
develop a type library around the DLL,
and it works !!!

Bye
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now