The MASM Forum

General => The Campus => Topic started by: xandaz on December 13, 2020, 07:54:07 AM

Title: hello. Any examples on how to use printers
Post by: xandaz on December 13, 2020, 07:54:07 AM
   I'm desperate to put my printer to work but haven't figured out how to do it. Does anyone have an example? Thanks
Title: Re: hello. Any examples on how to use printers
Post by: LiaoMi on December 13, 2020, 08:31:16 AM
Hi xandaz,

how to use printers from Siekmanski  :thumbsup:
Title: Re: hello. Any examples on how to use printers
Post by: xandaz on December 13, 2020, 09:10:20 AM
  thanks Liao
Title: Re: hello. Any examples on how to use printers
Post by: xandaz on December 13, 2020, 09:35:41 AM
   i have to say..it's kinda complex. but i'm looking into it. Thanks
Title: Re: hello. Any examples on how to use printers
Post by: LiaoMi on December 14, 2020, 09:19:25 AM
Hi,

maybe this example will be easier  :icon_idea:
Title: Re: hello. Any examples on how to use printers
Post by: deeR44 on December 28, 2020, 07:34:06 PM
Any printer that you buy comes with any driver programs and
instructions you need to print just about anything on it. Many
printer manufacturers call these instructions a "manual".

For a person who asks some very complicated questions, it's
hard for me to believe that you cannot do something as simple
as printing a document.

Title: Re: hello. Any examples on how to use printers
Post by: jj2007 on December 28, 2020, 07:55:05 PM
Quote from: deeR44 on December 28, 2020, 07:34:06 PM
Any printer that you buy comes with any driver programs and
instructions you need to print just about anything on it. Many
printer manufacturers call these instructions a "manual".

For a person who asks some very complicated questions, it's
hard for me to believe that you cannot do something as simple
as printing a document.

Xandaz is trying to print a document programmatically, i.e. from Assembly. If you know how to do that, don't hesitate to post your source here.
Title: Re: hello. Any examples on how to use printers
Post by: TouEnMasm on December 29, 2020, 03:35:02 AM

this one is enough to start:
https://docs.microsoft.com/en-us/windows/win32/dlgbox/print-dialog-box (https://docs.microsoft.com/en-us/windows/win32/dlgbox/print-dialog-box)
Title: Re: hello. Any examples on how to use printers
Post by: TouEnMasm on December 29, 2020, 04:16:17 AM
sample

int BoiteDialogImprime()
{
    PRINTDLG pd;
    HWND hwnd = 0;

    // Initialize PRINTDLG
    ZeroMemory(&pd, sizeof(pd));
    pd.lStructSize = sizeof(pd);
    pd.hwndOwner = hwnd;
    pd.hDevMode = NULL;     // Don't forget to free or store hDevMode.
    pd.hDevNames = NULL;     // Don't forget to free or store hDevNames.
    pd.Flags = PD_USEDEVMODECOPIESANDCOLLATE | PD_RETURNDC;
    pd.nCopies = 1;
    pd.nFromPage = 0xFFFF;
    pd.nToPage = 0xFFFF;
    pd.nMinPage = 1;
    pd.nMaxPage = 0xFFFF;

    if (PrintDlg(&pd) == TRUE)
    {
        // GDI calls to render output.

        // Delete DC when done.
        DeleteDC(pd.hDC);

    }
    return 0;
}