Need some COM help..

Just starting out? Need help? Post your questions and find answers here.
Karbon
PureBasic Expert
PureBasic Expert
Posts: 2010
Joined: Mon Jun 02, 2003 1:42 am
Location: Ashland, KY
Contact:

Need some COM help..

Post by Karbon »

I'm playing with a "COM DLL" (whatever that is supposed to mean!) for a payment gateway called Plug n' Pay.. Problem is that I have no idea how to use this DLL from Purebasic! My knowledge of COM is virtually non-existent..

When I open the DLL with PB and run through the functions I get the functions like DllCanUnloadNow, DllGetClassObject,DllRegisterServer and DllUnregisterServer... Those don't seem to mean anything so I don't really know where to go from here.

Here some examples from the docs... If anyone can give me some pointers I'd appreciate it! Thanks!

3.Filename(s): The Name of the COM DLL is "pnpcom.dll".



4.Relevant Name(s): The 'ObjectName' is 'pnpcom'. The 'ClassName' is
'main'. The 'MethodName' is 'doTransaction'. In the pnpcom object is the
class main that has a method doTransaction.



5.Registering the COM:

--------------------------------------------------------
In the case of pnpcom.dll you need to do it manually by doing the following:

Go to Start/Run and type:
Regsvr32 c:\winnt\system32\pnpcom.dll

That will display a dialog to show if it was successful or failed.

To un-register:

Go to Start/Run and type:
Regsvr32 /u c:\winnt\system32\pnpcom.dll

6. For ASP (Visual Basic Script)
a. Register the DLL as described in Step 5. above.
b. Create the object

Set PNPObj = CreateObject("pnpcom.main?)

c. Assign the name/value to a string
STR = "&publisher-name=XXXinsertXXX&publisher-
email=test@plugnpay.com&ABC=123&card-name=pnptest&card-number=4111111111111111&card-amount=1.00&card-exp=01/01"

d. Use the DoTransaction method to post the name/value to PlugNpay

Results = PNPObj.DoTransaction(??, STR, ??,??)

e. Display the results
response.write "Results are " & Results

f. Pass results into Hash Table for reference:

Dim objResults
Set objResults = Server.CreateObject("Scripting.Dictionary")

myArray = split (Results,"&")
for i = 0 to UBound(myArray)
pos = inStr(1,myArray(i),"=")
if (pos > 1) then
myKey = Left(myArray(i),pos-1)
myVal = Mid(myArray(i),pos+1)
objResults.Item(myKey) = myVal
End If
Next

g. Perform success test
if(objResults.Item("FinalStatus") = "success") then
response.write "Place Transaction was successful Code Here"
Else
response.write "Place Transaction failed Code Here"
End If
-Mitchell
Check out kBilling for all your billing software needs!
http://www.k-billing.com
Code Signing / Authenticode Certificates (Get rid of those Unknown Publisher warnings!)
http://codesigning.ksoftware.net