How do I access the devmode structure?
HI. I see that there are methods to get or set the devmode structure. They
are procedures, so it does not look like I need to define a variable of
pdevmode in my local application. I know that the field within the devmode
structure that I need access to is dmFormName. I presume that you have a
variable declared as public that I can reference after doing the setdevmode.
Can you please tell me the variable name?
Sample:
procedure setformattribute;
var printerhandle :Thandle;
begin
{get dev mode that reflects printer control panel}
ppPrinter.GetDevMode(FDevMode);
??????????.dmformname:= 'PrePrinted';
{set ppPrinter dev mode}
ppPrinter.SetDevMode(FDevMode);
end;
are procedures, so it does not look like I need to define a variable of
pdevmode in my local application. I know that the field within the devmode
structure that I need access to is dmFormName. I presume that you have a
variable declared as public that I can reference after doing the setdevmode.
Can you please tell me the variable name?
Sample:
procedure setformattribute;
var printerhandle :Thandle;
begin
{get dev mode that reflects printer control panel}
ppPrinter.GetDevMode(FDevMode);
??????????.dmformname:= 'PrePrinted';
{set ppPrinter dev mode}
ppPrinter.SetDevMode(FDevMode);
end;
This discussion has been closed.
Comments
1. www.digital-metaphors.com/tips/SavePrinterDevMode.zip
2. I also recommending checking out RBuilder\Source\ppPrintr.pas, the method
PrinterSetupToDevMode
Best regards,
Nard Moseley
Digital Metaphors
www.digital-metaphors.com
SavePrinterDevMode project. The following code was in there. I see that
the GetDevMode method is used to set the properties to the printer and the
setdevmode is used to save the properties to some unseen variable containing
the data structure of DevMode within the Reportbuilder library. I need to
set properties without showing the propertiesdialog. Basically I want to
set something within that unseen data structure that the GetDevMode is
using. I do not know how to reference that unseen data structure without
the user interface dialog box. The methods are returning a handle from the
printer. From what I know of handles, that is really more like an address
on the network of where the printer is but tells you nothing about the
printer. I cannot do FDevMode^.dmformname:='something'; because fdevmode is
a handle, not a pointer to the record or variable.
Now that I have made myself as clear as I know how, can you please give me
an example of directly setting a printer property, bypassing the
ppPrinter.ShowPropertiesDialog ?
procedure TForm1.Button1Click(Sender: TObject);
begin
{clear current dev mode}
ppPrinter.SetDevMode(0);
{get dev mode that reflects printer control panel}
ppPrinter.GetDevMode(FDevMode);
{set ppPrinter dev mode}
ppPrinter.SetDevMode(FDevMode);
{show properties dialog for the printer and save the devmode}
if ppPrinter.ShowPropertiesDialog then
ppPrinter.GetDevMode(FDevMode);
end;
Thanks for the providing the additional information. Please re-read my post,
I believe my second suggestion provides the answer.
--
Nard Moseley
Digital Metaphors
www.digital-metaphors.com
Best regards,
Nard Moseley
Digital Metaphors
www.digital-metaphors.com