Click here to Skip to main content
15,889,116 members
Home / Discussions / .NET (Core and Framework)
   

.NET (Core and Framework)

 
GeneralRandom Number generation PROBLEM Pin
Member 4648617-Jul-03 9:49
Member 4648617-Jul-03 9:49 
GeneralRe: Random Number generation PROBLEM Pin
leppie7-Jul-03 10:08
leppie7-Jul-03 10:08 
GeneralRe: Random Number generation PROBLEM Pin
chris lasater7-Jul-03 10:29
susschris lasater7-Jul-03 10:29 
GeneralRe: Random Number generation PROBLEM Pin
leppie7-Jul-03 10:50
leppie7-Jul-03 10:50 
GeneralRe: Random Number generation PROBLEM Pin
chris Lasater7-Jul-03 11:05
susschris Lasater7-Jul-03 11:05 
GeneralRe: Random Number generation PROBLEM Pin
leppie7-Jul-03 11:33
leppie7-Jul-03 11:33 
GeneralActive Directory Permissions Pin
DerekStrickland7-Jul-03 3:31
DerekStrickland7-Jul-03 3:31 
GeneralAnother question for "Interop GURUS" Pin
igor19606-Jul-03 12:06
igor19606-Jul-03 12:06 
OK, here is the following situation I hoped .NET is capable of resolving simple and elegantly:

I'm using COM Interop while exposing my WinForm User Control as an ActiveX control to the system.
So, I defined my custom [default] and [default, source] interfaces, placed all methods and events in there and created CoClass like that:

[GuidAttribute("C776B7B8-F928-442A-AFB1-2864ECC98166")]
[InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]
public interface IIn
{
....
}
[GuidAttribute("D776B7B8-F928-442A-AFB1-2864ECC98166")]
[InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]
public interface IOut
{
.....
}
// Attributes of the class: specify GUID if needed
[GuidAttribute("B776B7B8-F928-442A-AFB1-2864ECC98166")]
[ComSourceInterfaces(typeof(IOut))] // default source interface
[ClassInterface(ClassInterfaceType.None)]// no need for AutoDual, public class ActiveXNet : UserControl, IIn
{
....
}


As you can see, everything is great and it's working, the problem is that exported Type Library has the following sequence in CoClass declaration:

[
uuid(B776B7B8-F928-442A-AFB1-2864ECC98166),
version(1.0),
custom(.....)
]
coclass ActiveXNet {
interface _Object;
interface IComponent;
interface IDisposable;
[default] dispinterface IIn; <== It's placed at the bottom!!!
[default, source] dispinterface IOut;
};

So, what a big deal you may ask? The big deal is that another MSFT product which is Developer Studio V6.0 as well as newest V7.0, both still have "small" bug --> when creating ActiveX Control wrappers using MFC (remember those CWnd Derived classes with CreateControl and alot of Invoke Methods). Unfortunately, instead of creating Wrappers for [default] interface those MSFT products are still creating wrapper for the first Interface in the CoClass definition: So, in case of above described ActiveXNet CoClass -- I'm getting wrapped methods of _Object interface... and of course they are of no interest to anybody.

If I change class attribute to: [ClassInterface(ClassInterfaceType.AutoDual)] <== AutoDual here: Then I'm getting right layout of CoClass definition in typelibrary:
[
uuid(B776B7B8-F928-442A-AFB1-2864ECC98166),
version(1.0),
custom(.....)
]
coclass ActiveXNet {
[default] interface _ActiveXNet; <== see here it's the first Interface
interface _Object;
interface IComponent;
interface IDisposable;
[default, source] dispinterface IOut;
};

However, that is not satisfactory solution, because it doesn't include my explicitly defined IIn interface.

As I was told .NET suppose to make my life as programmer easier, so I've spend about 2 days now trying to figure out and find that "simple" solution. However, I'm giving up on doing it on my own and presenting you the problem, so you may demonstrate all of us yours "GURU" skills.

So, the question is: how can I easily rearange layout of TypeLibConverter::ConvertAssemblyToTypeLib.
I know about ICreateTypeLib and ICreateTypeInfo possible solutions, but would consider using them as introducing unnecesary overhead and complexity to the problem that CLR solution should resolve like a "piece of cake".
Maybe, there is some kind of an Attribute I don't knbow about and or etc...

Thanx in advance
GeneralRe: Another question for &quot;Interop GURUS&quot; Pin
Stephane Rodriguez.12-Jul-03 0:12
Stephane Rodriguez.12-Jul-03 0:12 
GeneralRe: Another question for &quot;Interop GURUS&quot; Pin
igor196012-Jul-03 6:27
igor196012-Jul-03 6:27 
GeneralRe: Another question for &quot;Interop GURUS&quot; Pin
Stephane Rodriguez.12-Jul-03 6:40
Stephane Rodriguez.12-Jul-03 6:40 
GeneralRe: Another question for &quot;Interop GURUS&quot; Pin
igor196012-Jul-03 7:00
igor196012-Jul-03 7:00 
GeneralRe: Another question for "Interop GURUS" Pin
Stephane Rodriguez.12-Jul-03 7:16
Stephane Rodriguez.12-Jul-03 7:16 
QuestionTlbImp.exe error: Any help? Pin
Anonymous5-Jul-03 5:49
Anonymous5-Jul-03 5:49 
AnswerRe: TlbImp.exe error: Any help? Pin
Nick Parker5-Jul-03 18:27
protectorNick Parker5-Jul-03 18:27 
General(Urgent) Visual JSharp silent mode installation Pin
Seetha Raman4-Jul-03 23:35
Seetha Raman4-Jul-03 23:35 
QuestionTelephony in .NET? Pin
J. Dunlap4-Jul-03 13:27
J. Dunlap4-Jul-03 13:27 
AnswerRe: Telephony in .NET? Pin
J. Dunlap5-Jul-03 18:31
J. Dunlap5-Jul-03 18:31 
GeneralCompact Framework and Cradle Pin
Braulio Dez4-Jul-03 6:41
Braulio Dez4-Jul-03 6:41 
General.NET Coders Wanted Pin
Derek Lakin4-Jul-03 5:18
Derek Lakin4-Jul-03 5:18 
GeneralRe: .NET Coders Wanted Pin
leppie4-Jul-03 7:07
leppie4-Jul-03 7:07 
GeneralRe: .NET Coders Wanted Pin
leppie4-Jul-03 7:33
leppie4-Jul-03 7:33 
GeneralRe: .NET Coders Wanted Pin
Derek Lakin4-Jul-03 8:10
Derek Lakin4-Jul-03 8:10 
GeneralRe: .NET Coders Wanted Pin
leppie4-Jul-03 8:24
leppie4-Jul-03 8:24 
GeneralRe: .NET Coders Wanted Pin
Derek Lakin4-Jul-03 8:28
Derek Lakin4-Jul-03 8:28 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.