Print Page | Close Window

C++ header files for iSED dll

Printed From: Debenu Quick PDF Library - PDF SDK Community Forum
Category: For Users of the Library
Forum Name: I need help - I can help
Forum Description: Problems and solutions while programming with the Debenu Quick PDF Library and Debenu PDF Viewer SDK
URL: http://www.quickpdf.org/forum/forum_posts.asp?TID=164
Printed Date: 25 Nov 24 at 2:32AM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: C++ header files for iSED dll
Posted By: Almi
Subject: C++ header files for iSED dll
Date Posted: 02 Nov 05 at 9:36AM

Does anybody have header files for C++ for iSED?




Replies:
Posted By: Ingo
Date Posted: 03 Nov 05 at 5:08AM
Hi Almi!

I've "googeled" a bit ... and i've found an old forum-post where somebody have the same problems with QuickPDF. Perhpas this could help you, too.

Try this link:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore/html/_core_getprocaddress.asp

You basically call LoadLibrary passing in the dll path. Then call GetProcAddress for the function pointers you want to use.

-------------
Cheers,
Ingo



Posted By: Stephen0838
Date Posted: 12 Dec 05 at 4:37PM

I have built a wrapper class in vc++6 that loads the DLL, Registers the reg code and has the commands I use  using the load libary function. a small sample of the code is below.

First create a data type for each command argument

the syntax is typdef return value (CALLBACK* type name)(input values);

typedef long (CALLBACK* ISED_Oint_PTR)();
typedef long (CALLBACK* ISED_Oint_Iint_PTR)(long);
typedef long (CALLBACK* ISED_Oint_Ichar_PTR)(char *);
typedef long (CALLBACK* ISED_Oint_Ichar_Iint_PTR)(char *, long);
typedef long (CALLBACK* ISED_Oint_Iddddiii_PTR)(double, double, double, double, long, long, long);
typedef long (CALLBACK* ISED_Oint_Iddd_PTR)(double, double, double);

Next declare the commands in a class

class CSECiSEDDLL
{
 public:
 //Methods
  CSECiSEDDLL();
  ~CSECiSEDDLL();
 //Data
  long      ErrorCode;
  bool      Loaded;
  bool      UnLocked;
  ISED_Oint_PTR    NewDocument;   
  ISED_Oint_Iint_PTR   SetOrigin;    
  ISED_Oint_Iint_PTR   SetMeasurementUnits; 
  ISED_Oint_Ichar_PTR   SetPageSize;   

private:
 //Methods
  void Unlock();
  void Init();
 //Data
  HINSTANCE     DLL_Handle;    // Handle to DLL
  string      UnlockCode;
  ISED_Oint_Ichar_PTR   UnlockKey;

};

Now code the class remember that the commands in the DLL are all prefaced with iSED

//start wrapper
CSECiSEDDLL::CSECiSEDDLL()
{
 UnLocked = false;
 Loaded = false;
 Init();
 UnlockCode = "XXXXXXXXXXXXX";
 Unlock();
}

CSECiSEDDLL::~CSECiSEDDLL()
{
 FreeLibrary(DLL_Handle);
}

void CSECiSEDDLL::Unlock()
{
 int errorcode;
 errorcode = UnlockKey (const_cast <char *> (UnlockCode.c_str()));
 if (errorcode != 0)
 {
  UnLocked = true;
 }
}

void CSECiSEDDLL::Init()
{
 DLL_Handle = LoadLibrary("iSEDQuickPDF.dll");
 if (DLL_Handle != NULL)
 {
  ErrorCode = 0;
  Loaded = true;

  UnlockKey = (ISED_Oint_Ichar_PTR)GetProcAddress(DLL_Handle,"iSEDUnlockKey");
  NewDocument = (ISED_Oint_PTR)GetProcAddress(DLL_Handle,"iSEDNewDocument");
  SetOrigin = (ISED_Oint_Iint_PTR)GetProcAddress(DLL_Handle,"iSEDSetOrigin");
  SetMeasurementUnits = (ISED_Oint_Iint_PTR)GetProcAddress(DLL_Handle,"iSEDSetMeasurementUnits");
  SetPageSize = (ISED_Oint_Ichar_PTR)GetProcAddress(DLL_Handle,"iSEDSetPageSize");
  NewPages = (ISED_Oint_Iint_PTR)GetProcAddress(DLL_Handle,"iSEDNewPages");
  SelectPage = (ISED_Oint_Iint_PTR)GetProcAddress(DLL_Handle,"iSEDSelectPage");
  AddImageFromFile = (ISED_Oint_Ichar_Iint_PTR)GetProcAddress(DLL_Handle,"iSEDAddImageFromFile");
  SaveToFile = (ISED_Oint_Ichar_PTR)GetProcAddress(DLL_Handle,"iSEDSaveToFile");
  }
}

 

To use declare an instance of the wrapper and use the commands

CSECiSEDDLL ISED;
long  rv;
rv = ISED.LoadFromFile(const_cast <char *> (filename.c_str()));




Print Page | Close Window

Forum Software by Web Wiz Forums® version 11.01 - http://www.webwizforums.com
Copyright ©2001-2014 Web Wiz Ltd. - http://www.webwiz.co.uk