hi JonY:

Thank you!, I managed to compile and link the program successfully. But when I 
try to execute, it's no showing nothing :(. I am expecting to view the dialog 
of printing but nothing happen, the program finishes quietly. what could be 
wrong with my cpp file? Help please.

Regards

/*****************************/
#include <stdio.h>
#include <windows.h>
#include <string.h>

void printer(const char text[]) {
    //Bring up a dialog to choose the printer
    PRINTDLG pd = {0};
    pd.lStructSize = sizeof(pd);
    pd.Flags = PD_RETURNDEFAULT | PD_RETURNDC;
    pd.nCopies = 1;

    //show the printer dialog
    PrintDlg(&pd);

    //Zero and then initialize the members of a DOCINFO structure
    DOCINFO di = {0};
    di.cbSize = sizeof(DOCINFO);
    di.lpszDocName = "Scribble Printout";
    di.lpszOutput = (LPTSTR) NULL;
    di.lpszDatatype = (LPTSTR) NULL;
    di.fwType = 0;

    //Begin a print job by calling the StartDoc function
    StartDoc(pd.hDC, &di);

    //send some text
    TextOut(pd.hDC, 800, 800, text, strlen(text));
    //lets close the printer
    //inform the driver that the page is finished
    EndPage(pd.hDC);

    //inform the driver the the document has ended
    EndDoc(pd.hDC);
}
/*
 * 
 */
int main()
{
    printer("Hola mundo");
    return 0;
}
/****************************************/

--------------------------------------------
El mié, 7/10/15, JonY <[email protected]> escribió:

 Asunto: Re: [Mingw-w64-public] Mingw64 not linking due to      undefined       
references
 Para: [email protected]
 Fecha: miércoles, 7 de octubre, 2015 17:41
 
 On 10/8/2015 05:03, Mack
 Paul wrote:
 > Hi Stefan:
 > I did the following:
 >
 g++     -o
 dist/Debug/MinGW-Windows/cppapplication_1
 build/Debug/MinGW-Windows/main.o -lcomdlg32 -v
 > but I got the same result.
 
 g++     -o
 dist/Debug/MinGW-Windows/cppapplication_1
 build/Debug/MinGW-Windows/main.o -lcomdlg32
 -lgdi32
 
 Use MSDN to find
 out what to link:
 undefined reference to `_imp__TextOutA@20'
 <- search for TextOut
 MSDN says
 gdi32.lib, so add -lgdi32 to your link command.
 
 > I wonder if it's necesssary to include
 the binary files of microsoft sdk??
 > 
 
 No.
 
 -----Adjunto en línea a continuación-----
 
 ------------------------------------------------------------------------------
 Full-scale, agent-less Infrastructure
 Monitoring from a single dashboard
 Integrate
 with 40+ ManageEngine ITSM Solutions for complete
 visibility
 Physical-Virtual-Cloud
 Infrastructure monitoring from one console
 Real user monitoring with APM Insights and
 performance trend reports 
 Learn More http://pubads.g.doubleclick.net/gampad/clk?id=247754911&iu=/4140
 -----Adjunto en línea a continuación-----
 
 _______________________________________________
 Mingw-w64-public mailing list
 [email protected]
 https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
 

------------------------------------------------------------------------------
_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to