Click here to Skip to main content
15,914,400 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: How to save a web page without any src lost just from a url? Pin
ThatsAlok8-May-05 19:26
ThatsAlok8-May-05 19:26 
Questionhow to get a handle to a text box not my own created? Pin
Amr Abdel-Mohsen8-May-05 13:45
Amr Abdel-Mohsen8-May-05 13:45 
AnswerRe: how to get a handle to a text box not my own created? Pin
ThatsAlok8-May-05 18:33
ThatsAlok8-May-05 18:33 
Questionhow to get a handle to a text box not my own created? Pin
Amr Abdel-Mohsen8-May-05 13:42
Amr Abdel-Mohsen8-May-05 13:42 
GeneralVC++ - Including " in a text string without ending the string Pin
JSadleir8-May-05 13:07
JSadleir8-May-05 13:07 
GeneralRe: VC++ - Including " in a text string without ending the string Pin
Rama Krishna Vavilala8-May-05 13:31
Rama Krishna Vavilala8-May-05 13:31 
GeneralRe: VC++ - Including " in a text string without ending the string Pin
JSadleir8-May-05 13:35
JSadleir8-May-05 13:35 
GeneralSetPrinter() Failed with ERROR_ACCESS_DENIED Pin
lxy8-May-05 12:31
lxy8-May-05 12:31 
I'm writting a function which send PostScript file directly to printer. Although it works, the paper is always the default size(A4).

To change paper size, I use SetPrinter(). But SetPrinter() need administrator privilege, and the printer is a shared printer of another computer in the network, which means no admin privilege can be got.

How to solve the problem fConfused | :confused: or setting paper size?

-------------------------------------------------------------------
PRINTER_DEFAULTS Defs;
PRINTER_INFO_2 *pPrnInfo2;
CPrintDialog dlg(TRUE);
DEVMODE *pDevMode;
CString szDeviceName;
HANDLE hPrinter;
DWORD dwNeeded;

if (dlg.DoModal() != IDOK) // select printer
return;

szDeviceName = dlg.GetDeviceName();
pDevMode = dlg.GetDevMode();
Defs.pDatatype = "RAW";
Defs.pDevMode = pDevMode;
Defs.DesiredAccess = PRINTER_ACCESS_USE; // if this, SetPrinter() failed
//Defs.DesiredAccess = PRINTER_ACCESS_ADMINISTER; // if this, OpenPrinter() failed

if (OpenPrinter((LPTSTR)(LPCTSTR)szDeviceName, &hPrinter, &Defs))
{
// Set Printer
GetPrinter(hPrinter, 2, 0, 0, &dwNeeded);
hGlobal = GlobalAlloc(GHND, dwNeeded);
pPrnInfo2 = (PRINTER_INFO_2 *)GlobalLock(hGlobal);
GetPrinter(hPrinter, 2, (LPBYTE)pPrnInfo2, dwNeeded, &dwNeeded);

pPrnInfo2->pDevMode->dmPaperSize = DMPAPER_A3;
if (!SetPrinter(hPrinter, 2, (LPBYTE)pPrnInfo2, 0))
TRACE("\n%d", GetLastError());

// Printing
DocInfo.pDocName = "EPS Document";
DocInfo.pOutputFile = NULL;
DocInfo.pDatatype = "RAW";
StartDocPrinter(hPrinter, 1, (LPBYTE)&DocInfo);
StartPagePrinter(hPrinter);

WritePrinter(hPrinter,....);

EndPagePrinter(hPrinter);
EndDocPrinter(hPrinter);
GlobalUnlock(hGlobal);
GlobalFree(hGlobal);
}

GlobalUnlock(pDevMode);
ClosePrinter(hPrinter);
GeneralFilePathProblem Pin
ddmcr8-May-05 11:14
ddmcr8-May-05 11:14 
GeneralRe: FilePathProblem Pin
Chris Losinger8-May-05 11:27
professionalChris Losinger8-May-05 11:27 
GeneralRe: FilePathProblem Pin
ddmcr8-May-05 22:05
ddmcr8-May-05 22:05 
GeneralRe: FilePathProblem Pin
Blake Miller9-May-05 5:09
Blake Miller9-May-05 5:09 
GeneralRe: FilePathProblem Pin
ddmcr9-May-05 7:19
ddmcr9-May-05 7:19 
GeneralRiched32.dll on w9x Pin
PJ Arends8-May-05 11:09
professionalPJ Arends8-May-05 11:09 
GeneralRe: Riched32.dll on w9x Pin
Graham Bradshaw8-May-05 11:24
Graham Bradshaw8-May-05 11:24 
GeneralRe: Riched32.dll on w9x [edited] Pin
PJ Arends8-May-05 11:53
professionalPJ Arends8-May-05 11:53 
GeneralRe: Riched32.dll on w9x Pin
Jim Crafton8-May-05 12:34
Jim Crafton8-May-05 12:34 
GeneralRe: Riched32.dll on w9x Pin
PJ Arends8-May-05 14:07
professionalPJ Arends8-May-05 14:07 
GeneralMFC as Static produces runtime error. Pin
Shining20058-May-05 9:39
Shining20058-May-05 9:39 
GeneralRe: MFC as Static produces runtime error. Pin
Blake Miller9-May-05 5:12
Blake Miller9-May-05 5:12 
Questionhow much processing power is my app using Pin
Mridang Agarwalla8-May-05 7:45
Mridang Agarwalla8-May-05 7:45 
AnswerRe: how much processing power is my app using Pin
Christian Graus8-May-05 18:40
protectorChristian Graus8-May-05 18:40 
AnswerRe: how much processing power is my app using Pin
Ryan Binns8-May-05 18:43
Ryan Binns8-May-05 18:43 
GeneralCEdit Validation Pin
ddmcr8-May-05 6:39
ddmcr8-May-05 6:39 
GeneralRe: CEdit Validation Pin
Jack Puppy8-May-05 7:50
Jack Puppy8-May-05 7:50 

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.