Theos PowerBasic Museum 2017

Archive => Discussion - Legacy Software (PBWIN 9.0+/PBCC 5.0+) => Topic started by: Peter Weis on February 12, 2010, 04:42:42 PM

Title: passing optional parameters in methods and Property
Post by: Peter Weis on February 12, 2010, 04:42:42 PM
Hello,
I have the following problem. I have written a class in PowerBasic where I need Optional parameters in methods. Whom do I want to build the whole thing with compilers compile and Com-browser with an include file is optional in the parameter list off every time I need to write it purely by hand.
Example:

#COMPILER PBWIN 9
#COMPILE DLL

#RESOURCE "TestClass.pbr"

#DIM ALL

#COM NAME "TestClass", 1
#COM DOC  "List of TestClass"
#COM TLIB ON

$CTestClass = GUID$("{1A856B38-0C99-43ED-BF8E-D7BD981261E4}")
$ITestClass = GUID$("{7C401253-58F2-4654-B570-3A0240E405C1}")

CLASS CTestClass $CTestClass AS COM

 INTERFACE ITestGlass $ITestClass
   INHERIT IDISPATCH

   

   PROPERTY GET Definition(   OPTIONAL   w AS VARIANT) AS STRING
       
   END PROPERTY

   
 END INTERFACE

END CLASS



Code of the browser creates Com. as we see is an optional away and must be re-written by hand are strictly


' Generated by: PowerBASIC COM Browser v.2.00.0077
' Date & Time : 31.01.2010 at 12:55
' ------------------------------------------------
' Library Name: TestClass
' Library File: F:\PBWin90\Samples\COM\Glossary\testclass.dll
' Description : List of TestClass
' GUID : {74E44103-8BB0-4421-A01C-0F8DC2ABEC16}
' LCID : 0
' Version : 1.0

' Class Identifiers
$CLSID_TestClass_CTESTCLASS = GUID$("{1A856B38-0C99-43ED-BF8E-D7BD981261E4}")

' Interface Identifiers
$IID_TestClass_ITESTGLASS = GUID$("{7C401253-58F2-4654-B570-3A0240E405C1}")

' Interface Name  : ITESTGLASS
' Description     : ITESTGLASS is a dual interface with VTable/Dispatch access.
' Class Name      : CTESTCLASS
' ClassID         : $CLSID_TestClass_CTESTCLASS
Interface ITESTGLASS $IID_TestClass_ITESTGLASS
   Inherit IDispatch

   Property Get DEFINITION <257> (ByRef W As Variant) As String
End Interface


Title: Re: passing optional parameters in methods and Property
Post by: José Roca on February 12, 2010, 05:01:35 PM
 
The ICreateTypelib interface, used to create type libraries automatically, doesn't support optional parameters. You may need to build the type library using the MIDL compiler.
Title: Re: passing optional parameters in methods and Property
Post by: Peter Weis on February 13, 2010, 09:04:08 PM
Hello Jose,
This is too complicated for me ???. I have now searched two days after MIDL compiler. What do I know the PowerBASIC is optional but supported enters not into the Typelieb. So what we made so I would write a program that reads the Source and the OPTION fits into the include file.
Greeting, Peter :'(