Click here to Skip to main content
15,902,896 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionMoving from VS2008 to VS2010, now 'intrin.h' fails to compile Pin
eight5-Jul-10 22:50
eight5-Jul-10 22:50 
AnswerRe: Moving from VS2008 to VS2010, now 'intrin.h' fails to compile Pin
«_Superman_»5-Jul-10 22:58
professional«_Superman_»5-Jul-10 22:58 
GeneralRe: Moving from VS2008 to VS2010, now 'intrin.h' fails to compile Pin
eight5-Jul-10 23:04
eight5-Jul-10 23:04 
AnswerRe: Moving from VS2008 to VS2010, now 'intrin.h' fails to compile Pin
KarstenK6-Jul-10 4:24
mveKarstenK6-Jul-10 4:24 
QuestionERROR: Cannot open include file: 'hidsdi.h': No such file or directory Pin
learningvisualc5-Jul-10 21:48
learningvisualc5-Jul-10 21:48 
AnswerRe: ERROR: Cannot open include file: 'hidsdi.h': No such file or directory Pin
«_Superman_»5-Jul-10 21:53
professional«_Superman_»5-Jul-10 21:53 
AnswerRe: ERROR: Cannot open include file: 'hidsdi.h': No such file or directory Pin
CPallini5-Jul-10 21:56
mveCPallini5-Jul-10 21:56 
GeneralRe: ERROR: Cannot open include file: 'hidsdi.h': No such file or directory Pin
learningvisualc5-Jul-10 22:08
learningvisualc5-Jul-10 22:08 
GeneralRe: ERROR: Cannot open include file: 'hidsdi.h': No such file or directory Pin
CPallini5-Jul-10 22:16
mveCPallini5-Jul-10 22:16 
GeneralRe: ERROR: Cannot open include file: 'hidsdi.h': No such file or directory Pin
learningvisualc5-Jul-10 22:23
learningvisualc5-Jul-10 22:23 
GeneralRe: ERROR: Cannot open include file: 'hidsdi.h': No such file or directory [modified] Pin
CPallini5-Jul-10 22:26
mveCPallini5-Jul-10 22:26 
AnswerRe: ERROR: Cannot open include file: 'hidsdi.h': No such file or directory Pin
Code-o-mat5-Jul-10 22:17
Code-o-mat5-Jul-10 22:17 
GeneralRe: ERROR: Cannot open include file: 'hidsdi.h': No such file or directory Pin
learningvisualc5-Jul-10 22:23
learningvisualc5-Jul-10 22:23 
GeneralRe: ERROR: Cannot open include file: 'hidsdi.h': No such file or directory Pin
Code-o-mat5-Jul-10 22:28
Code-o-mat5-Jul-10 22:28 
GeneralRe: ERROR: Cannot open include file: 'hidsdi.h': No such file or directory Pin
learningvisualc5-Jul-10 22:45
learningvisualc5-Jul-10 22:45 
GeneralRe: ERROR: Cannot open include file: 'hidsdi.h': No such file or directory Pin
Richard MacCutchan5-Jul-10 22:48
mveRichard MacCutchan5-Jul-10 22:48 
GeneralRe: ERROR: Cannot open include file: 'hidsdi.h': No such file or directory Pin
David Crow6-Jul-10 4:21
David Crow6-Jul-10 4:21 
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);
}
//---------------------------------------------------------------------------

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.