Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Incorporating DLL File in VFP program
Message
From
19/12/2013 13:16:11
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP
Network:
Windows XP
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01590624
Message ID:
01590649
Views:
77
sir, suddenly i am getting error as "Decclare dll caused an EXCEPTION". Can you please see to it.

Here is the dll ps2pdf
https://www.dropbox.com/s/tyg9m7gg1krtz6c/ps2pdf.dll

Here IS Sample ps file
https://www.dropbox.com/s/59u4vjmjcyfmwhi/test1.ps

here is my code
DECLARE INTEGER _apCreate@0   IN ps2pdf.dll AS apCreate
DECLARE         _apClose@4    IN ps2pdf.dll AS apClose   INTEGER id
DECLARE INTEGER _apConvert@4  IN ps2pdf.dll AS apConvert INTEGER id
DECLARE INTEGER _apSetFunc@24 IN ps2pdf.dll AS apSetFunc INTEGER id, INTEGER code, INTEGER nOptVal1, INTEGER nOptVal2, STRING pOptVal1, STRING pOptVal2
DECLARE INTEGER _apGetFunc@24 IN ps2pdf.dll AS apGetFunc INTEGER id, INTEGER code, INTEGER nOptVal1, INTEGER nOptVal2, STRING pOptVal1, STRING pOptVal2


#define AP_Set_Output     3000
#define AP_Set_Input      3001
** Convert ps files to a general pdf file.
SELECT bills
GO top

Scan
iFilename=ALLTRIM(oldpath)
oFilename=ALLTRIM(Newpath)
id = apCreate()
IF (id # 0)
   apSetFunc(id, AP_Set_Input , 0, 0, '&iFilename' , 0)  &&input file.
   apSetFunc(id, AP_Set_Output, 0, 0, '&oFilename', 0) &&output format and file.
   iRet = apConvert(id)
   apClose(id)
ENDIF
WAIT WINDOW RECNO() NoWAIT
ENDSCAN
>I can't look at it w/o having the ps2pdf.dll.
>
>UPDATE:
>You can try to change declaration code to this:
>
>...
>DECLARE INTEGER _apCreate@0   IN ps2pdf.dll AS apCreate
>DECLARE         _apClose@4    IN ps2pdf.dll AS apClose   INTEGER id
>DECLARE INTEGER _apConvert@4  IN ps2pdf.dll AS apConvert INTEGER id
>DECLARE INTEGER _apSetFunc@24 IN ps2pdf.dll AS apSetFunc INTEGER id, INTEGER code, INTEGER nOptVal1, INTEGER nOptVal2, STRING pOptVal1, STRING pOptVal2
>DECLARE INTEGER _apGetFunc@24 IN ps2pdf.dll AS apGetFunc INTEGER id, INTEGER code, INTEGER nOptVal1, INTEGER nOptVal2, STRING pOptVal1, STRING pOptVal2
>...
>
>
>
>
>>Sir, it gave an Error at
>>
>>id=apcreate(). The error is Can not find entry point apCreate in the DLL.
>>
>>Can you please look at it.
>>
>>Regards
>>
>>
>>
>>>This is VFP version of VB code.
>>>I removed events (button click)
>>>
>>>Declare INTEGER apCreate   IN ps2pdf.dll
>>>Declare         apClose   IN ps2pdf.dll INTEGER id
>>>Declare INTEGER apConvert IN ps2pdf.dll INTEGER id
>>>Declare INTEGER apSetFunc IN ps2pdf.dll INTEGER id, INTEGER code, INTEGER nOptVal1, INTEGER nOptVal2, STRING pOptVal1, STRING pOptVal2
>>>Declare INTEGER apGetFunc IN ps2pdf.dll INTEGER id, INTEGER code, INTEGER nOptVal1, INTEGER nOptVal2, STRING pOptVal1, STRING pOptVal2
>>>
>>>
>>>#define AP_Set_Output     3000
>>>#define AP_Set_Input      3001
>>>#define AP_Set_PDFInfo    3006
>>>#define AP_Set_PDFEncrypt 3007
>>>
>>>
>>>*Supported pdf header information
>>>#define AP_PDF_TITLE       "title"
>>>#define AP_PDF_SUBJECT     "subject"
>>>#define AP_PDF_AUTHOR      "author"
>>>#define AP_PDF_KEYWORDS    "keywords"
>>>#define AP_PDF_APPLICATION "creator"
>>>
>>>
>>>*Supported encryption mode
>>>#define AP_PDF_ENCRYPT_40   40
>>>#define AP_PDF_ENCRYPT_128 128
>>>
>>>*Supported user access permissions
>>>#define AP_PDF_PERMISSION_NONE     0
>>>#define AP_PDF_PERMISSION_PRINT    1
>>>#define AP_PDF_PERMISSION_COPYING  2
>>>#define AP_PDF_PERMISSION_MODIFY   4
>>>#define AP_PDF_PERMISSION_ALL      7
>>>
>>>
>>>** Convert ps files to a general pdf file.
>>>id = apCreate()
>>>IF (id # 0)
>>>   apSetFunc(id, AP_Set_Input , 0, 0, "test1.ps" , 0)  &&input file.
>>>   apSetFunc(id, AP_Set_Input , 0, 0, "test2.ps" , 0)  &&input file.
>>>   apSetFunc id, AP_Set_Output, 0, 0, "test1.pdf", 0) &&output format and file.
>>>    
>>>   apSetFunc(id, AP_Set_PDFInfo, 0, 0, AP_PDF_TITLE      , "untitled document")
>>>   apSetFunc(id, AP_Set_PDFInfo, 0, 0, AP_PDF_AUTHOR     , "adultpdf")
>>>   apSetFunc(id, AP_Set_PDFInfo, 0, 0, AP_PDF_APPLICATION, "PS to PDF sdk demo")
>>>   iRet = apConvert(id)
>>>   apClose(id)
>>>ENDIF
>>>
>>>
>>>* Convert ps files to an restricted pdf file.
>>>sUserPw  = "1111"
>>>sOwnerPw = "2222"
>>>    
>>>id = apCreate()
>>>IF (id # 0)
>>>   apSetFunc(id, AP_Set_Input , 0, 0, "test1.ps" , 0)  &&input file.
>>>   apSetFunc(id, AP_Set_Input , 0, 0, "test2.ps" , 0)  &&input file.
>>>   apSetFunc id, AP_Set_Output, 0, 0, "test1.pdf", 0) &&output format and file.
>>>    
>>>   apSetFunc(id, AP_Set_PDFInfo, 0, 0, AP_PDF_TITLE      , "untitled document")
>>>   apSetFunc(id, AP_Set_PDFInfo, 0, 0, AP_PDF_AUTHOR     , "adultpdf")
>>>   apSetFunc(id, AP_Set_PDFInfo, 0, 0, AP_PDF_APPLICATION, "PS to PDF sdk demo")
>>>        
>>>   apSetFunc(id, AP_Set_PDFEncrypt, AP_PDF_ENCRYPT_128, AP_PDF_PERMISSION_PRINT + AP_PDF_PERMISSION_COPYING, sUserPw, sOwnerPw)
>>>   
>>>   iRet = apConvert(id)
>>>   apClose(id)
>>>ENDIF
>>>
Harsh
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform