 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Mitch Guest
|
Posted: Fri Apr 13, 2007 2:46 am Post subject: Passing a NULL Interface as a Parameter in COM |
|
|
I've got some VB code that passes 'Nothing' for some params that require
interfaces and I don't know what to use in Delphi. This project is an
ArcMap (ESRI) bolt on so I'm writing a COM DLL that can be called by ArcMap.
VB Code:
pExportOpEvent.ExportFeatureClass pInDsNameEvent, Nothing, Nothing,
Nothing, pOutDatasetNameEvent, 0
Heres the ESRI Doc:
[Visual Basic 6.0]
Sub ExportFeatureClass(
ByVal inputDatasetName As IDatasetName, _
ByVal inputQueryFilter As IQueryFilter, _
ByVal inputSelectionSet As ISelectionSet, _
ByVal inputGeometryDef As IGeometryDef, _
ByVal outputFClassName As IFeatureClassName, _
ByVal parantHWnd As OLE_HANDLE _
)
I tried passing NIL which compiled but generated an AV when processing.
I tried defining the interfaces and not creating them, same result.
I've seen the discussions about replacing Nothing with EmptyParam,
Unassigned or NULL but these can't be used for an interface.
I'm thinking of editting the TypeLibrary's to take a variant for those
params but I thought I'd see if anyone has any ideas.
Thanks,
Mitch Wolberg,
RockWare, Inc. |
|
| Back to top |
|
 |
Dmitry Streblechenko Guest
|
Posted: Fri Apr 13, 2007 5:31 am Post subject: Re: Passing a NULL Interface as a Parameter in COM |
|
|
nil is what you need. Where exactly does it crash? In your code or in the
COM object?
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
"Mitch" <mitch.ABB (AT) rockware (DOT) com> wrote in message
news:461ea8ce$1 (AT) newsgroups (DOT) borland.com...
| Quote: | I've got some VB code that passes 'Nothing' for some params that require
interfaces and I don't know what to use in Delphi. This project is an
ArcMap (ESRI) bolt on so I'm writing a COM DLL that can be called by
ArcMap.
VB Code:
pExportOpEvent.ExportFeatureClass pInDsNameEvent, Nothing, Nothing,
Nothing, pOutDatasetNameEvent, 0
Heres the ESRI Doc:
[Visual Basic 6.0]
Sub ExportFeatureClass(
ByVal inputDatasetName As IDatasetName, _
ByVal inputQueryFilter As IQueryFilter, _
ByVal inputSelectionSet As ISelectionSet, _
ByVal inputGeometryDef As IGeometryDef, _
ByVal outputFClassName As IFeatureClassName, _
ByVal parantHWnd As OLE_HANDLE _
)
I tried passing NIL which compiled but generated an AV when processing.
I tried defining the interfaces and not creating them, same result.
I've seen the discussions about replacing Nothing with EmptyParam,
Unassigned or NULL but these can't be used for an interface.
I'm thinking of editting the TypeLibrary's to take a variant for those
params but I thought I'd see if anyone has any ideas.
Thanks,
Mitch Wolberg,
RockWare, Inc. |
|
|
| Back to top |
|
 |
Mitch Guest
|
Posted: Fri Apr 13, 2007 7:23 pm Post subject: Re: Passing a NULL Interface as a Parameter in COM |
|
|
It crashes in the main application ArcMap which isn't my code so its a
bit of hit or miss as to what the problem is.
I'm working on the conversion of VB code that does work. So I'm pretty
sure the logic is OK even if I'm still not quite up to speed on the ESRI
architecture. ESRI doesn't support Delphi though of course we should
still be able to write COM extensions.
Mitch
Dmitry Streblechenko wrote:
| Quote: | nil is what you need. Where exactly does it crash? In your code or in the
COM object?
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
"Mitch" <mitch.ABB (AT) rockware (DOT) com> wrote in message
news:461ea8ce$1 (AT) newsgroups (DOT) borland.com...
I've got some VB code that passes 'Nothing' for some params that require
interfaces and I don't know what to use in Delphi. This project is an
ArcMap (ESRI) bolt on so I'm writing a COM DLL that can be called by
ArcMap.
VB Code:
pExportOpEvent.ExportFeatureClass pInDsNameEvent, Nothing, Nothing,
Nothing, pOutDatasetNameEvent, 0
Heres the ESRI Doc:
[Visual Basic 6.0]
Sub ExportFeatureClass(
ByVal inputDatasetName As IDatasetName, _
ByVal inputQueryFilter As IQueryFilter, _
ByVal inputSelectionSet As ISelectionSet, _
ByVal inputGeometryDef As IGeometryDef, _
ByVal outputFClassName As IFeatureClassName, _
ByVal parantHWnd As OLE_HANDLE _
)
I tried passing NIL which compiled but generated an AV when processing.
I tried defining the interfaces and not creating them, same result.
I've seen the discussions about replacing Nothing with EmptyParam,
Unassigned or NULL but these can't be used for an interface.
I'm thinking of editting the TypeLibrary's to take a variant for those
params but I thought I'd see if anyone has any ideas.
Thanks,
Mitch Wolberg,
RockWare, Inc.
|
|
|
| Back to top |
|
 |
Mitch Guest
|
Posted: Fri Apr 13, 2007 10:12 pm Post subject: Re: Passing a NULL Interface as a Parameter in COM |
|
|
For posterity Dmitry was correct, the answer is to pass nil. The error
was in my conversion and understanding of the code. I assigned the full
path and filename where ESRI only wanted the filename.
Mitch wrote:
| Quote: | It crashes in the main application ArcMap which isn't my code so its a
bit of hit or miss as to what the problem is.
I'm working on the conversion of VB code that does work. So I'm pretty
sure the logic is OK even if I'm still not quite up to speed on the ESRI
architecture. ESRI doesn't support Delphi though of course we should
still be able to write COM extensions.
Mitch
Dmitry Streblechenko wrote:
nil is what you need. Where exactly does it crash? In your code or in
the COM object?
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
"Mitch" <mitch.ABB (AT) rockware (DOT) com> wrote in message
news:461ea8ce$1 (AT) newsgroups (DOT) borland.com...
I've got some VB code that passes 'Nothing' for some params that
require interfaces and I don't know what to use in Delphi. This
project is an ArcMap (ESRI) bolt on so I'm writing a COM DLL that can
be called by ArcMap.
VB Code:
pExportOpEvent.ExportFeatureClass pInDsNameEvent, Nothing, Nothing,
Nothing, pOutDatasetNameEvent, 0
Heres the ESRI Doc:
[Visual Basic 6.0]
Sub ExportFeatureClass(
ByVal inputDatasetName As IDatasetName, _
ByVal inputQueryFilter As IQueryFilter, _
ByVal inputSelectionSet As ISelectionSet, _
ByVal inputGeometryDef As IGeometryDef, _
ByVal outputFClassName As IFeatureClassName, _
ByVal parantHWnd As OLE_HANDLE _
)
I tried passing NIL which compiled but generated an AV when processing.
I tried defining the interfaces and not creating them, same result.
I've seen the discussions about replacing Nothing with EmptyParam,
Unassigned or NULL but these can't be used for an interface.
I'm thinking of editting the TypeLibrary's to take a variant for
those params but I thought I'd see if anyone has any ideas.
Thanks,
Mitch Wolberg,
RockWare, Inc.
|
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|