我用VB编写的OCX中,定义函数时使用了关键字 Optional ,意思是可以缺省参数为默认值。
请问在Delphi中如何使用?
1 我用VB创建了个OCX,同时里面有个函数定义如下:
Public Sub RemoveFile(Optional ByVal strFileName As String = "aaa.exe")如果我在VB里调用分两种情况
1)  Call RemoveFile              '这时参数 strFileName  缺省为"aaa.exe"
2)  Call RemoveFile("FileName")  '这时参数 strFileName  为 "FileName"但是我在Delphi里调用时却只有一种情况,就是
RemoveFile("FileName")
而没有缺省strFileName  为"aaa.exe" 这种情况,
请问,我该怎么实现?

解决方案 »

  1.   

    你是想在delphi中使用Optional ,还是想调用vb中的函数?
      

  2.   

    在Delphi中掉用VB的OCX
    函数是VB里定义的
    在Delphi中调用
      

  3.   

    RemoveFile()就这样调用不行吗?
      

  4.   

    如果实在不行就 RemoveFile("")vb里面ocx就改一下
    if filename="" then filename="aaa.exe"
      

  5.   

    是前者的话,看看这个:
    http://search.csdn.net/Expert/topic/440/440409.xml?temp=.5741541
      

  6.   

    请大家看一下我在Delphi里同样的问题http://community.csdn.net/Expert/topic/4386/4386102.xml?temp=.1553919