The Forums on slxdeveloper.com are now retired. The forum archive will remain available for the time being. Thank you for your participation on slxdeveloper.com!
|
|
Reference External DLL / API Functions
Posted: 23 Jun 09 10:56 AM
|
Hi All,
I am wanting to intergrate Saleslogix with the QAS Rapid Pro API (Quick Address). This would usaully be simple, if the API was in a COM enabled DLL.
It's not, the DLL was compiled in the late 90's by the looks of it, the damned thing is expecting you to be able to reference the DLL with VB style...
Declare Sub QAInitialise Lib "QARUIEB.DLL" (ByVal vi1 As Long) Declare Sub QAErrorMessage Lib "QARUIEB.DLL" (ByVal vi1 As Long, ByVal rs2 As String, ByVal vi3 As Long) Declare Function QAErrorLevel Lib "QARUIEB.DLL" (ByVal vi1 As Long) As Long ...etc...
... to expose the functions available in the DLL. Is there an equivalent of this that I can use in VBScript in Saleslogix 7.2 (SP2)? Please let me know, I'm dreading having to write a separate COM wrapper for it to open up the functions so please bring good news! 
Thanks in advance! |
|
|
|
Re: Reference External DLL / API Functions
Posted: 23 Jun 09 11:12 AM
|
For better or for worst, Legacy VB Scripts are still somewhat functional.... And I used to do a lot of Declares back in the days using them with very good results.
That being said, it may be much simpler to create a COM wrapper for it unless you are only needing to make 1 or 2 calls .... |
|
|
|
Re: Reference External DLL / API Functions
Posted: 23 Jun 09 11:55 AM
|
Thanks for the info. Do you have any examples of how to reference DLL's using the Legacy Script (I think it was Cypress Script based wasn't it?).
I thought the Legacy stuff still relied on CreateObject("xyz.xyz") just like the VB Script, as such a COM interface would be required.
Let me know if you can. I really want to avoid the COM wrapper route as it is another dll / executable that needs to be place on every client machine for the integration to work. |
|
|
|
Re: Reference External DLL / API Functions
Posted: 23 Jun 09 12:05 PM
|
Sorry, I don't have any examples handy as it has been quite a while since I did that, but my recollection is that it would work pretty much the same way as doing Declares within VB6.
I was able to copy most Declares API Viewer and they would work, sometimes there would be issue with special types (such as APIs returning pointers to C Structures, but even those I got to work with a moderate amount of effort).
Again, my approach if present with the same challenge would be to go with the COM wrapper. I am not sure how much longer the Legacy scripts will remain functional within SalesLogix, but for a quick one or two call integration, by all means give it a try.
|
|
|
| |
|
Re: Reference External DLL / API Functions
Posted: 24 Jun 09 12:30 AM
|
Don't know if this is what you are after but we use cardscan which has a legacy script calling their DLL's. Below is some of the code:
' --------Initialization functions-------------------------- ' Initialize the library and register the client application Declare Function CRTKInit Lib "cssdk32.dll" Alias "CRTK_Init" ( _ ByRef lphRTK As Long _ ) As Long ' lphRTK - address to receive RTK handle
' Unregister the client application and close the library Declare Function CRTKTerm Lib "cssdk32.dll" Alias "CRTK_Term" ( _ ByVal hRTK As Long _ ) As Long ' hRTK - valid RTK handle
' --------Scanner functions---------------------------------
' Check for a card in the scanner Declare Function CRTKScanCheckForCard Lib "cssdk32.dll" Alias "CRTK_ScanCheckForCard" ( _ ByVal hRTK As Long _ ) As Long ' hRTK - valid RTK handle ' Calibrate and configure the business card scanner Declare Function CRTKScanConfigure Lib "cssdk32.dll" Alias "CRTK_ScanConfigure" ( _ ByVal hRTK As Long, _ ByVal hWndOwner As Long _ ) As Long ' hRTK - valid RTK handle ' hWindOwner - Owner window for Scanner Setup dialog ' Scan a business card Declare Function CRTKScanAcquire Lib "cssdk32.dll" Alias "CRTK_ScanAcquire" ( _ ByVal hRTK As Long, _ ByVal dwTimeout As Long _ ) As Long ' hRTK - valid RTK handle ' dwTimeout - time in 1/10th of sec to wait for user to insert card |
|
|
| |
|
Re: Reference External DLL / API Functions
Posted: 24 Jun 09 3:45 AM
|
Thanks Leon, that's pretty much standard for referencing DLL's, it's just a shame you can't use the same method in the VB script.
John, .net extensions are a little beyond me. I know where to start when writing a wrapper, but .net extensions? You may as well be talking Chinese  |
|
|
|
Re: Reference External DLL / API Functions
Posted: 24 Jun 09 9:46 AM
|
Another advantage of the COM wrapper is that you could reuse it on other applications if needed, whereas the .Net Extension would be somewhat SLX Exclusive.
You may even choose to do the COM Wrapper and then an SLX .Net Extension to further wrap it around for SalesLogix, but I do think that may be overkill, however, the advantage of the extension as pointed out was that SLX would handle the deployment of the DLL.
On the VB6 days, I would do typically build the COM wrapper into an OCX, then attach the control onto a Form which would then cause SLX to handle the deployment as well. |
|
|
|
Re: Reference External DLL / API Functions
Posted: 25 Jun 09 2:43 AM
|
I disagree - a .net solution can have multiple interfaces, so could be exposed to SLX, COM and .net, if required. I often build my .net extensions as standalone .net libraries first, then integrate them into SLX by adding an SLX compatible interface.
|
|
|
|