Still anybody know the answer to my usb printer problem?
Still anybody know the answer to my usb printer problem?
Are you running real DOS, or a console inside some version or other of windows?
If you're in windows, there's some configuration to make any printer appear as "LPT1" (say) to any program running in a console.
You'd need to do some digging elsewhere - the specifics of such things are beyond me
HeyBuddies,
Well, U see now, he wants to print in different modes (landscape etc...) I feel you should know the printer driver for the same or atleast a generic set of printer commands.I need to print to paper in landscape mode how is that done, also my file is a binary file not text. help!!!! (again).
Regards,
Sriharsha.
You could always take the dive and go API!!
I posted some API code a while ago that allowed the program to find the default printer and print ot it.....but if you want to select printer and have other features like amount of pages, page selection and it also gives you access to the printer config dialog that allows you to specify stuff like landscape printing ect.....
Far easier than killing youself with drivers!
Something like this (basic but hey it works!)
Again apologies for using a string on the C Board!Code:#include <string>//I am lazy when it comes to char arrays using std::string; #include <windows.h>//The all important header #include <commdlg.h>//Dont forget comdlg32.lib!!! int WINAPI WinMain(HINSTANCE,HINSTANCE,LPSTR,int) { PRINTDLG pd;//To initialise dialog & accept results string str = "API rules!! :p";//catchy phrase DOCINFO di = { sizeof(DOCINFO), "Fordy's Doc", NULL };//This gives details on doc...like its name when spooled ZeroMemory(&pd,sizeof(PRINTDLG));//saves initiliasing to zero pd.lStructSize = sizeof(PRINTDLG); pd.hwndOwner = HWND_DESKTOP; pd.Flags = PD_RETURNDC;//This gives DC to printer selected pd.nCopies = 1; if(!PrintDlg(&pd)) return 0;//If the user cancels....? if(StartDoc(pd.hDC,&di)>0 && StartPage(pd.hDC)>0){//new doc...new page TextOut(pd.hDC,10,10,str.c_str(),str.length()); //Write some text EndPage(pd.hDC);//end of page EndDoc(pd.hDC); //end of doc } DeleteDC(pd.hDC);//Clean up! return 0; }
Thanks for the reply unregistered, I pretty much know how to fseek, fread etc.
Id like to know how to print (to paper), to a specific format.
eg. if iwant to print a piece of data in the middle of a line then the next piece of data ten spaces further along the line.
Ive never accessed a printer before so i dont know where to start, also i have to access my printer through the USB port.
please help anyone.
yours shin.
Same here, usb. Thnx for that api code, it didn't work for me though , undeclared and stuff. There are no other ways are there?
thnx
Get a Win32 compiler.......devc++ is free and codewarrior is available on the front of UK magazines this month!Originally posted by Nutshell
Same here, usb. Thnx for that api code, it didn't work for me though , undeclared and stuff. There are no other ways are there?
thnx
Works on my DevC++....do you have the libraries included?
Cant find the default lib options on my IDE at the moment.......but I think you should make sure libwinspool.a & libcomctl32.a are in there
Hi guys,
check this file out and tell me if it helps you in anyway...
http://www.usb.org/developers/data/d...usbprint11.pdf
Regards,
Sriharsha
Help everyone you can