Solved

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

Posted on 2002-04-09
3
274 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
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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

828 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