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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,6a74fd6ae762b6fd X-Google-Attributes: gid103376,public From: David Botton Subject: Re: Prints with the Win32Ada Binding Date: 1999/04/25 Message-ID: <37238373.A2E5F778@Botton.com>#1/1 X-Deja-AN: 470800487 Content-Transfer-Encoding: 7bit References: X-Accept-Language: en Content-Type: text/plain; charset=us-ascii X-Complaints-To: abuse@gate.net X-Trace: news.gate.net 925074294 33804 199.227.189.20 (25 Apr 1999 21:04:54 GMT) Organization: CyberGate, Inc. Mime-Version: 1.0 NNTP-Posting-Date: 25 Apr 1999 21:04:54 GMT Newsgroups: comp.lang.ada Date: 1999-04-25T21:04:54+00:00 List-Id: There is a bug in the binding. Windows is very particular about the lStructSize parameter since it uses it to version the calls. The value returned from (PRINTDLGW'Size + 1) / System.Storage_Unit is 68 and Windows expects 66 (as a sizeof(PRINTDLGW) in VC indicates). When I have a chance I'll hunt down where the bug is in the binding and report it. In the interim hard code 66 and hope for the best :) David Botton -- SAMPLE TEST CODE THAT WORKS with Ada.Text_IO; use Ada.Text_IO; with System; with Interfaces.C; use Interfaces.C; with Win32.Commdlg; with Get_Last_Error; procedure PrintDlg is use type Win32.BOOL; bIsSuccess : Win32.BOOL; Print_Struct : aliased Win32.Commdlg.PRINTDLG; begin put_line( Integer'IMAGE((Win32.Commdlg.PRINTDLG'Size + 1)/System.Storage_Unit)); -- a sizeof(PRINTDLGA) in VC indicates 66 no 68 which is what shows up -- PRINTDLGA and PRINTDLGW are both sized as 66 bytes in the C Win32 API. Print_Struct.lStructSize := 66; --(Win32.Commdlg.PRINTDLG'Size + 1)/System.Storage_Unit; Print_Struct.hwndOwner := System.Null_Address; Print_Struct.hDevMode := System.Null_Address; Print_Struct.hDevNames := System.Null_Address; Print_Struct.nFromPage := 1; Print_Struct.nToPage := 1; Print_Struct.nMinPage := 1; Print_Struct.nMaxPage := 1; Print_Struct.nCopies := 1; Print_Struct.Flags := Win32.Commdlg.PD_ALLPAGES or Win32.Commdlg.PD_COLLATE or Win32.Commdlg.PD_RETURNDC; bIsSuccess := Win32.commdlg.PrintDlg_Func(Print_Struct'Unchecked_Access); if bIsSuccess = Win32.False then Put_Line("NO GO!"); else Put_Line("Success!"); end if; end PrintDlg; Shawn Barber wrote: > > I have my call to PrintDlg_Func setup very close to your example David. I > still could get the Print > Dialog to display so I looked at the last error and I'm getting a "Class > does not exist" error message. > So I am again out of ideas.