From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,eaa66222999bc09a,start X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!postnews.google.com!f14g2000cwb.googlegroups.com!not-for-mail From: "david" Newsgroups: comp.lang.ada Subject: WIA Date: 3 Jan 2006 02:50:09 -0800 Organization: http://groups.google.com Message-ID: <1136285409.869370.95610@f14g2000cwb.googlegroups.com> NNTP-Posting-Host: 84.96.81.228 Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Trace: posting.google.com 1136285415 30575 127.0.0.1 (3 Jan 2006 10:50:15 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Tue, 3 Jan 2006 10:50:15 +0000 (UTC) User-Agent: G2/0.2 X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; fr; rv:1.8) Gecko/20051111 Firefox/1.5,gzip(gfe),gzip(gfe) X-HTTP-Via: 1.1 ipcop.localdomain:800 (squid/2.5.STABLE12) Complaints-To: groups-abuse@google.com Injection-Info: f14g2000cwb.googlegroups.com; posting-host=84.96.81.228; posting-account=u4Q15Q0AAADKWyyBzbem672RpGdPMd2u Xref: g2news1.google.com comp.lang.ada:2422 Date: 2006-01-03T02:50:09-08:00 List-Id: Hello, I'm trying to use wia in an ADA software. I have found little code samples to write com objects and this seems to work well. My problem is to use (Wia_Property_Storage_Interface.Lpvtbl.) Writemultiple : i'm not sure about interfacing the two types propspec and propvariant and the writemultiple call. In C, writemultiple is : HRESULT WriteMultiple( ULONG cpspec, const PROPSPEC rgpspec[], const PROPVARIANT rgpropvar[], PROPID propidNameFirst ); I'm not sure about the ada corresponding specifications for the "const type var[]". I wrote : type Propspec (Kind : Win32.Ulong) is record case Kind is when Prspec_Propid => Propid : Win32.Oleauto.Propid; when Prspec_Lpwstr => Lpwstr : Win32.Objbase.Lpolestr; when others => null; end case; end record; pragma Convention (C, Propspec); type Ppropspec is access all Propspec; function To_Ppropspec is new Ada.Unchecked_Conversion (System.Address, Ppropspec); type Tab_Propspec_Propid is array (Positive range <>) of Propspec (Prspec_Propid); type Propvariant (Vt : Win32.Oleauto.Varenum) is record Wreserved1 : Win32.Word; Wreserved2 : Win32.Word; Wreserved3 : Win32.Word; case Vt is when Win32.Oleauto.Vt_I4 => Ival : Win32.Long; when Win32.Oleauto.Vt_Bstr => Bstrval : Win32.Oleauto.Bstr; when others => null; end case; end record; pragma Convention (C, Propvariant); type Ppropvariant is access all Propvariant; function To_Ppropvar is new Ada.Unchecked_Conversion (System.Address, Ppropvariant); type Tab_Propvariant_Vt_I4 is array (Positive range <>) of Propvariant (Win32.Oleauto.Vt_I4); type Af_I_Wia_Property_Storage_Writemultiple is access function (This : access I_Wia_Property_Storage; Cpspec : Win32.Ulong; -- in Rgpspec : Ppropspec;-- in const propspec [] Rgpropvar : Ppropvariant;-- in const propvariant [] Propidnamefirst : Win32.Oleauto.Propid) -- in essayer avec 2 return Win32.Objbase.HRESULT; pragma Convention (Stdcall, Af_I_Wia_Property_Storage_Writemultiple); When calling this method, I write : Propspec_Flash_Mode : Tab_Propspec_Propid (1 .. 1) := (1 => (Kind => Prspec_Propid, Propid => Win32.Oleauto.Propid (Wia_Dpc_Flash_Mode))); Propvar_Flash_Fill : Tab_Propvariant_Vt_I4 (1 .. 1) := (1 => (Win32.Oleauto.Vt_I4, Win32.Word (0), Win32.Word (0), Win32.Word (0), Win32.Long (Wia_Flash_Mode_Fill))); My_Hresult := Wia_Property_Storage_Interface.Lpvtbl.Writemultiple (Wia_Property_Storage_Interface, 1, To_Ppropspec (Propspec_Flash_Mode (1)'Address), To_Ppropvar (Propvar_Flash_Fill (1)'Address), 2); I tried to work without tab_prospec_propid and tab_propvariant_vt_i4 but this doesn't work. When executing, my_hresult is s_false. I tried to use gnatcom to verify my interfacing but createcom seems to not work on wiaservc.dll (whereas it works on wiaaut.dll for example. So, I have 2 questions : Is someone see a mistake on my interface code ? Does someone know why gnatcom doesn't work on wiaservc.dll ? thank you very much and..... best wishes for 2006 David