Solved

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

Posted on 2002-04-09
3
288 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 11

Accepted Solution

by:
robert_marquardt earned 200 total points
ID: 6930381
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
ID: 6930388
The header does not contain any obvious calls to a DLL function.
0
 

Author Comment

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

Bye
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…

726 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