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 / Languages / Managed C++ / August 2006

Tip: Looking for answers? Try searching our database.

How to write a managed wrapper class for a unmanaged Dialog class in VC++?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
2yuexue - 23 Aug 2006 21:02 GMT
I have a dialog application that is created using VC++ 6.0 and a Windows form application using .NET 2003.  I'd like to access the Dialog from the form.  I have tried every thing I know to write a wrapper class for the dialog class but failed.  Would someone here help me out on this?

Thanks
William DePalo [MVP VC++] - 23 Aug 2006 21:15 GMT
>I have a dialog application that is created using
> VC++ 6.0 and a Windows form application using
> .NET 2003.  I'd like to access the Dialog from the
> form.  I have tried every thing I know to write a
> wrapper class for the dialog class but failed.

Well, you don't say what you tried and how it failed.

> Would someone here help me out on this?

Assuming that your resides in a DLL and exposes a flat interface, you have
at least three ways to go:

1) Use Platform/Invole aka P/Invoke aka P/Invoke to call from the managed
code to unmanaged code

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cp
conplatforminvokeexamples.asp


2) Use "It just works" aka IJW aka C++ interop in place of Platform/Invoke

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcmxspec/html/v
cmg_PlatformInvocationServices.asp


3) Wrap up the native code into a COM object and use the framework's support
for COm

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cp
conadvancedcominterop.asp


Regards,
Will

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.