COMatePLUS version 1.2

Developed or developing a new product in PureBasic? Tell the world about it.
loulou
User
User
Posts: 38
Joined: Tue Dec 08, 2009 7:42 am

Re: COMatePLUS version 1.1

Post by loulou »

With ado i want to use the following sentence

Code: Select all

recordset.getrows(100,0)
I don't arrive to do something. Can you help me ?
Little John
Addict
Addict
Posts: 4777
Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany

Re: COMatePLUS version 1.1

Post by Little John »

Hi srod,

I'm getting an error in COMatePLUS.pbi (Version 1.1 released 5th June 2009) on line 793:
"Declare doesn't match with real Procedure."

Code: Select all

  Declare.i COMateClass_GetObjectProperty(*this._membersCOMateClass, command$, objectType = #VT_DISPATCH, *hStatement=0)

Procedure.i COMateClass_GetObjectProperty(*this._membersCOMateClass, command$, *hStatement=0, objectType = #VT_DISPATCH)
What has to be changed, the Declare statement or the Procedure?

Regards, Little John
Marco2007
Enthusiast
Enthusiast
Posts: 648
Joined: Tue Jun 12, 2007 10:30 am
Location: not there...

Re: COMatePLUS version 1.1

Post by Marco2007 »

Declare-Line:

Code: Select all

Declare.i COMateClass_GetObjectProperty(*this._membersCOMateClass, command$, *hStatement=0, objectType = #VT_DISPATCH)
PureBasic for Windows
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Re: COMatePLUS version 1.1

Post by srod »

Thanks Marco. :)

I seem to have made the adjustment but not released it! Either that or Little John is using an older version.
I may look like a mule, but I'm not a complete ass.
Little John
Addict
Addict
Posts: 4777
Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany

Re: COMatePLUS version 1.1

Post by Little John »

In the file COMatePLUS.pbi on my hard disk, it reads:
;*COMatePLUS. Version 1.1 released 5th June 2009.
According to the first post in this thread this is the most recent version, so I didn't do a new download now.
Anyway, I know what to do now. Thanks for the help!

Regards, Little John
User avatar
DoubleDutch
Addict
Addict
Posts: 3220
Joined: Thu Aug 07, 2003 7:01 pm
Location: United Kingdom
Contact:

Re: COMatePLUS version 1.1

Post by DoubleDutch »

I want to display different pdfs in sequence within the same window. The problem is that only the first one is ever displayed...

Code: Select all

IncludePath "..\"
XIncludeFile "COMatePLUS.pbi"


Define.COMateObject PDFObject

If OpenWindow(0, 0, 0, 800, 800, "COMate PDF-Demo", #PB_Window_SystemMenu|#PB_Window_SizeGadget|#PB_Window_MaximizeGadget|#PB_Window_MinimizeGadget)

  pdfObject = Comate_CreateObject("AcroPDF.PDF.1", WindowID(0)) 
  If pdfObject
    pdfObject\SetProperty("src = 'C:\COMTutorial.pdf'") 
    pdfObject\Invoke("setShowToolbar(#True)") 
    pdfObject\Invoke("setView('Fitv')") 
    pdfObject\Invoke("setPageMode('none')") 
;    pdfObject\Invoke("setLayoutMode('SinglePage')") 

    While WaitWindowEvent() <> #PB_Event_CloseWindow : Wend 
    ;CloseWindow(0)
    pdfObject\Release()
  Else
    MessageRequester("COMate -Acrobat PDF demo", "Couldn't create the ActiveX object!")
  EndIf
  
    pdfObject = Comate_CreateObject("AcroPDF.PDF.1", WindowID(0)) 
  If pdfObject
    pdfObject\SetProperty("src = 'C:\order.pdf'") 
    pdfObject\Invoke("setShowToolbar(#True)") 
    pdfObject\Invoke("setView('Fitv')") 
    pdfObject\Invoke("setPageMode('none')") 
;    pdfObject\Invoke("setLayoutMode('SinglePage')") 

    While WaitWindowEvent() <> #PB_Event_CloseWindow : Wend 
    CloseWindow(0)
    pdfObject\Release()
  Else
    MessageRequester("COMate -Acrobat PDF demo", "Couldn't create the ActiveX object!")
  EndIf
EndIf
Am I missing something ? (it works if you close and re-create the window - but why?)
https://deluxepixel.com <- My Business website
https://reportcomplete.com <- School end of term reports system
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Re: COMatePLUS version 1.1

Post by srod »

I don't have an exact answer to your question, but the obvious solution is not to release the automation object inbetween loading the different pdf files.

Code: Select all

IncludePath "..\"
XIncludeFile "COMatePLUS.pbi"

Define.COMateObject PDFObject

If OpenWindow(0, 0, 0, 800, 800, "COMate PDF-Demo", #PB_Window_SystemMenu|#PB_Window_SizeGadget|#PB_Window_MaximizeGadget|#PB_Window_MinimizeGadget)

  pdfObject = Comate_CreateObject("AcroPDF.PDF.1", WindowID(0)) 
  If pdfObject
    pdfObject\SetProperty("src = 'C:\COMTutorial.pdf'") 
    pdfObject\Invoke("setShowToolbar(#True)") 
    pdfObject\Invoke("setView('Fitv')") 
    pdfObject\Invoke("setPageMode('none')") 
    While WaitWindowEvent() <> #PB_Event_CloseWindow : Wend 
    pdfObject\SetProperty("src = 'C:\order.pdf'") 
    pdfObject\Invoke("setShowToolbar(#True)") 
    pdfObject\Invoke("setView('Fitv')") 
    pdfObject\Invoke("setPageMode('none')") 
    While WaitWindowEvent() <> #PB_Event_CloseWindow : Wend 
    CloseWindow(0)
    pdfObject\Release()
  Else
    MessageRequester("COMate -Acrobat PDF demo", "Couldn't create the ActiveX object!")
  EndIf
EndIf
I may look like a mule, but I'm not a complete ass.
User avatar
DoubleDutch
Addict
Addict
Posts: 3220
Joined: Thu Aug 07, 2003 7:01 pm
Location: United Kingdom
Contact:

Re: COMatePLUS version 1.1

Post by DoubleDutch »

Thats what I've ended up doing. :)

Thanks.
https://deluxepixel.com <- My Business website
https://reportcomplete.com <- School end of term reports system
SFSxOI
Addict
Addict
Posts: 2970
Joined: Sat Dec 31, 2005 5:24 pm
Location: Where ya would never look.....

Re: COMatePLUS version 1.1

Post by SFSxOI »

Just getting back to using COMate for a project. Everything is working fine except for using the StdRegProv for reading the registry. Found this script:

Code: Select all

    const HKEY_CURRENT_USER = &H80000001
strComputer = "."
Set oReg=GetObject( _
   "winmgmts:{impersonationLevel=impersonate}!\\" &_
    strComputer & "\root\default:StdRegProv")
strKeyPath = "Console"
strValueName = "HistoryBufferSize"
oReg.GetDWORDValue _
   HKEY_CURRENT_USER,strKeyPath,strValueName,dwValue
WScript.Echo "Current History Buffer Size: " & dwValue
started to convert it then realized I don't know how to use the StdRegProv for the registry classes with COMate. Is it like this?

Code: Select all

Define.COMateObject oReg

HKEY_CURRENT_USER = $80000001
strComputer.s = "."
strKeyPath.s = "Console"
strValueName.s = "HistoryBufferSize"

  oReg = COMate_GetObject("winmgmts:\\" + strComputer + "\root\default:StdRegProv", "")
and how do I use the "GetDWORDValue" method in this? Is it an Invoke?

This seems to not fail:

Code: Select all

oReg\Invoke("GetDWORDValue('HKEY_CURRENT_USER,strKeyPath,strValueName,dwValue')")
But even if it doesn't fail how do you recover the value from the key via the Invoke?
The advantage of a 64 bit operating system over a 32 bit operating system comes down to only being twice the headache.
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Re: COMatePLUS version 1.1

Post by srod »

Code: Select all

oReg\Invoke("GetDWORDValue(" + Str(HKEY_CURRENT_USER) + ", '" + strKeyPath + "', '" + strValueName + "', " + Str(@dwValue) + " BYREF)")
Debug dwValue
I may look like a mule, but I'm not a complete ass.
SFSxOI
Addict
Addict
Posts: 2970
Joined: Sat Dec 31, 2005 5:24 pm
Location: Where ya would never look.....

Re: COMatePLUS version 1.1

Post by SFSxOI »

Thanks srod.

But what if for instance dwValue were already a string? Is a type modifier needed or something?
The advantage of a 64 bit operating system over a 32 bit operating system comes down to only being twice the headache.
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Re: COMatePLUS version 1.1

Post by srod »

In such a case then I would guess that the method will create a BSTR and place a pointer to it in the variable. You would, if this is correct, not need to alter the code. Just remember to free the string when you are done.

I can try it out tomorrow.
I may look like a mule, but I'm not a complete ass.
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Re: COMatePLUS version 1.1

Post by srod »

Code: Select all

IncludePath "..\"
XIncludeFile "COMatePLUS.pbi"

Define.COMateObject oReg

HKEY_CURRENT_USER = $80000001
strComputer.s = "."
strKeyPath.s = "Identities"
strValueName.s = "Last Username"

oReg = COMate_GetObject("winmgmts:\\.\root\default:StdRegProv", "")

oReg\Invoke("GetStringValue(" + Str(HKEY_CURRENT_USER) + ", '" + strKeyPath + "', '" + strValueName + "', " + Str(@dwValue) + " BYREF)")

Debug PeekS(dwValue, -1, #PB_Unicode)

SysFreeString_(dwValue)

oReg\Release()
I may look like a mule, but I'm not a complete ass.
SFSxOI
Addict
Addict
Posts: 2970
Joined: Sat Dec 31, 2005 5:24 pm
Location: Where ya would never look.....

Re: COMatePLUS version 1.1

Post by SFSxOI »

Yep, thats it. Works for QWORD also. Thanks srod. :)
The advantage of a 64 bit operating system over a 32 bit operating system comes down to only being twice the headache.
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Re: COMatePLUS version 1.1

Post by srod »

Must admit that I am unsure why you would need to use COM automation just to retrieve values from the registry as you can do all of this without this kind of overhead?
I may look like a mule, but I'm not a complete ass.
Post Reply