Click here to Skip to main content
15,880,427 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: PCH files the answer fo Mixing C++ and C Pin
ForNow1-Aug-07 23:37
ForNow1-Aug-07 23:37 
GeneralRe: PCH files the answer fo Mixing C++ and C Pin
Roger Broomfield1-Aug-07 21:27
Roger Broomfield1-Aug-07 21:27 
GeneralRe: PCH files the answer fo Mixing C++ and C Pin
ForNow1-Aug-07 23:44
ForNow1-Aug-07 23:44 
GeneralRe: PCH files the answer fo Mixing C++ and C Pin
Roger Broomfield2-Aug-07 2:14
Roger Broomfield2-Aug-07 2:14 
GeneralRe: PCH files the answer fo Mixing C++ and C Pin
ForNow2-Aug-07 6:25
ForNow2-Aug-07 6:25 
QuestionHow to display IDispatch interface on Doc/View [modified] Pin
mcnam1-Aug-07 15:48
mcnam1-Aug-07 15:48 
Questionprogrammatically check current (or selected) printer is dot-matrix printer, InkJet or Laser ? Pin
ana_v1231-Aug-07 15:33
ana_v1231-Aug-07 15:33 
AnswerRe: programmatically check current (or selected) printer is dot-matrix printer, InkJet or Laser ? Pin
Randor 1-Aug-07 22:01
professional Randor 1-Aug-07 22:01 
wow, great question... I have never tried this before.

The only thing I can think of... is getting the PRINTER_INFO_2 struct and checking the capabilities of the printer.

First get the default printer.

HANDLE CPrinter::OpenDefaultPrinter(ACCESS_MASK dwMask)<br />
{<br />
	HANDLE hPrinter = INVALID_HANDLE_VALUE;<br />
	PRINTER_DEFAULTS pDef;<br />
	DWORD dwSize;<br />
<br />
	ZeroMemory(&pDef, sizeof(pDef));<br />
    GetDefaultPrinter(NULL, &dwSize);<br />
    <br />
	TCHAR* szBuffer = new TCHAR[dwSize];<br />
<br />
	if(NULL != szBuffer)<br />
	{<br />
		if(GetDefaultPrinter(szBuffer, &dwSize))<br />
		{<br />
			pDef.DesiredAccess = dwMask;<br />
			OpenPrinter(szBuffer, &hPrinter, &pDef);<br />
		}<br />
		delete szBuffer;<br />
	}<br />
	return hPrinter;<br />
}


Once you have the default printer... ou can populate a PRINTER_INFO_2 struct and look at all of the capabilities of the printer. I honestly dont know how to determine if a printer is dot matrix... but I have an idea...

I would think a dot matrix printer would probably have very low settings... low resolution... ect

Maybe something like this would work...

	HANDLE hPrinter = OpenDefaultPrinter();<br />
<br />
	if(INVALID_HANDLE_VALUE != hPrinter)<br />
	{<br />
		GetPrinter(hPrinter, 2, (LPBYTE)pInfo, 0, &dwNeeded);<br />
<br />
		if(0 < dwNeeded)<br />
		{<br />
			pInfo = static_cast<PRINTER_INFO_2 *>(GlobalAlloc(GPTR, dwNeeded));<br />
			if(NULL != pInfo)<br />
			{<br />
				if(GetPrinter(hPrinter, 2, (LPBYTE)pInfo, dwNeeded, &dwNeeded))<br />
				{<br />
					//<br />
					//CHECK PRINTER SETTINGS HERE... resolution... ect...<br />
					//<br />
				}<br />
			}<br />
			GlobalFree(pInfo);<br />
		}<br />
		ClosePrinter(hPrinter);<br />
	}


Some other possibilities... DeviceCapabilities() in the MSDN: http://msdn2.microsoft.com/en-us/library/ms535506.aspx[^]

Maybe by reading what the printer is capable of you can determine if it *might* be a dot matrix. I have never tried this, let me know if you have any success.

-Randor (David Delaune)
AnswerRe: programmatically check current (or selected) printer is dot-matrix printer, InkJet or Laser ? Pin
David Crow2-Aug-07 3:27
David Crow2-Aug-07 3:27 
GeneralRe: programmatically check current (or selected) printer is dot-matrix printer, InkJet or Laser ? Pin
ana_v1232-Aug-07 10:23
ana_v1232-Aug-07 10:23 
QuestionMixed Language Build C/C++ Pin
ForNow1-Aug-07 14:52
ForNow1-Aug-07 14:52 
AnswerRe: Mixed Language Build C/C++ Pin
Roger Broomfield1-Aug-07 18:11
Roger Broomfield1-Aug-07 18:11 
GeneralRe: Mixed Language Build C/C++ Pin
ForNow1-Aug-07 18:56
ForNow1-Aug-07 18:56 
QuestionRe: Heap problem?? desperately need help. Pin
Mark Salsbery1-Aug-07 10:25
Mark Salsbery1-Aug-07 10:25 
AnswerRe: Heap problem?? desperately need help. Pin
alberthyc1-Aug-07 10:32
alberthyc1-Aug-07 10:32 
GeneralRe: Heap problem?? desperately need help. Pin
Mark Salsbery1-Aug-07 10:42
Mark Salsbery1-Aug-07 10:42 
GeneralRe: Heap problem?? desperately need help. Pin
alberthyc1-Aug-07 11:05
alberthyc1-Aug-07 11:05 
GeneralRe: Heap problem?? desperately need help. Pin
Mark Salsbery1-Aug-07 11:23
Mark Salsbery1-Aug-07 11:23 
GeneralRe: Heap problem?? desperately need help. Pin
alberthyc1-Aug-07 11:32
alberthyc1-Aug-07 11:32 
GeneralRe: Heap problem?? desperately need help. Pin
Mark Salsbery1-Aug-07 11:37
Mark Salsbery1-Aug-07 11:37 
GeneralRe: Heap problem?? desperately need help. Pin
alberthyc1-Aug-07 11:46
alberthyc1-Aug-07 11:46 
GeneralRe: Heap problem?? desperately need help. Pin
Mark Salsbery1-Aug-07 11:58
Mark Salsbery1-Aug-07 11:58 
GeneralRe: Heap problem?? desperately need help. Pin
Mark Salsbery1-Aug-07 12:08
Mark Salsbery1-Aug-07 12:08 
QuestionDebugging Error Pin
pheven1-Aug-07 8:50
pheven1-Aug-07 8:50 
AnswerRe: Debugging Error Pin
Michael Dunn1-Aug-07 9:31
sitebuilderMichael Dunn1-Aug-07 9:31 

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.