Visual C++ :: How To Find Printer Resolution From GetDeviceCaps
Dec 6, 2012
I have written a program to capture signal from machine and display it on screen in the form of sinosoidal wave. I have print buffer for 256 X 400 pixel strip chart. This prints fine if I set page size A4 and resolution 600 DPI. If anyone changes print parameters , there is problem. I can resize the printer buffer and interpolate the stored signal.
My problem is , how to find the printer resolution from GetDeviceCaps ? how to know the Print Type Normal / Draft etc in mFC.
View 2 Replies
ADVERTISEMENT
Mar 25, 2013
I have an mfc dialog of size 1280 X 1024 and when i change the resolution to 800 X 600, after adding scroll bar, it don't show the entire dialog contents, Seems like it clips the 800 X 600 portion.
I have handled VScroll and HScroll. It works fine for higher resolutions!
View 1 Replies
View Related
Jun 13, 2014
I stumbled upon an unexpected difference between GCC and VisualStudio: Different overloaded functions are called in the following example:
// -------- can assume this is located in 'tool.h' file --------------
// Fwd declaration support foo( const int& ) gets called as expected by both compilers
// void foo( const int& n );
template< typename T >
void foo( const T& n ) {
[Code] ....
What happens: I expected that by calling bar(1) compiler will notice both versions of foo() and call the best match, in this case foo(const int&). That is not the case.
Note that overloaded foo(const int&) is below bar(). It seems that at that point GCC does not see overloaded version, and happily calls template version. Visual studio on the other hand has no problem finding them both.
If I introduce a forward declaration of foo( const int& ) before bar(), both compilers call that version correctly. Unfortunately, that is not a solution for my problem here.
Template version is part of a library while overloaded is part of the user code. Both would be located in different (header) files and I would not like to impose #include order to the users or to be dependant on it.
View 2 Replies
View Related
Mar 14, 2013
Need a free image library that can handle png xresolution and yresolution. I need it to be compatible with visual studio 6.0
View 1 Replies
View Related
Jun 28, 2013
I have code that prints.
PrintDlg.
StartDoc
StartPage
TextOut
EndPage
EndDoc
I am trying to calculate left margin from (inchis * 100) to pixels. So the left input for TextOut will be correct. How do I do this?
View 8 Replies
View Related
Apr 12, 2014
I am using PDF Creator printer to print my files. I have set it as default printer. It displays two dialogs .. "Printer Setup Dialog" and "Dialog asking filename and other details to save to file".
I want to avoid these two dialogs. But EndDoc calls the other dialog by default. How to do this ?
View 13 Replies
View Related
Feb 21, 2013
I have done alot of googling for the scope resolution operator and Ive gained a bit of an understanding as to what it does i know it can distinguish between global and local variables, but I see it used to access methods/members of classes such as this example, why not just use a dot instead to access it?:
sql:: Driver *driver;
Why is the scope resolution operator being used here?
View 11 Replies
View Related
Apr 23, 2013
I have a global var (m) with an initial value 5.
I have a template class (A) that derives from a either a base class that has a member (_A1.m) or not (_A0), based upon it's template parameter. class (A) has a member function (fn) returns the value of (m) as it understands what (m) is.
However, this gives different results compared with a non-template class in a similar scenario. I'm expecting that if derived from _A1, that m should be taken from the base class scope and if derived from _A0, it should be taken from the global one.
Here is the code for your amusement:
int m = 5;
class _A0 {
public:
_A0(int) {
[Code] ....
This compiled using g++ 4.5.3 and 4.6.3 with the same results:
Global value of m is: 5
B0 class has no internal m member. Object resolves m internally with value 5
B1 class has internal m member. Object resolves m internally with value 3
A<_A0> class has no internal m member. Object resolves m internally with value 5
A<_A1> class has internal m member. Object resolves m internally with value 5
View 2 Replies
View Related
Mar 29, 2015
Just reading some code and come across a section where its setting the resolution on a screen
so like
image->sizeX=640;
image->sizeY = 480;
size = image->sizeX * image->sizeY *3;
float sizeLog = ceil(log((float)image->sizeX) / log(2.F)));
So yea, my understanding of this code is that firstly there is member access and that a resolution is being set.
And then its like 640 * 480 * 3
and then the log of 640 *480*3 ...being divided by something else and being rounded up by ceil
is this the right way to look at it?
and also what is the log(2.F) - i don't really understand that.
View 3 Replies
View Related
Jan 2, 2014
I'm trying to learn how to use variadic templates, and I decided a great example would be serializing a series of types into a stringstream:
Code:
// Send a fully constructed message.
virtual void send(ostringstream &msg) = 0;
// Construct a message from the arguments and send it.
// This is the usual entry point.
template <typename ...Args>
void send(Args ...args {
[Code] ....
This works fine, so far as I can tell. However, I decided to see if I could specialize the way certain types are serialized. I tried using a Google Protocol Buffer object as an example, and added this:
Code:
// Handle a protocol buffer type while constructing a message.
template <typename ...Args>
void send(ostringstream &msg,
const google::protobuf::MessageLite &protobuf, Args ...args) {
std::string msg_str = protobuf.SerializeAsString();
msg << msg_str;
send(msg,args...);
}
I would expect this overload to be preferred over the generic T overload when a protobuf object (which always inherits from MessageLite) is passed into send() anywhere in the list. However, this is not happening. I am getting an error message to the effect that << doesn't know how to deal with my concrete type, pointing at the T overload.
View 4 Replies
View Related
Aug 25, 2014
What is the limit of a VGA with 256k VRAM, running 1bpp monochrome graphics? How high can the display resolution go?
View 3 Replies
View Related
Oct 29, 2014
Is there a way to access the printer in ANSI C ?
I have written a program and would like to print out the data (held in a file).
All I can find is that there seems to be no way to send a file to the printer and stay within the confines of ANSI C.
I am restricting my use to ANSI specs for the portability. Do I have any options?
View 1 Replies
View Related
May 21, 2014
The problem is when i run this program and program is stop working but the output is out.
#include <iostream>
#define _WIN32_WINNT 0x0500
#include <windows.h>
#include <conio.h>
using namespace std;
void EnumeratePrinters(DWORD flags);
[Code] ....
View 6 Replies
View Related
May 16, 2014
take a look at this project : [URL] i want to change this project for this purpose : when a USB PRINTER is connected show a message that tell us -> hey this is a printer. which part of this project should i change and how can i separate printer devices from the others?
note: if you are using visual studio 2010 or higher and get error for this line after conversion :
#define _WIN32_WINNT 0x403
just replace all of such these lines to stdafx.cpp file. means stdafx.cpp at last should be like this :
// stdafx.cpp : source file that includes just the standard includes
// HWDetect.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information
#define _WIN32_WINNT 0x403
#include "stdafx.h"
View 1 Replies
View Related
Dec 16, 2014
I'm not new to C++ programming but I'm not an expert either. I'm using Borland C++ builder 5. I know it's extremely antiquated, but I have no choice right now. Writing a database reporting program, using third party report building components (ACE) which has it's own print dialogs built in. However, in this report we cannot use the build in dialogs and have to use a standard TPrintDialog. When the TPrintDialog is executed and you click print on the dialog, only one page is sent to the printer.
Here's some code:
// The dataset for the report is executed prior to this code and does not //change.
Once the data is gathered, the report can be run as often as you like // and the same data will appear in the report.
Code:
if (cbxShowForm->Checked){
OverlayBand->Visible = true;
AllowPrint = false;
SctReport1->Prompt = false;// disables ACE Reporter Print Dialog
SctReport2->Prompt = false;
[Code] ....
View 1 Replies
View Related
Nov 30, 2014
Write a program to simulate a printer queue (priority queue or heap – Bentley article has code) where 3 printers are “fed” by this queue. Each print job has an unchanging priority and higher priority jobs go first (although once started, a job isn't stopped to let a higher one go). For each unit of time, there is a 26% probability that a job will be added to the queue and all jobs take 8 time units to complete. Print job priorities are between 5 and 100. The queue opens 20 time units prior to the start of printing for adding print “jobs”. A print “day” is 1000 time units. The output from your program is:
1) A list of jobs completed with their priorities for each printer
2) A list of jobs not completed (if any).
#include <iostream>
#include <cstdio>
#include <cstring>
[Code].....
View 1 Replies
View Related
Sep 20, 2012
I have a test web page and a windows form which call a printer and sends a print job to a printer that is on the network. I have been able to successfully do this from the windows form, however, I can figure out how to do it from an aspx page to the server's default printer. Sample codes are below.
Windows Form:
public partial class Form1 : Form {
private const string TEMPLATE_DIRECTORY = @"C:Program FilesBrother bPAC3 SDKTemplates"; // Template file path
private const string TEMPLATE_SIMPLE = "NamePlate1.LBX"; // Template file name
private const string TEMPLATE_FRAME = "NamePlate2.LBX"; // Template file name
public Form1() {
InitializeComponent();
[Code] ....
View 1 Replies
View Related
Aug 10, 2013
I want to print the output of a c programme to a printer. Operating system is MS Windows xp sp2. This is the programme:
Code:
#include<stdio.h>
#include<conio.h>
void main()
{
printf("
Hello Chandan2... ");
getch();
}
The output "Hello Chandan2..." is to be printed in printer, when i run the programme , but how to do it?
View 6 Replies
View Related
Apr 29, 2015
I've got a project to develop a virtual pdf printer driver for windows in C++ programming language.
how to develop a virtual pdf printer driver. google only shows results for .NET languages but I need for C++ language only.
How to proceed to develop this driver.
View 2 Replies
View Related
Dec 21, 2014
I'm in the middle of creating a ePOS for my uncle and so far I've created a database for it where it will create, update and delete records successfully.
My next step I would like to do is to create a printer till thing, but how do I connect my database to that ?
I can create a till but how do I do link my database with it? I followed this example here [URL] ....
View 5 Replies
View Related
Sep 15, 2013
We have an assignment in which we have to implement a printer spooler using linked lists. I have used the list from STL to implement everything. I can get the program to send the print command and maintain status of documents. The problem is I don't know how to mimic/send a dummy print command so the document gets printed. If I use Sleep() there is a delay in the whole program.while I want printing on backhand and others users to have access to the program.
View 1 Replies
View Related
Jan 19, 2014
My professor assign me a task to create a manual printer settings, not necessary same as printer setting the important thing to do is to have a combobox. In the combobox that you will see the available installed printers, and one command for print that if going to select one available printer in the combobox. It is possible ?
View 1 Replies
View Related
Nov 10, 2013
C++ Code To Print String through Installed Printer. How to user Printer File Name?
View 9 Replies
View Related
Sep 7, 2012
I want to send control codes for Epson printer with c# application, I wrote some code, I have the connection with the printer, but when I am sending codes it not responding. On the other side, I found Java application for sending control codes, from that app some of the codes is working but not all of them. For example I want to use ESC EM 66 control code but when I am sending this code, printer not responding or just print the code in numbers.
The code who I use is:
class Program {
public const short FILE_ATTRIBUTE_NORMAL = 0x80;
public const short INVALID_HANDLE_VALUE = -1;
[Code]....
When I am using the method GetDocument() printer is not responding, but it prints only text when I call the buffer variable:
lpt.Write(buffer, 0, buffer.Length);
View 1 Replies
View Related
Oct 10, 2012
I am trying to print a barcode form HClabel printer through my application running on Windows server 2008. The printer is a ntwork printer connected to a Windows 7 Machine.
The code to access the printer and proceed with printing is in VC++. The code has been working fine since years and it still works when I try to print from Windows XP machine(Connect and print on the same printer connected to WIndows 7 machine mentioned above).
The error code I receive when tried to print from windows server 2008 is 2 which says File not found. But when i access the machine from windows server 2008, it is accessible.
Below is the code I use:
if( m_hPrinter != NULL )
EndWriter();
m_hPrinter = ::CreateFile(lpPrinterName,GENERIC_WRITE, FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL );
if( m_hPrinter == INVALID_HANDLE_VALUE )
[Code] .....
what might be causing this to fail-only on the new operating system I use(Windows server 2008)
View 4 Replies
View Related
Jul 10, 2013
I'm trying to print Chinese/unicode characters to a line printer(EPSON LQ-2090) using the writePrinter method in c++.
ANSI characters print fine, but when I throw the buffer of widechar Chinese characters at it, they come out like garbage/ANSI chars.
while debuging string shows chinese characters but in memory it shows ANSI characters not chinese and these ANSI characters are get printed on printer.
Note that if I change the DocInfo datatype parameter to "TEXT" instead of "RAW" then also the Chinese characters donot print.
Is there a way to get Chinese or unicode characters to print correctly?
View 6 Replies
View Related