Page 1 of 2

aXend's COMLIB

Posted: Wed Mar 02, 2005 2:41 pm
by Karbon
Does anyone happen to know where aXend went? I'd like to get a copy of his COMLIB done with the new tailbite so that it works with 3.93..

Thanks guys!

Posted: Thu Mar 03, 2005 3:19 pm
by Karbon
Anyone know aXend personally?

Posted: Fri Mar 04, 2005 3:17 pm
by aXend
The updated version can be downloaded from http://home.planet.nl/~aXend/purebasic/COMLIB_393.zip.

Posted: Sat Mar 05, 2005 9:11 am
by jqn
2aXend:
What is COMLIB?.
I've downloaded COMLIB_393.zip, but there is no documentation included.

BR
Joaquin

Posted: Sat Mar 05, 2005 10:54 am
by aXend
COMLIB is a library to work with COM from PureBasic. You can find the previous version - including documentation - at http://home.planet.nl/~aXend/purebasic/COMLIB_demo.zip or at PureArea.Net. You can find discussions about it elsewhere on this forum.

Posted: Tue Mar 08, 2005 5:27 am
by Shannara
aXend wrote:COMLIB is a library to work with COM from PureBasic. You can find the previous version - including documentation - at http://home.planet.nl/~aXend/purebasic/COMLIB_demo.zip or at PureArea.Net. You can find discussions about it elsewhere on this forum.
Hmm, just downloaded, no documentation with the link provided.

Posted: Tue Mar 08, 2005 2:24 pm
by Karbon
It has been updated to work with 3.93 -- just after I modified everything to work around not having it! :-)

Posted: Tue Mar 08, 2005 5:40 pm
by aXend
@Shanara: If you look at test_ado.pb you'll find explenation about COMLIB including an example to work with it. See the code below.

Code: Select all

; --------------------------------------------------------------------------------------------------------
; This is a demo program to demonstrate the use of COM from PureBasic.
;
; The zip file contains 5 items:
; - COMLIB          (library file, put it in the Userlibraries directory)
; - Variant_inc.res (resident file with definitions for VARIANTS, put it in the Residents directory)
; - Variant_inc.pb  (the pb version, use as Includefile)
; - ADODB.pb        (the Interface definitions for ADODB, use as Includefile)
; - test_ado.pb     (this demo program)
;
; COMLIB is a small library that contains 4 procedures:
;
; CreateObject(ProgID.s) - creates an object from a ProgID, just like VB does
; ReleaseObject(Object.l) - release the object
; Uni2Ansi(Unicode.l) - converts a Unicode string to Ansi
; Ansi2Uni(Ansistr.s) - converts an Ansi string to Unicode
;
; This demo program demonstrates the functionality of COMLIB with ADODB.
; ADODB is a COM object to access databases
;
; Created by aXend, 2004.
; For questions: use the forum or mail to aXend@planet.nl
;
; --------------------------------------------------------------------------------------------------------

IncludeFile "ADODB.pb"        ; Definitions for all the Enumerations and Interfaces
;IncludeFile "Variant_inc.pb"    ; Definitions for VARIANTS (not used here, I use the resident version)

Global sSQL.s

; Create a Connection object using the _Connection Interface and the CreateObject procedure from COMLIB
oDatabase._Connection = CreateObject("ADODB.Connection")

; Define the connectionstring (may be you have to change the path settings)
conn.s ="PROVIDER = MICROSOFT.JET.OLEDB.4.0; DATA SOURCE = 'test_ado.mdb'"

; Open the database
If oDatabase\Open(Ansi2Uni(conn),#Null,#Null,-1) = #S_OK

; I copied one tabel from the Dutch version of Northwind.mdb
  sSQL = "SELECT * FROM CUSTOMERS"

; Execute the query and create a Recordset object 
  If oDatabase\Execute(Ansi2Uni(sSQL),@affected.VARIANT,-1,@oRecords._Recordset) = #S_OK

; Get the EOF property
    oRecords\get_EOF(@EOF.VARIANT)
    
; If there are records in the table then continue
    If EOF\value = #VARIANT_FALSE
    
; Get the Fields object
      If oRecords\get_Fields(@oFields.Fields) = #S_OK
      
; Get the number of fields
        oFields\get_Count(@count.l)
        
        Debug "Number of fields is "+Str(count)
        
; Loop through the fields. I use the index mode here, but you can also access a field by name.     
        For i = 0 To count-1
        
; Definitions for each field, you have to do this or else it gets stuck       
          item.VARIANT\vt = #VT_I4  ; this is the VARIANT type for the index
          item\value = i            ; this is the index
          *item.pToVariant = item   ; this cuts the VARIANT in 4 LONG values
          
; Get a Field object by passing the 4 LONG values 
          If oFields\get_Item(*item\a,*item\b,*item\c,*item\d,@oField.Field) = #S_OK
          
            oField\get_Value(@Field.VARIANT)
            oField\get_Name(@Name.l)
            
            If Field\vt <> #VT_BSTR
              Debug Uni2Ansi(Name) + ": " + Str(Field\value)
            Else
              Debug Uni2Ansi(Name) + ": " + Uni2Ansi(Field\bstrVal)
            EndIf
            
; Release the Field object
            oField\Release()
            
          EndIf
        Next
        
; Release the Fields object
        oFields\Release()
        
      EndIf
    EndIf
    
; Release the Recordset object
    oRecords\Release()
    
  EndIf
  
; Close the Connection
  oDatabase\Close()
  
EndIf

; Release the Connection object
ReleaseObject(oDatabase)

End
@Karbon: I hope you're happy to work with it again. :)

Posted: Thu Mar 10, 2005 3:47 am
by Shannara
I saw that sample, no docs though :) The comments makes it looks interesting to use the ADO COM object, but thats quite specific. Any other samples or some docs to help people who are looking to use COM objects and not ADO ?

Does anyone have a current working example

Posted: Tue Jan 30, 2007 10:41 pm
by blackborg
Of using the comlib for PB4.. I downloaded it.. but I need touse it to open and search active directory and access..

Any help or code samples would be appreciated..

Posted: Tue Jan 30, 2007 10:50 pm
by Karbon
I very seriously doubt this is something that has been updated for PB4. I haven't heard from aXend in a long time!

Posted: Tue Jan 30, 2007 11:46 pm
by Flype
yes but, fortunately, the COMLIB source is provided.

see here - with a little surprise :wink:

http://www.purebasic.fr/english/viewtopic.php?t=16569

Thanks..

Posted: Wed Jan 31, 2007 12:33 am
by blackborg
the Ansi2Uni command clashes with Droopy's LIB.. but what I really need is a help file or some working ADO code.. any word on an official Fred COM or ADO Lib?

Posted: Wed Jan 31, 2007 12:39 am
by ts-soft
here is my version without unicode2ansi, this function isn't required in PB4.
You can easy peek and poke to unicode :wink:
http://www.purebasic.fr/english/viewtopic.php?t=23651

Re: Thanks..

Posted: Wed Jan 31, 2007 1:14 am
by Flype
blackborg wrote:the Ansi2Uni command clashes with Droopy's LIB.. but what I really need is a help file or some working ADO code.. any word on an official Fred COM or ADO Lib?
this link if still ok for a good ADO example (using COMLIB).
http://home.planet.nl/~aXend/purebasic/COMLIB_demo.zip