Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsVB SyntaxEnterprise DevelopmentDatabase AccessControlsCOMWin APICrystal ReportDeploymentGeneralGeneral 2
Related Topics
VB.NET / ASP.NETMS SQL ServerMS AccessOther Database ProductsMore Topics ...

VB Forum / Win API / June 2008



Tip: Looking for answers? Try searching our database.

Can this be put in a TypeLib?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
RB Smissaert - 22 Jun 2008 15:57 GMT
Is it possible to do this in a TypeLib:

Declare Function VarPtrArray Lib "msvbvm60.dll" _
                            Alias "VarPtr" _
                            (Var() As Any) As Long

The problem is how to define the incoming array argument.
Tried all sorts of contructions, but nil successfull.
What does work is making different functions for the different datatypes,
so:

       [entry(0x60000001)]
       long _stdcall ByteArrayPointer([in] SAFEARRAY(unsigned char)*
ByteArray);

etc.

Doing:

       [entry(0x60000004)]
       long _stdcall ArrayPointer([in] SAFEARRAY(void*)* Array);

or:

       [entry(0x60000004)]
       long _stdcall ArrayPointer([in] SAFEARRAY(void*) Array);

Will show as the above Declare in VB, but it will give the following error:

Function or Interface marked as restricted or the function uses an
Automation type  not
supported in Visual Basic.

When I looked at another .tlb though, VBVM6Lib.tlb there is a function that
does work and
the .idl for this is:

 //
========================================================================
 // Function ArrPtr
 //
========================================================================
 // VarPtr alias for obtaining a pointer to an array's SAFEARRAY structure
 //
========================================================================
    [
        entry("VarPtr"),
        helpstring("Returns a pointer to the SAFEARRAY descriptor of any
Visual Basic array, except string arrays due

to Visual Basic's implicit Unicode/ANSI conversion. For string arrays, use
StrArrPtr.")
    ]
 long __stdcall ArrPtr([in] SAFEARRAY(void) * Ptr);

And this shows in the TypeLib editor from Matthew Curland like this:

[in] SAFEARRAY** of void

But this is something I can't do with the tlb editor and the Pointer level
box shows empty with the label
in red, suggesting there is something wrong there. So, is this a bug or a
limitation in Curland's tlb editor,
or is there a way to do this without using .idl?

RBS
Thorsten Albers - 22 Jun 2008 19:01 GMT
RB Smissaert <bartsmissaert@blueyonder.co.uk> schrieb im Beitrag
<OOFrohH1IHA.5564@TK2MSFTNGP06.phx.gbl>...
> long _stdcall ArrayPointer([in] SAFEARRAY(void*)* Array);

This would be a pointer to a SAFEARRAY each element of which is a VOID
pointer!

> long _stdcall ArrayPointer([in] SAFEARRAY(void*) Array);

This would be a SAFEARRAY each element of which is a VOID pointer!

What you seem to need (and what you didn't list as something you have
tried) is a pointer to a SAFEARRAY each element of which is 'a void' (i.e.
any type:
long _stdcall ArrayPointer([in] SAFEARRAY(void)* Array);

Cmp. the sample from VBVM6Lib.tlb which you have provided:
> long __stdcall ArrPtr([in] SAFEARRAY(void) * Ptr);

> But this is something I can't do with the tlb editor and the Pointer level
> box shows empty with the label
> in red, suggesting there is something wrong there. So, is this a bug or a

> limitation in Curland's tlb editor,
> or is there a way to do this without using .idl?

If with that editor an entry like
 long _stdcall ArrayPointer([in] SAFEARRAY(void)* Array);
can't be created, it obviously is a problem of the editor since this is
correct IDL syntax (I myself don't know this editor...).

Signature

----------------------------------------------------------------------
Thorsten Albers                               albers(a)uni-freiburg.de
----------------------------------------------------------------------

RB Smissaert - 22 Jun 2008 19:12 GMT
Thank; so this increases my suspicion that this is a bug in that editor.
I think Matthew Curland has moved away from VB6, so I may have to
look at the source code (which I have) and see if this can be fixed.

RBS

> RB Smissaert <bartsmissaert@blueyonder.co.uk> schrieb im Beitrag
> <OOFrohH1IHA.5564@TK2MSFTNGP06.phx.gbl>...
[quoted text clipped - 27 lines]
> can't be created, it obviously is a problem of the editor since this is
> correct IDL syntax (I myself don't know this editor...).
Thorsten Albers - 22 Jun 2008 20:46 GMT
RB Smissaert <bartsmissaert@blueyonder.co.uk> schrieb im Beitrag
<#W8FQOJ1IHA.5472@TK2MSFTNGP06.phx.gbl>...
> Thank; so this increases my suspicion that this is a bug in that editor.
> I think Matthew Curland has moved away from VB6, so I may have to
> look at the source code (which I have) and see if this can be fixed.

Since you seem to experiment a bit around with type libraries and the VB
runtime maybe this may be of interest for you: With VS 6/VB 6 there is
shipped a tool called OLE/COM Object Viewer (OLEVIEW.EXE) which allows you
to browse the type library within the MSVBVM60.DLL. This allows you to see
the type library entries used by VB.

Signature

----------------------------------------------------------------------
Thorsten Albers                               albers(a)uni-freiburg.de
----------------------------------------------------------------------

RB Smissaert - 22 Jun 2008 21:06 GMT
Yes, got that one and that is how I could post the .idl.

RBS

> RB Smissaert <bartsmissaert@blueyonder.co.uk> schrieb im Beitrag
> <#W8FQOJ1IHA.5472@TK2MSFTNGP06.phx.gbl>...
[quoted text clipped - 7 lines]
> to browse the type library within the MSVBVM60.DLL. This allows you to see
> the type library entries used by VB.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.