Theos PowerBasic Museum 2017

Archive => Discussion - Legacy Software (PBWIN 9.0+/PBCC 5.0+) => Topic started by: Murray Ruggiero on January 07, 2011, 02:20:42 PM

Title: WHEN TO USE DIRECT, AND WHEN TO USE DISPATCH with Microsoft Libraries?
Post by: Murray Ruggiero on January 07, 2011, 02:20:42 PM
I'd like to access Microsoft's ADO library from my code.  I would think that I could make declarations such as:
Local myDatabaseConnection as INT__ADODB_Connection
Set myDatabaseConnection = NEWCOM $PROGID_ADODB_Connection
and so forth.
But in an example I saw in a powerbasic forum, the author said that he could not use code like this (Direct rather than dispatch) because the powerbasic com browser he used generated macros that somehow made it impossible.
So he uses "Object get" and so forth.
I'd like to know when I access other people's libraries, when I can use direct and when I can't.
Does anyone know?
Thanks
Title: Re: WHEN TO USE DIRECT, AND WHEN TO USE DISPATCH with Microsoft Libraries?
Post by: José Roca on January 07, 2011, 03:53:32 PM
Quote
But in an example I saw in a powerbasic forum, the author said that he could not use code like this (Direct rather than dispatch) because the powerbasic com browser he used generated macros that somehow made it impossible.

This must be the poorest excuse that I have heard in my life. If there is a problem with the generated code, modify it. Aren't we programmers?

Quote
I'd like to know when I access other people's libraries, when I can use direct and when I can't.
Does anyone know?

You can use direct interface calls if the server has a dual interface.