Page 10 of 23

Re: COMatePLUS version 1.1

Posted: Tue Dec 08, 2009 7:48 am
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 ?

Re: COMatePLUS version 1.1

Posted: Fri Dec 11, 2009 4:55 pm
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

Re: COMatePLUS version 1.1

Posted: Fri Dec 11, 2009 4:59 pm
by Marco2007
Declare-Line:

Code: Select all

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

Re: COMatePLUS version 1.1

Posted: Fri Dec 11, 2009 5:43 pm
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.

Re: COMatePLUS version 1.1

Posted: Fri Dec 11, 2009 7:25 pm
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

Re: COMatePLUS version 1.1

Posted: Sat Dec 19, 2009 12:41 am
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?)

Re: COMatePLUS version 1.1

Posted: Sat Dec 19, 2009 11:33 am
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

Re: COMatePLUS version 1.1

Posted: Sat Dec 19, 2009 12:17 pm
by DoubleDutch
Thats what I've ended up doing. :)

Thanks.

Re: COMatePLUS version 1.1

Posted: Tue Jan 12, 2010 10:37 am
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?

Re: COMatePLUS version 1.1

Posted: Tue Jan 12, 2010 12:06 pm
by srod

Code: Select all

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

Re: COMatePLUS version 1.1

Posted: Wed Jan 13, 2010 12:59 am
by SFSxOI
Thanks srod.

But what if for instance dwValue were already a string? Is a type modifier needed or something?

Re: COMatePLUS version 1.1

Posted: Wed Jan 13, 2010 1:53 am
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.

Re: COMatePLUS version 1.1

Posted: Wed Jan 13, 2010 12:23 pm
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()

Re: COMatePLUS version 1.1

Posted: Thu Jan 14, 2010 1:09 pm
by SFSxOI
Yep, thats it. Works for QWORD also. Thanks srod. :)

Re: COMatePLUS version 1.1

Posted: Thu Jan 14, 2010 1:13 pm
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?