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++ / May 2005

Tip: Looking for answers? Try searching our database.

implicit/explicit __gc/__nogc confusion wrapping a windows api

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Achim Domma (Procoders) - 26 May 2005 07:56 GMT
Hi,

I still try to implement a .Net wrapper to handel AVI Files. I'm unsing
managed C++ with VStudio 2003. The structure of my classes looks like this:

class AudioStream {
    ...
}

class VideoStream {
    ...
}

class AviFile {
    IAVIFile*     file_;
    AudioStream*  audio_;
    VideoStream*  video_;

  public:
    void Open(const char* path) {
        AVIFileOpen(&file_,path,OF_SHARED_DENY_WRITE,NULL);
        audio_ = new AudioStream();
        video_ = new VideoStream();
    }
}

audio_ and video_ are pointers to unmanaged classes and, according to
the documentation, are therefore implicit unmanaged pointers. But what
about file_?

The call to AVIFileOpen results in the error "'AVIFileOpenA' : cannot
convert parameter 1 from 'IAVIFile* __gc*' to 'PAVIFILE*'. AVIFileOpen
is a windows function defined in Vfw.h.

How do I have to define file_ to get my example working?

regards,
Achim
Ronald Laeremans [MSFT] - 27 May 2005 00:33 GMT
> Hi,
>
[quoted text clipped - 34 lines]
> regards,
> Achim

I takte it that in reality AviFile is a __gc class?

If so, since file is a member of a __gc class, the address of it is a
__gc*. You need to pin it before handing it over to the AVIFileOpen API.

If not there is somegting else relevant in your code that you are not
showing.

Ronald Laeremans
Visual C++ team

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.