* Prints with the Win32Ada Binding
@ 1999-04-21 0:00 Shawn Barber
1999-04-21 0:00 ` Martin C. Carlisle
` (3 more replies)
0 siblings, 4 replies; 7+ messages in thread
From: Shawn Barber @ 1999-04-21 0:00 UTC (permalink / raw)
I am trying to add print functionality to a piece of software I am working
with. I have been trying
to use PrintDlg_func to display the Print Dialog with no success. Does
anyone have an example?
Thank you.
Shawn Barber
Sikorsky Aircraft
SBarber@Sikosky.Com
**** Posted from RemarQ - http://www.remarq.com - Discussions Start Here (tm) ****
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Prints with the Win32Ada Binding
1999-04-21 0:00 Prints with the Win32Ada Binding Shawn Barber
@ 1999-04-21 0:00 ` Martin C. Carlisle
1999-04-21 0:00 ` David Botton
` (2 subsequent siblings)
3 siblings, 0 replies; 7+ messages in thread
From: Martin C. Carlisle @ 1999-04-21 0:00 UTC (permalink / raw)
In article <SgqT2.7031$_c.2511787@WReNphoon3>,
Shawn Barber <sbarber@snet.net> wrote:
>I am trying to add print functionality to a piece of software I am working
>with. I have been trying
>to use PrintDlg_func to display the Print Dialog with no success. Does
>anyone have an example?
The complete source to AdaGIDE is available from
http://www.usafa.af.mil/dfcs/bios/mcc_html/adagide.html
As a pointer, look in the print folder for a smaller example.
--Martin
--
Martin C. Carlisle, Asst Prof of Computer Science, US Air Force Academy
carlislem@acm.org, http://www.usafa.af.mil/dfcs/bios/carlisle.html
DISCLAIMER: This content in no way reflects the opinions, standards or
policy of the US Air Force Academy or the United States Government.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Prints with the Win32Ada Binding
1999-04-21 0:00 Prints with the Win32Ada Binding Shawn Barber
1999-04-21 0:00 ` Martin C. Carlisle
@ 1999-04-21 0:00 ` David Botton
1999-04-22 0:00 ` Shawn Barber
1999-04-23 0:00 ` Shawn Barber
3 siblings, 0 replies; 7+ messages in thread
From: David Botton @ 1999-04-21 0:00 UTC (permalink / raw)
To: Shawn Barber
I don't yet have an example for the Print Dialog on my site The Ada
Source Code Treasury, http://www.botton.com/ada, but there is an example
there for "Using the Open File Common Dialog Box" at
http://www.botton.com/ada/os/win32-opencmdlg.html which is very similar
in nature to the Print Dialog.
David Botton
Shawn Barber wrote:
>
> I am trying to add print functionality to a piece of software I am working
> with. I have been trying
> to use PrintDlg_func to display the Print Dialog with no success. Does
> anyone have an example?
> Thank you.
>
> Shawn Barber
> Sikorsky Aircraft
> SBarber@Sikosky.Com
>
> **** Posted from RemarQ - http://www.remarq.com - Discussions Start Here (tm) ****
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Prints with the Win32Ada Binding
1999-04-21 0:00 Prints with the Win32Ada Binding Shawn Barber
1999-04-21 0:00 ` Martin C. Carlisle
1999-04-21 0:00 ` David Botton
@ 1999-04-22 0:00 ` Shawn Barber
1999-04-25 0:00 ` David Botton
1999-04-23 0:00 ` Shawn Barber
3 siblings, 1 reply; 7+ messages in thread
From: Shawn Barber @ 1999-04-22 0:00 UTC (permalink / raw)
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.
**** Posted from RemarQ - http://www.remarq.com - Discussions Start Here (tm) ****
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Prints with the Win32Ada Binding
1999-04-21 0:00 Prints with the Win32Ada Binding Shawn Barber
` (2 preceding siblings ...)
1999-04-22 0:00 ` Shawn Barber
@ 1999-04-23 0:00 ` Shawn Barber
1999-04-23 0:00 ` Martin C. Carlisle
3 siblings, 1 reply; 7+ messages in thread
From: Shawn Barber @ 1999-04-23 0:00 UTC (permalink / raw)
I have looked at the AdaGIDE code and I'm getting an Invalid Handle error.
This currently isn't part
of any other code. I am trying to display the printer dialog alone. Why
would I get an invalid handle?
**** Posted from RemarQ - http://www.remarq.com - Discussions Start Here (tm) ****
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Prints with the Win32Ada Binding
1999-04-23 0:00 ` Shawn Barber
@ 1999-04-23 0:00 ` Martin C. Carlisle
0 siblings, 0 replies; 7+ messages in thread
From: Martin C. Carlisle @ 1999-04-23 0:00 UTC (permalink / raw)
In article <U8ZT2.17$5z.10909@WReNphoon1-bin>,
Shawn Barber <sbarber@snet.net> wrote:
>I have looked at the AdaGIDE code and I'm getting an Invalid Handle error.
>This currently isn't part
>of any other code. I am trying to display the printer dialog alone. Why
>would I get an invalid handle?
This is a difficult question to answer without more information. I can
assure you that the printing code in AdaGIDE has been used successfully
by many thousands of people.
Perhaps if you posted a small program that only displays the dialog, others
could attempt to replicate your results or provide more detailed guidance.
--Martin
--
Martin C. Carlisle, Asst Prof of Computer Science, US Air Force Academy
carlislem@acm.org, http://www.usafa.af.mil/dfcs/bios/carlisle.html
DISCLAIMER: This content in no way reflects the opinions, standards or
policy of the US Air Force Academy or the United States Government.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Prints with the Win32Ada Binding
1999-04-22 0:00 ` Shawn Barber
@ 1999-04-25 0:00 ` David Botton
0 siblings, 0 replies; 7+ messages in thread
From: David Botton @ 1999-04-25 0:00 UTC (permalink / raw)
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.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~1999-04-25 0:00 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-04-21 0:00 Prints with the Win32Ada Binding Shawn Barber
1999-04-21 0:00 ` Martin C. Carlisle
1999-04-21 0:00 ` David Botton
1999-04-22 0:00 ` Shawn Barber
1999-04-25 0:00 ` David Botton
1999-04-23 0:00 ` Shawn Barber
1999-04-23 0:00 ` Martin C. Carlisle
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox