Click here to Skip to main content
15,889,281 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: ERROR: Cannot open include file: 'hidsdi.h': No such file or directory Pin
Richard MacCutchan6-Jul-10 4:48
mveRichard MacCutchan6-Jul-10 4:48 
QuestionDelete documents from Printer Pin
Ananth3045-Jul-10 21:36
Ananth3045-Jul-10 21:36 
AnswerRe: Delete documents from Printer Pin
«_Superman_»5-Jul-10 21:51
professional«_Superman_»5-Jul-10 21:51 
GeneralRe: Delete documents from Printer Pin
Ananth3046-Jul-10 0:28
Ananth3046-Jul-10 0:28 
GeneralRe: Delete documents from Printer Pin
«_Superman_»6-Jul-10 1:10
professional«_Superman_»6-Jul-10 1:10 
QuestionRe: Delete documents from Printer Pin
Ananth3046-Jul-10 1:15
Ananth3046-Jul-10 1:15 
AnswerRe: Delete documents from Printer Pin
«_Superman_»6-Jul-10 1:17
professional«_Superman_»6-Jul-10 1:17 
GeneralRe: Delete documents from Printer Pin
Ananth3046-Jul-10 1:37
Ananth3046-Jul-10 1:37 
Hi Santosh,

I am using windows XP. IF its working fine in your machine and not in mine means there may be some mistake in my program. So I have attached the code below. I have used "Borland C++ builder" for this program. Can you have a look at it.? Let me know if there is any mistake....

#include <vcl.h>
#include <windows.h>
#include <iostream.h>
#include <stdlib.h>
#include <conio.h>
#include <stdio.h>

#include <winspool.h>void thebuffer(HANDLE hPrinter)
{
FILE * pFile;
long lSize;
char * buffer;
DWORD dwBytesWritten = 0;
size_t result;
LPPRINTER_DEFAULTS pDefault;
LPPRINTER_DEFAULTS DesiredAccess;

pFile = fopen ( "reafile.txt" , "rb" );


// allocate memory to contain the whole file.
buffer = (char*) malloc (lSize);



WritePrinter(hPrinter,buffer,lSize,&dwBytesWritten);


fclose (pFile);
free (buffer);
EndPagePrinter( hPrinter );
EndDocPrinter( hPrinter );
ClosePrinter( hPrinter );
return ;
}



void dbmain()
{
//BOOL fResult;
HANDLE hPrinter;
char name[256]="Canon MF4320-4350";
 
OpenPrinter(name, &hPrinter,0);
DWORD x;
DOC_INFO_1 DocInfo;

DocInfo.pDocName="reafile.txt";
DocInfo.pOutputFile=NULL;
DocInfo.pDatatype="RAW";

x=StartDocPrinter(hPrinter,1,(LPBYTE)&DocInfo);
cout<<"JobID: "<<x<<endl;
BOOL z=StartPagePrinter(hPrinter);
if(!z)
{
cout<<"it succeds"<<endl;
}
else{}

thebuffer(hPrinter);

}

void __fastcall TForm1::Button1Click(TObject *Sender)
{

dbmain();
ShowMessage("Data is sent to printer");
exit( 0);
}
//---------------------------------------------------------------------------


void __fastcall TForm1::Button2Click(TObject *Sender)
{
HANDLE hPrinter;
char name[256]="Canon MF4320-4350";
OpenPrinter(name, &hPrinter,0);

SetPrinter(hPrinter,0,NULL,PRINTER_CONTROL_PURGE);

ShowMessage("Reset is done");
ClosePrinter( hPrinter );
exit( 0);
}
//---------------------------------------------------------------------------

GeneralRe: Delete documents from Printer Pin
«_Superman_»6-Jul-10 1:38
professional«_Superman_»6-Jul-10 1:38 
GeneralRe: Delete documents from Printer Pin
Ananth3046-Jul-10 1:45
Ananth3046-Jul-10 1:45 
GeneralRe: Delete documents from Printer Pin
Ananth3046-Jul-10 2:01
Ananth3046-Jul-10 2:01 
GeneralRe: Delete documents from Printer Pin
Iain Clarke, Warrior Programmer6-Jul-10 2:15
Iain Clarke, Warrior Programmer6-Jul-10 2:15 
GeneralRe: Delete documents from Printer Pin
Ananth3046-Jul-10 2:23
Ananth3046-Jul-10 2:23 
GeneralRe: Delete documents from Printer Pin
Ananth3046-Jul-10 2:41
Ananth3046-Jul-10 2:41 
GeneralRe: Delete documents from Printer Pin
Ananth3046-Jul-10 2:42
Ananth3046-Jul-10 2:42 
GeneralRe: Delete documents from Printer Pin
«_Superman_»6-Jul-10 19:27
professional«_Superman_»6-Jul-10 19:27 
GeneralRe: Delete documents from Printer Pin
Ananth30413-Jul-10 0:54
Ananth30413-Jul-10 0:54 
GeneralRe: Delete documents from Printer Pin
Ananth30414-Jul-10 1:57
Ananth30414-Jul-10 1:57 
GeneralRe: Delete documents from Printer Pin
David Crow6-Jul-10 4:29
David Crow6-Jul-10 4:29 
GeneralRe: Delete documents from Printer Pin
Ananth30413-Jul-10 18:53
Ananth30413-Jul-10 18:53 
GeneralRe: Delete documents from Printer Pin
David Crow19-Jul-10 2:46
David Crow19-Jul-10 2:46 
GeneralRe: Delete documents from Printer Pin
KarstenK6-Jul-10 3:02
mveKarstenK6-Jul-10 3:02 
QuestionHandling sysmenu new item event Pin
eyalle5-Jul-10 20:53
eyalle5-Jul-10 20:53 
AnswerRe: Handling sysmenu new item event Pin
«_Superman_»5-Jul-10 21:04
professional«_Superman_»5-Jul-10 21:04 
GeneralRe: Handling sysmenu new item event Pin
eyalle5-Jul-10 21:06
eyalle5-Jul-10 21:06 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.