473,320 Members | 1,867 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Default parameters in COM

Hi,

I would like to add a default parameter to a COM function. I defined
it in the IDL file like this:
HRESULT GetName( [in] BSTR id1
, [in] BSTR id2
, [in, defaultvalue("False")] BOOL disableSignin
, [out, retval] BSTR** pName );

But when I try to implement this function in COM, I can't set the
default value because it is not the last parameter... and I have to
keep the return value as the last parameter (to stop from breaking
client's codes etc.).

Am I wrong in thinking it should be possible to set a default
parameter in a COM function? How do you get around having the return
value at the end of the list of parameters or is it only possible on a
void function?

Thanks.

Aug 3 '07 #1
1 2664
abedford wrote:
Hi,

I would like to add a default parameter to a COM function. I defined
it in the IDL file like this:
HRESULT GetName( [in] BSTR id1
, [in] BSTR id2
, [in, defaultvalue("False")] BOOL disableSignin
, [out, retval] BSTR** pName );

But when I try to implement this function in COM, I can't set the
default value because it is not the last parameter... and I have to
keep the return value as the last parameter (to stop from breaking
client's codes etc.).

Am I wrong in thinking it should be possible to set a default
parameter in a COM function? How do you get around having the return
value at the end of the list of parameters or is it only possible on a
void function?
Well, since IDL is not topical for this group, I would suggest you try a
newsgroup dedicated to your platform.

Please see FAQ 5.9 for a list of possible newsgroups.
Aug 4 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

46
by: J.R. | last post by:
Hi folks, The python can only support passing value in function call (right?), I'm wondering how to effectively pass a large parameter, such as a large list or dictionary? It could achieved...
2
by: Michael Stembera | last post by:
I would like to use default parameters in nested templates but MS VC++ 7.1 chokes on it. Does anyone know how to fix the simple example below or if indeed it is possible? template <int N=7>...
18
by: Matt | last post by:
I try to compare the default constructor in Java and C++. In C++, a default constructor has one of the two meansings 1) a constructor has ZERO parameter Student() { //etc... } 2) a...
10
by: Ook | last post by:
I'm having trouble comprehending what exactly "default construction" is. I know how to provide a constructor with initial values, so that if I, for example, in my code do this: MyClass...
7
by: Vyssokih Max | last post by:
Hello! In C++, I can wrote: void Update(int count = 0) {...} and use it without parameters or with one parameter
8
by: cody | last post by:
Why doesn't C# allow default parameters for methods? An argument against I hear often is that the default parameters would have to be hardbaken into the assembly, but why? The Jit can take care of...
8
by: **Developer** | last post by:
Been reading some of the Marshal doc and am a little confused. Anyway, I've been using the following and it works OK. Public Declare Auto Function SHGetFolderPath Lib "shell32.dll" (ByVal hWnd...
14
by: cody | last post by:
I got a similar idea a couple of months ago, but now this one will require no change to the clr, is relatively easy to implement and would be a great addition to C# 3.0 :) so here we go.. To...
12
by: claudiu | last post by:
Hi, I'll go straight to the first question. Why does the code below compile? void f(int i = 0); int main() { (&f)();
7
by: jamesclose | last post by:
My problem is this (apologies if this is a little long ... hang in there): I can define a function in VB.NET with optional parameters that wraps a SQL procedure: Sub Test(Optional ByVal Arg1...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.