Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

How to define IDL methods, callable from VB?

Posted on 2001-07-10
7
Medium Priority
?
587 Views
Last Modified: 2013-11-25
Where can I find appropriate documentation on the subset of IDL (Interface Definition Language) functionality I can use when writing COM objects I want to be callable from Visual Basic.

I'm writing a few C++ utility functions in COM objects to be used by Visual Basic.  I'm sure there must be some documentation on what's valid and what's not, but I'm having a hard time finding it!  ;->

Typical error --
  "Compile error:"
  "Function or interface marked as restricted, or the function uses an Automation type not supported in Visual Basic"

Thanks!
0
Comment
Question by:JeffGrigg
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
7 Comments
 
LVL 3

Expert Comment

by:jrspano
ID: 6270770
why don't you just let c++ do it for you? Visual C++ 6 will generate everything you need when makeing com objects.
0
 
LVL 3

Expert Comment

by:jrspano
ID: 6270777
there is also some stuff about idl in the msdn library.  it has a fractal sample.
0
 

Author Comment

by:JeffGrigg
ID: 6270847
Well yes, VC++ 6 will "do all the IDL and C++ code generation for me," when I right click on the interface, select Add Method, and then type in the method name, and then >>> type in all the gory IDL details of all the parameters making sure to conform to all the *unknown* rules of types that Visual Basic is able to use <<<.

It's that last little step I'm having trouble with.  ;->
0
NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

 

Author Comment

by:JeffGrigg
ID: 6270992
Found partial answer on http://www.yukondude.com/articletamevbwithidl.asp

It contains a table I found helpful:
  Visual Basic Data Type -> IDL Data Type
  Boolean -> VARIANT_BOOL
  Byte -> unsigned char
  Collection -> _Collection*
  Currency -> CURRENCY
  Date -> DATE
  Double -> double
  Integer -> short
  Long -> long
  Object -> IDispatch*
  Recordset -> _Recordset*
  Single -> float
  String -> BSTR
  Variant -> VARIANT
  no parameters -> void
Figure 2 / Visual Basic data types and their corresponding data types in IDL
0
 

Author Comment

by:JeffGrigg
ID: 6277330
I seem to recall reading an article from Developmentor (http://www.developmentor.com) describing the limits of VB-implementable interfaces, but I can't find it.
_ _ _

On the other hand, I've found useful information in MSDN under the "oleautomation" keyword, from the MIDL language:  "The oleautomation attribute indicates that an interface is compatible with OLE Automation. The parameters and return types specified for its members must be OLE Automation-compatible, as listed in the following table."

Type -> Description
===================
boolean -> The MIDL base type boolean is incompatible with the oleautomation attribute. Use VARIANT_BOOL instead.
unsigned -> char 8-bit unsigned data item.
Double -> 64-bit IEEE floating-point number.
Float -> 32-bit IEEE floating-point number.
Int -> Integer whose size is system dependent. On 32-bit platforms, MIDL treats int as a 32-bit signed integer.
Long -> 32-bit signed integer.
Short -> 16-bit signed integer.
BSTR -> Length-prefixed string, as described in the OLE Automation topicBSTR.
CY -> (Formerly CURRENCY) 8-byte fixed-point number.
DATE -> 64-bit floating-point fractional number of days since December 30, 1899.
SCODE -> Built-in error type that corresponds to HRESULT.
Enum -> Signed integer, whose size is system-dependent. In remote operations, enum objects are treated as 16-bit unsigned entities. Applying the v1_enum attribute to an enum type definition allows enum objects to be transmitted as 32-bit entities.
IDispatch * -> Pointer to IDispatch interface (VT_DISPATCH).
IUnknown * -> Pointer to interface that is not derived from IDispatch (VT_UNKNOWN). (Any OLE interface can be represented by its IUnknown interface.)
0
 
LVL 49

Accepted Solution

by:
DanRollins earned 400 total points
ID: 7153031
JeffGrigg, an EE Moderator will handle this for you.
Moderator, my recommended disposition is:

    Refund points and save as a 0-pt PAQ.

DanRollins -- EE database cleanup volunteer
0
 

Author Comment

by:JeffGrigg
ID: 7153217
Good suggestion.

Thank you for tracking down and cleaning up outdated questions.  (You can have the points for that.  ;-)
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question