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 2006

Tip: Looking for answers? Try searching our database.

add reference converts COM Long to C# int

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Ronan - 21 Sep 2006 17:46 GMT
When I add a reference to a COM dll using add reference in by c# console app,
the VB6 COM long variables of a function appears in the intellisense and
debug errors as an int.
From MSDN the sizes of the variables are:

com INT Holds signed 32-bit (4-byte) integers ranging in value from
-2,147,483,648 through 2,147,483,647.
.net int  -2,147,483,648 to 2,147,483,647

COM long Holds signed 64-bit (8-byte) integers ranging in value from
-9,223,372,036,854,775,808 through 9,223,372,036,854,775,807 (9.2...E+18).
.net long -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807

does anyone have a solution to this apart from manually writing interop?
Are there settings I can use to correct this?
Thanks
Mattias Sjögren - 21 Sep 2006 21:34 GMT
>COM long Holds signed 64-bit (8-byte) integers ranging in value from

No it doesn't. The VB6 Long type is equivalent to int in C#, and VB6
never supported any 64-bit integer type.

Mattias

Signature

Mattias Sjögren [C# MVP]  mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.

Bytemaster - 27 Sep 2006 23:44 GMT
The VB6 definitions are that an int is 16-bit and a long is 32-bit.  This
equates in
C# to short for 16 bit and int for 32-bit.

> When I add a reference to a COM dll using add reference in by c# console app,
> the VB6 COM long variables of a function appears in the intellisense and
[quoted text clipped - 12 lines]
> Are there settings I can use to correct this?
> Thanks

Rate this thread:







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.