Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / Interop / September 2005

Tip: Looking for answers? Try searching our database.

VARIANT (automation type) in C#?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Petar Popara - 08 Sep 2005 16:17 GMT
The ActiveX control takes this VARIANT as function argument:

[id(3), helpstring("method Init")] HRESULT Init([in] VARIANT a_properties);

I'm assigning it in C# as:

someCOM.Init("C:\\abc.xml");

but I got some exception on this line:

---------------------------
Microsoft Visual C++ Debug Library
---------------------------
Debug Error!
Program: ...ode Samples\Test.exe
abnormal program termination

(Press Retry to debug the application)
---------------------------
Abort   Retry   Ignore
---------------------------

What should I do? :(
Petar Popara - 08 Sep 2005 16:20 GMT
P.S. Internally, ActiveX is expecting param to be of type BSTR (VT_BSTR).
Egbert Nierop (MVP for IIS) - 09 Sep 2005 11:19 GMT
> The ActiveX control takes this VARIANT as function argument:
>
[quoted text clipped - 6 lines]
>
> but I got some exception on this line:

Your DllImport in C# should have the object as a parameter.
The object type is marhaled to a VARIANT automatically when going to
unmanaged code.

> ---------------------------
> Microsoft Visual C++ Debug Library
[quoted text clipped - 9 lines]
>
> What should I do? :(

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
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



©2008 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.