🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.multimedia
Article #40

How to convert OleVariant to WIA's ImageFile ?

#40
From: Sea Biscuit
Date: Mon, 24 Apr 2006 09:33
36 lines
2366 bytes
Hi, everybody:
    I try to Acquire Images from Digital Camera through Windows Images
Acciqusition Automation Layer 2.0(
http://www.microsoft.com/downloads/details.aspx?FamilyID=a332a77a-01b...

) in C++ Builder 6.0.
   I've successfully get the primitive control of camera, like the
following code:
         WideString sComand = "{AF933CAC-ACAD-11D2-A093-00C04F72DC3C}";

         IDevicePtr s4 = wiadlg->ShowSelectDevice( CameraDeviceType,
true, false );
         IItem* itm = s4->ExecuteCommand( sCommand.c_bstr() );
         sCommand = "{B96B3CAE-0728-11D3-.....}";
         TVariant v = itm->Transfer( sCommand.c_bstr() );

         now, I got Image File data in v, how could i convert it to
WIA's ImageFile.


         In the example provided by microsoft in c#,  the code is just
like this:
               ImageFile file = itm->Transfer( ..... );
               file->SaveToFile("c:\\aaa.jpg");


          But if i write code like this in cb6, a compiling error will
erose and say that
ImageFile is a abstract class, and can not be instanced here.


         How could i solve this problem and save my image file to disk
?
Are there anybody who have successfully implemented WIA Automation
Layer in CB6? 
          Thanks for your help.
Technical Details
Message-ID: <1145871217.256000.310110@g10g2000cwb.googlegroups.com>
Path: arc1-ca.pugleaf.net!g2news2.google.com!postnews.google.com!g10g2000cwb.googlegroups.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: 10d0fc,d732ab47f9f4c57d,start
X-Google-Attributes: gid10d0fc,public
X-Google-Language: ENGLISH,ASCII-7-bit
Path: arc1-ca.pugleaf.net!g2news2.google.com!postnews.google.com!g10g2000cwb.googlegroups.com!not-for-mail
From: "Sea Biscuit" <Chenides@163.com>
Newsgroups: borland.public.cppbuilder.multimedia
Subject: How to convert OleVariant to WIA's ImageFile ?
Date: 24 Apr 2006 02:33:37 -0700
Organization: http://groups.google.com
Lines: 37
Message-ID: <1145871217.256000.310110@g10g2000cwb.googlegroups.com>
NNTP-Posting-Host: 202.202.5.142
Mime-Version: 1.0
Content-Type: text/plain; charset="iso-8859-1"
X-Trace: posting.google.com 1145871223 27593 127.0.0.1 (24 Apr 2006 09:33:43 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Mon, 24 Apr 2006 09:33:43 +0000 (UTC)
User-Agent: G2/0.2
X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1),gzip(gfe),gzip(gfe)
Complaints-To: groups-abuse@google.com
Injection-Info: g10g2000cwb.googlegroups.com; posting-host=202.202.5.142;
   posting-account=RS8dVA0AAAA0Wv68jGxVxoUZ-XlCiQoh