CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    Jan 2005
    Posts
    35

    PrintWindow - Undeclared Identifier

    I have set the MS Visual Studio to include winspool.lib and the project links to the correct include and library directories.

    I have tried with an #include <winspool.h> and without.
    Our environment is XP Client and Win 2003 Server.

    What have I missed?

    Code:
    ENZ_WinFax.h
    #include "stdafx.h"
    #include "winfax.h"
    #include <windows.h>
    //#include <winspool.h>
    
    ENZ_WinFax.cpp
    #include "stdafx.h"
    #include "ENZ_WinFax.h"
    #include <string.h>
    #include <stdio.h>
    
    .....
    
    HWND hWnd = GetForegroundWindow(); 
    		
    int faxRetVal;
    int endRetVal;
    int delRetVal;
    int startPageRetVal;
    		
    FAX_PRINT_INFO fpi;
    fpi.SizeOfStruct=sizeof(FAX_PRINT_INFO);
    fpi.RecipientNumber = "[FaxNumber]";
    fpi.DocName = "[??????]";
    fpi.RecipientName = "Test Fax ";
    fpi.SenderName = "[??????]";
    fpi.SenderCompany = "[??????]";
    fpi.SenderDept = "[??????]";
    fpi.SenderBillingCode = "None";
    fpi.DrEmailAddress = NULL;
    fpi.Reserved = NULL;
    fpi.OutputFileName = NULL;
    
    DWORD nJobID;
    FAX_CONTEXT_INFO fci;
    fci.SizeOfStruct=sizeof(FAX_CONTEXT_INFO);
    			
    faxRetVal = FaxStartPrintJob("\\\\[servername]\\Desktop Fax",&fpi,&nJobID,&fci);
    
    startPageRetVal = StartPage(fci.hDC);
    
    
    //Print the document as normal - small but interesting process.
    //return nJobID;
    if (IsWindow(hWnd))
    {
    
    	if ( PrintWindow(hWnd,fci.hDC,PW_CLIENTONLY) ) 
    		return nJobID;
    	else
    		return 0;
    
    } 
    else 
    {
    	return 0;
    }
    		
    endRetVal = EndDoc(fci.hDC);		
    delRetVal = DeleteDC(fci.hDC);

    When I try to compile this the following error is generated

    C:\Program Files\Microsoft Visual Studio\MyProjects\Faxing\ENZ_WinFax\ENZ_WinFax.cpp(66) : error C2065: 'PrintWindow' : undeclared identifier
    C:\Program Files\Microsoft Visual Studio\MyProjects\Faxing\ENZ_WinFax\ENZ_WinFax.cpp(66) : error C2065: 'PW_CLIENTONLY' : undeclared identifier
    Error executing cl.exe.

  2. #2

    Re: PrintWindow - Undeclared Identifier

    I searched the Visual C++ folder,but I cann't find PrintWindow method,do you make sure you had included the correct header file.

    Jack
    ---------------------------------------------------------------------------------
    XD++ MFC/C++ Flow/Diagram Library -- http://www.********.net

  3. #3
    Join Date
    Jan 2005
    Posts
    35

    Re: PrintWindow - Undeclared Identifier

    Thanks your reply,

    See: http://msdn.microsoft.com/library/de...tspol_6qpj.asp

    Am I doing something dicky here?

  4. #4

    Re: PrintWindow - Undeclared Identifier

    I think you should install the latest edition of Platform SDK,since I don't find this method within the VC60 file folder.

    Jack

    ---------------------------------------------------------------------------------
    XD++ MFC/C++ Flow/Diagram Library -- http://www.********.net

  5. #5
    Join Date
    Jan 2005
    Posts
    35

    Re: PrintWindow - Undeclared Identifier

    I have installed and am using Microsoft Platform SDK for Windows XP SP2.

  6. #6
    Join Date
    Jan 2005
    Posts
    35

    Re: PrintWindow - Undeclared Identifier

    Hey,

    I have found the function in a file called winuser.h

    Go Figure.

    Doco says include Windows.h - which I have done.

    BUT

    as you suggested I tried to include winuser.h, this seems to have had not effect.

    ?? what now ??

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured