2010-09-23 06:05 UTC+0300 Mindaugas Kavaliauskas (dbtopas/at/dbtopas.lt)

* harbour/contrib/hbwin/olecore.c
    + added possibility to use more than one parameter in property put 
      call. This allows to make a workaround for non-existant Harbour
      language syntax:
         object.name(param) = value
      Workaround syntax:
         object._name(param, value)
    + added comment documenting OLE automation behaviour for various 
      VBScript sentences
  + harbour/contrib/hbwin/tests/pdfcreat.prg
    + added sample code for producing .pdf documents using OLE and PDFCreator
This commit is contained in:
Mindaugas Kavaliauskas
2010-09-23 03:04:11 +00:00
parent 50d716c743
commit b5af3b0f73
3 changed files with 120 additions and 1 deletions

View File

@@ -16,6 +16,19 @@
The license applies to all entries newer than 2009-04-28.
*/
2010-09-23 06:05 UTC+0300 Mindaugas Kavaliauskas (dbtopas/at/dbtopas.lt)
* harbour/contrib/hbwin/olecore.c
+ added possibility to use more than one parameter in property put
call. This allows to make a workaround for non-existant Harbour
language syntax:
object.name(param) = value
Workaround syntax:
object._name(param, value)
+ added comment documenting OLE automation behaviour for various
VBScript sentences
+ harbour/contrib/hbwin/tests/pdfcreat.prg
+ added sample code for producing .pdf documents using OLE and PDFCreator
2010-09-22 18:48 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com)
* contrib/hbqt/qtgui/qth/QBoxLayout.qth
* contrib/hbqt/qtgui/qth/QComboBox.qth

View File

@@ -1490,6 +1490,27 @@ HB_FUNC( WIN_OLEERRORTEXT )
}
}
/*
VBScript and Harbour syntax and IDispatch:Invoke() usage differences
VBScript syntax dispid DISPATCH_* flags argcnt | Harbour syntax :Invoke parameters
================================================================+=======================================
obj DISPID_VALUE METHOD+PROPERTYGET 0 | Same :Invoke is not used
obj() DISPID_VALUE METHOD 0 | Not supported
obj(param) DISPID_VALUE METHOD+PROPERTYGET 1 | obj[param] Same
obj.name name METHOD+PROPERTYGET 0 | Same, =obj.name() Same
obj.name() name METHOD 0 | Same, =obj.name flags=METHOD+PROPERTYGET
obj.name(param) name METHOD+PROPERTYGET 1 | Same Same
|
obj = value obj reassigned, :Invoke is not used | Same
obj() = value DISPID_VALUE PROPERTYPUT 1 | Not supported
obj(param) = value DISPID_VALUE PROPERTYPUT 2 | obj[param] = value
obj.name = value name PROPERTYPUT 1 | Same Same
obj.name() = value name PROPERTYPUT 1 | Not supported, use obj.name = value
obj.name(param) = value name PROPERTYPUT 2 | Not supported, workaround obj._name(param, value)
*/
HB_FUNC( WIN_OLEAUTO___ONERROR )
{
@@ -1521,7 +1542,7 @@ HB_FUNC( WIN_OLEAUTO___ONERROR )
/* Try property put */
if( szMethod[ 0 ] == '_' && hb_pcount() == 1 )
if( szMethod[ 0 ] == '_' && hb_pcount() >= 1 )
{
pMemberArray = &szMethodWide[ 1 ];
lOleError = HB_VTBL( pDisp )->GetIDsOfNames( HB_THIS_( pDisp ) HB_ID_REF( IID_NULL ), &pMemberArray,

View File

@@ -0,0 +1,85 @@
/*
* $Id$
*/
/*
* Harbour Project source code
* Demonstration code for generating .pdf documents using PDFCreator
* COM interface.
*
* You should install PDFCreator to be able to run this test
*
* Download site:
* http://sourceforge.net/projects/pdfcreator/
*
* COM interface docs:
* http://www.pdfforge.org/content/com-interface
*
* Copyright 2010 Mindaugas Kavaliauskas <dbtopas / at / dbtopas.lt>
* www - http://harbour-project.org
*
*/
PROC main()
LOCAL oPC, nTime, cDefaultPrinter, cFilename, oPrinter, nEvent := 0
IF EMPTY( oPC := WIN_OLECreateObject( "PDFCreator.clsPDFCreator" ) )
? "Unable to create PDFCreator COM object"
RETURN
ENDIF
cFilename := HB_PROGNAME()
/* Setup event notification */
oPC:__hSink := __AxRegisterHandler( oPC:__hObj, {|X| nEvent := X}, "{58B69879-9ED8-468D-879F-787161FA105F}")
oPC:cStart( "/NoProcessingAtStartup" )
oPC:_cOption( "UseAutosave", 1 )
oPC:_cOption( "UseAutosaveDirectory", 1 )
oPC:_cOption( "AutosaveDirectory", LEFT( cFileName, RAT( HB_PS(), cFilename ) - 1 ) )
oPC:_cOption( "AutosaveFilename", "pdfcreat.pdf" )
oPC:_cOption( "AutosaveFormat", 0 )
cDefaultPrinter := oPC:cDefaultPrinter
oPC:cDefaultPrinter := "PDFCreator"
oPC:cClearCache()
/* You can do any printing here using WinAPI or
call a 3rd party application to do printing */
#if 1
oPrinter := Win_Prn():New( "PDFCreator" )
oPrinter:Create()
oPrinter:startDoc( "Harbour print job via PDFCreator" )
oPrinter:NewLine()
oPrinter:NewLine()
oPrinter:TextOut( "Hello, PDFCreator! This is Harbour :)" )
oPrinter:EndDoc()
oPrinter:Destroy()
#else
? "Do some printing to PDFCreator printer and press any key..."
INKEY(0)
#endif
oPC:cPrinterStop := .F.
nTime := hb_milliseconds()
DO WHILE nEvent == 0 .AND. hb_milliseconds() - nTime < 10000
hb_idleSleep( 0.5 )
/* The following dummy line is required to allow COM server to send event [Mindaugas] */
oPC:cOption("UseAutosave")
ENDDO
IF nEvent == 0
? "Print timeout"
ELSEIF nEvent == 1
? "Printed successfully"
ELSEIF nEvent == 2
? "Error:", oPC:cError():Description
ELSE
? "Unknown event"
ENDIF
oPC:cDefaultPrinter := cDefaultPrinter
oPC:cClose()
oPC := NIL
RETURN