Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

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

Posted on 2002-04-09
3
Medium Priority
?
304 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 600 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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…
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Suggested Courses
Course of the Month20 days, 21 hours left to enroll

810 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