API with array of UDT's as argument?

May 31st, 2008 - 09:41 am ET by RB Smissaert | Report spam
Could anybody tell me a Windows API that has a pointer to an array of UDT's
as an argument?
The reason I am interested in this is to see how this is handled in Bruce
McKinney's
API .tlb. It will have to be an API that appears in that .tlb. I do know one
(WTSEnumerateProcesses)
but that is not in that .tlb.

RBS
email Follow the discussionReplies 12 repliesReplies Make a reply

Similar topics

Replies

#1 Jim Mack
May 31st, 2008 - 10:46 am ET | Report spam
RB Smissaert wrote:
Could anybody tell me a Windows API that has a pointer to an array
of UDT's as an argument?
The reason I am interested in this is to see how this is handled in
Bruce McKinney's API .tlb. It will have to be an API that appears
in that .tlb. I do know one (WTSEnumerateProcesses)
but that is not in that .tlb.



I'm not familiar with that TLB, but if you're just looking for an
example of how to use a UDT in a typelib, here's something from our
Stamina library. First the type definition of the struct, then one of
the functions that use it.

Jim Mack
MicroDexterity Inc
www.microdexterity.com



// DxFileInfoType

typedef
[helpstring("Used with Stamina directory routines"),
helpcontext(1005)]
struct {
BSTR fiLongName ;
BSTR fiShortName ;
long fiSize ;
long fiAttr ;
DATE fiCreated ;
DATE fiModified ;
DATE fiAccessed ;
long fiParent ;
long fiLink1 ;
long fiLink2 ;

} DxFileInfoType;


/* Function DxReadZipDir
(ByVal FileSpec As String,
Ary() As DxFileInfoType,
ByVal Start As Long) As Long */

[helpstring("Reads the directory of a ZIP file"),
helpcontext(276), entry(276)]
long DxReadZipDir
(
[in] LPSTR ZipFileSpec,
[in,out] SAFEARRAY (DxFileInfoType) * FileInfo,
[in] long FirstArrayIndex
);
Replies Reply to this message
#2 RB Smissaert
May 31st, 2008 - 11:04 am ET | Report spam
Thanks, that may help.
I am trying to avoid using .odl or .idl files and instead would like to do
it all
(making an API .tlb) with the .tlb editor from Matthew Curland.
I really put the question wrongly and should have said instead: I would like
to
see how an API that has a pointer to an array of UDT's shows in the .tlb
editor
from Matthew Curland. I am using the McKinney .tlb as a tester though.

RBS


"Jim Mack" wrote in message
news:ONt%
RB Smissaert wrote:
Could anybody tell me a Windows API that has a pointer to an array
of UDT's as an argument?
The reason I am interested in this is to see how this is handled in
Bruce McKinney's API .tlb. It will have to be an API that appears
in that .tlb. I do know one (WTSEnumerateProcesses)
but that is not in that .tlb.



I'm not familiar with that TLB, but if you're just looking for an
example of how to use a UDT in a typelib, here's something from our
Stamina library. First the type definition of the struct, then one of
the functions that use it.

Jim Mack
MicroDexterity Inc
www.microdexterity.com


>
// DxFileInfoType

typedef
[helpstring("Used with Stamina directory routines"),
helpcontext(1005)]
struct {
BSTR fiLongName ;
BSTR fiShortName ;
long fiSize ;
long fiAttr ;
DATE fiCreated ;
DATE fiModified ;
DATE fiAccessed ;
long fiParent ;
long fiLink1 ;
long fiLink2 ;

} DxFileInfoType;

>
/* Function DxReadZipDir
(ByVal FileSpec As String,
Ary() As DxFileInfoType,
ByVal Start As Long) As Long */

[helpstring("Reads the directory of a ZIP file"),
helpcontext(276), entry(276)]
long DxReadZipDir
(
[in] LPSTR ZipFileSpec,
[in,out] SAFEARRAY (DxFileInfoType) * FileInfo,
[in] long FirstArrayIndex
);

>


Replies Reply to this message
#3 Jim Mack
May 31st, 2008 - 11:32 am ET | Report spam
RB Smissaert wrote:
Thanks, that may help.
I am trying to avoid using .odl or .idl files and instead would
like to do it all
(making an API .tlb) with the .tlb editor from Matthew Curland.



I'm sure you have your reasons, but it really isn't hard to make an
API-style TLB using an .odl script with mktyplib or midl.

Jim
Replies Reply to this message
#4 RB Smissaert
May 31st, 2008 - 11:45 am ET | Report spam
To me it looked a lot simpler to use that editor.
For starters you can take an existing .tlb (like the McKinney one or the one
from Appelman)
and the delete the API's (and maybe constants and structures) you are not
interested in.
Then take that .tlb as a starting point and add the few remaining API's that
are not in the .tlb
yet as for example the WTS API's I need.
I did have a look for some tutorial about doing it via .odl, but couldn't
find anything good.

RBS


"Jim Mack" wrote in message
news:%
RB Smissaert wrote:
Thanks, that may help.
I am trying to avoid using .odl or .idl files and instead would
like to do it all
(making an API .tlb) with the .tlb editor from Matthew Curland.



I'm sure you have your reasons, but it really isn't hard to make an
API-style TLB using an .odl script with mktyplib or midl.

Jim



Replies Reply to this message
#5 Thorsten Albers
May 31st, 2008 - 01:06 pm ET | Report spam
RB Smissaert schrieb im Beitrag
<OjYJi#...
I am trying to avoid using .odl or .idl files and instead would like to


do
it all
(making an API .tlb) with the .tlb editor from Matthew Curland.
I really put the question wrongly and should have said instead: I would


like
to
see how an API that has a pointer to an array of UDT's shows in the .tlb
editor
from Matthew Curland. I am using the McKinney .tlb as a tester though.



It will be very difficult to find such an API: The API syntax usually is
that of C without any extensions, and in C an array is passed by passing a
pointer to the first element of the array somehow combined with a number
indicating the number of elements in the array. Therefore there will be no
difference between an API to which a single UDT is passed from an API to
which an array of UDTs is passed - unless the API works with SAFEARRAYs,
i.e. if the API is based on OLE/COM ('C with OLE/COM extension'). I never
came across such an API...

-
Thorsten Albers albers(a)uni-freiburg.de
-
Replies Reply to this message
Help Create a new topicNext page Replies Make a reply
Search Make your own search