GetDeviceCaps inconsistancy

'ello

I am using Windows XP and Visual Studio 2003.

When I call GetDeviceCaps(HORZSIZE)  or GetDeviceCaps(VERTSIZE) it always
seems to return the value of the default printer, not the printer selected
in the Print Dialog.

Thus when I print to a printer that is not the default printer, my Page Rect
that I calculate is incorrect.

Below is the code that this occurs in... Am I doing something wrong?

Thanx
Hein

--------
CRect CPrinting2View::getPrintRect(CDC* pDC, int margin)

{

CSize PrintOffset, Physical, Printable;

Physical.cx = pDC->GetDeviceCaps(PHYSICALWIDTH);

Physical.cy = pDC->GetDeviceCaps(PHYSICALHEIGHT);

pDC->DPtoLP(&Physical);

PrintOffset.cx = pDC->GetDeviceCaps(PHYSICALOFFSETX);

PrintOffset.cy = pDC->GetDeviceCaps(PHYSICALOFFSETY);

pDC->DPtoLP(&PrintOffset);

Printable.cx = (int)((float)pDC->GetDeviceCaps(HORZSIZE)*56.69);

Printable.cy = (int)((float)pDC->GetDeviceCaps(VERTSIZE)*56.69);

int Dx1, Dx2, Dy1, Dy2;

Dx1 = PrintOffset.cx;

Dy1 = PrintOffset.cy;

Dy2 = Physical.cy-Printable.cy-Dy1;

Dx2 = Physical.cx-Printable.cx-Dx1;

CRect PageArea;

PageArea.left = (long)(margin-Dx1);

PageArea.right = (long)(Printable.cx-margin+Dx2);

PageArea.top = (int)(margin-Dy1);

PageArea.bottom = (int)(Printable.cy-margin+Dy2);

pDC->LPtoDP(&PageArea);


return PageArea;

}


0
heina (6)
2/27/2004 10:07:42 AM
vc.mfc 33608 articles. 0 followers. Follow

1 Replies
1442 Views

Similar Articles

[PageSpeed] 20

'ello, 'ello, Hein,

GetDeviceCaps should of course not return the resolution of the default
printer. Are you sure you are sending in the correct CDC? Could you show
some code actually calling the function?

Johan Rosengren
Abstrakt Mekanik AB

"Hein Albrecht" <heina@magnumsimplex.com> a �crit dans le message de
news:Of$PqiR$DHA.2040@TK2MSFTNGP12.phx.gbl...
> 'ello
>
> I am using Windows XP and Visual Studio 2003.
>
> When I call GetDeviceCaps(HORZSIZE)  or GetDeviceCaps(VERTSIZE) it always
> seems to return the value of the default printer, not the printer selected
> in the Print Dialog.
>
> Thus when I print to a printer that is not the default printer, my Page
Rect
> that I calculate is incorrect.
>
> Below is the code that this occurs in... Am I doing something wrong?
>
> Thanx
> Hein
>
> --------
> CRect CPrinting2View::getPrintRect(CDC* pDC, int margin)
>
> {
>
> CSize PrintOffset, Physical, Printable;
>
> Physical.cx = pDC->GetDeviceCaps(PHYSICALWIDTH);
>
> Physical.cy = pDC->GetDeviceCaps(PHYSICALHEIGHT);
>
> pDC->DPtoLP(&Physical);
>
> PrintOffset.cx = pDC->GetDeviceCaps(PHYSICALOFFSETX);
>
> PrintOffset.cy = pDC->GetDeviceCaps(PHYSICALOFFSETY);
>
> pDC->DPtoLP(&PrintOffset);
>
> Printable.cx = (int)((float)pDC->GetDeviceCaps(HORZSIZE)*56.69);
>
> Printable.cy = (int)((float)pDC->GetDeviceCaps(VERTSIZE)*56.69);
>
> int Dx1, Dx2, Dy1, Dy2;
>
> Dx1 = PrintOffset.cx;
>
> Dy1 = PrintOffset.cy;
>
> Dy2 = Physical.cy-Printable.cy-Dy1;
>
> Dx2 = Physical.cx-Printable.cx-Dx1;
>
> CRect PageArea;
>
> PageArea.left = (long)(margin-Dx1);
>
> PageArea.right = (long)(Printable.cx-margin+Dx2);
>
> PageArea.top = (int)(margin-Dy1);
>
> PageArea.bottom = (int)(Printable.cy-margin+Dy2);
>
> pDC->LPtoDP(&PageArea);
>
>
> return PageArea;
>
> }
>
>


0
2/26/2004 2:41:31 PM
Reply:

Similar Artilces:

table hierarchy inconsistency
I have installed some new reports into my GP implementation and I get the following message when I try to run one of them (after the destination selection form). Table Hierarchy Inconsistency I do NOT get this in development - only after I install the chunk file into my test environment. Any idea where to look for this inconsistency? Don DeVeux This is usually caused by you adding a new relationship to an existing Great Plains table. Because the table is an original table (ID < 22000), it is not extracted into your chunk and neither is the new relationship. So when your report ...

ISBLANK inconsistent with results
I'm using ISBLANK to blank the cell if the cell referred to is empty, for example: =IF(ISBLANK('Input Items'!BR132),"",'Input Items'!BR132) However, I'm getting inconsistent results when the cell referred to also contains a formula. Let's say that CG131 contains a formula, and the formula refers yet another cell (for example =A43)which is empty (A43 is empty that is). I have one worksheet with the above ISBLANK formula where the result is apparently False because the cell stays empty, but I have another worksheet (in the same spreadsheet) which ...

Inconsistent Transfers
I notice a very strange trend in my Money 2004 program. I have several account transfers setup automatically in my "Bills and Deposits" section. They are set up as transfers but when they actually get placed into my checking account register, they are entered in 1 of 3 ways. 1. As a transfer (what I expect). 2. As a withdrawl with the category/sub category showing a transfer to the account. 3. A deposit with a negative ($) dollar amount. I'm not doing anything differently. The program just seems to randomly choose methods to enter the same transaction each mon...

Inconsistent run-time error
Why does the following block of code work when using a macro button on a custom toolbar but not work when using a control button on a worksheet??? I get a run-time error code 1004, Method 'range of object_Worksheet' failed pointing to the Sort block of code. Private Sub NewScenario_Click() 'sort the "Worksheet_Name" range by Ascending order of Scenario Application.Worksheets("Lookup_Ranges").Activate Application.Worksheets("Lookup_Ranges").Range ("Worksheet_Name").Activate 'sort Worksheet names by column 2 of "Worksheet_Name&...

Created searches inconsistent
Hmm still happening, anybody seen this before? Not a pc problem as we've tried on a desktop and a laptop. Tried recreating profile and still the same. Thanks Paul "Paul" <chewbacca@wookie.org> wrote in message news:%234IcFUJ%23IHA.4772@TK2MSFTNGP06.phx.gbl... > He's searching on subject / name / address. > > It's skipping items both on his exchange mailbox and his pst file. > > Thanks > > "Diane Poremsky [MVP]" <outlookmvp@msn.com> wrote in message > news:uDDCXoI%23IHA.4196@TK2MSFTNGP02.phx.gbl... >> Is he searching ...

Why inconsistent results from "SUMIF"?
I'm using sumif to do a simple total from a "wholesale" column based on matching a name in the "Vendor" column. I was using labels but have noticed inconsistent results. Just for kicks I setup four of the same formulas with the exception of the use of labels. They were as such: =SUMIF(Vendor,"Color Spot",Wholesale) =SUMIF(Vendor,"Color Spot",F:F) =SUMIF(J:J,"Color Spot",Wholesale) =SUMIF(J:J,"Color Spot",F:F) The only one I get the correct answer ($5.19) from is the last example where I use strictly column references. The mid...

Inconsistent macro problem in excel
XP was rolled out at my work yesterday. Most of the excel file I work with have Visual Basic macros coded into them. (I use Excel 2002) Sometimes, I'll open a file, and it will give me the "Enable Macros?" prompt. This is normal, and what I want it to do. Sometimes, I'll open the same file, and it will give me no prompt. And if I try to run one of the macros, it tells me that the macros are disabled because the security is set to high. So, I go the macro security area to check it out...it's on medium, like it always is. I've found that the only consistent way ...

Dates display inconsistent in MS Excel 2007
I have two files with the same date ranges (Jun-01 thru Jun-09), but in the chart one file shows Jan not Jun. The only difference is the format, in the first file the first date is shown as a number format with value of , whereas in the second file it is shown as a date mmm-yy. Can someone explain why this is happening? I can send the files if you want to see exactly how the dates are entered. Please assist. Thanks! ...

IRP
We are setting up Item Resource Planning and all this is new to me. I've been studying the formula's to calculate safety stock and order point quantity and thought I had all the information ready to enter in Great Plains. I was reading in Help about the IRP Maintenance window fields to make sure I was entering the data in the correct fields and found this definition of safety stock and order point quantity. Can you tell which one is correct? Safety Stock Enter the quantity of the item to have on hand for this item-site combination. The safety stock amount should not be grea...

Mailbox size inconsistent
Hi to all of you, I'm having the following problem , in our organization we fixed the maximum Exchange 2003 mailbox size to 70 Mb. One of our user is complaining that she is getting the mailbox oversize message, I checked with her inside the outlook folder properties and I noticed that the mailbox size is only 30Mb. There is an inconsistency between the mailbox size that is reported on the Exchange server and the size reported in Outlook 2003. Could you please tell me how I can manage this situation? Thanks Carlo do you have any ideas? "IPGRI" <ipgri@news.postalias...

Exchang 2003 NTBackup inconsistency
Began noticing this after my NTBackup completed on the SAN drive that contains the Exchange databases. Anyone have ideas to what can cause this or what corrective actions needs to be taken? Error: An inconsistency was encountered in the requested backup file. On Wed, 21 Dec 2005 05:13:02 -0800, "Jeff_BlueCross" <jeff@exchangegypsy.org> wrote: >Began noticing this after my NTBackup completed on the SAN drive that >contains the Exchange databases. Anyone have ideas to what can cause this or >what corrective actions needs to be taken? > >Error: An inconsist...

Excel inconsistency
After a bunch of fiddling, i got a macro to duplicate a chart below a single one on a worksheet. But there was a runtime error as noted near the end of the macro. So i did a lot of more fiddling and was able to get a number of copies, one after the other by calling them all "Chart 1". Nasty. Did other fiddling in attempts to change series ranges and title on the fly. Things got worse, so i tried to go back to the original macro as seen below. Even deleting the XLSTART folder and re-trying the macro did no good. **HELP** Sub Macro2() ' Macro2 Macro ' ...

Inconsistent Free/Busy information
When booking appointments I am seeing the following problem: When I view someone's free/busy information the graph that represents the meetings does not reflect what is in the calendar. But when I mouse over the graph (for example a blue line representing a meeting from 10am - 11am) I do see the correct time in the mouse over pop up window. So a meeting from 10am - 11am represented by a graph line from 10am -10:30am when mouse'd over would correctly show the meeting as being from 10am - 11am. This is causing a small amount of havoc for my user community because when they s...

OWA Access Inconsistent Depending on ISP?
Traveling from hotel to hotel I find that sometimes I can gain access to OWA and sometimes I can not. What is preventing such access? Why would one hotel wireless or hardwired system pass me through to my OWA and another not allow me to gain access. For example, I tried to gain OWA access through Cingular's HotSpot WiFi in Philadelphia airport last week and I got a dead page. An hour earlier, I had no problem from the hotel. Are some ISP's preventing this? ...

Inconsistent CFileDialog behavior between Windows XP and 2000
Hello, I have extended the CFileDialog class so I can select Folders instead of just Files. When I send the CDM_GETSPEC message to get the currently selected item, I get the correct folder when I test with Windows XP. However, when I run my app on Wndows 2000, DM_GETSPEC returns an empty string (""). Also, sending of the CDM_GETFILEPATH message works as desired for XP, but only returns the parent folder in 2000. Any help would be much appreciated. -Neil ...

Outllok 2002 Message rules work inconsistently
I have set up three message rules telling Outlook to move mail to specific folders based on either subject or recipient. I know that I have worded these rules properly, because they sometimes get "obeyed," but other times everything ends up in my inbox. This can happen even in the same batch of incoming mail--some of it ends up moved, and some stays in the inbox. I have looked at the subject header over and over again-- there are no obvious differences. Any ideas why, or better yet, what to do about it? I have Outlook 2002 and Windows XP Pro. Thanks. Perhaps more than on...

Graphing inconsistent dates and data
I would like to graph some data - body weight for example. I would set up the date on the X-axis and the weight on the Y-axis. When inputting the data, I would LIST every day sequentially and then record the weight next to the date. If I were to consistently record a weight reading every day, I would have a nice smooth graph. However, if I were to record a weight for 2 or 3 days and then skip a day or 2, I would have blanks (0's) by the skipped days. When I graph that data range, the graph goes haywire because it drops all of the way down to 0 on the skipped days. I could easi...

Front End OWA Exchange 2003 Inconsistent owauth.dll issue?
Hello, We have a FE/BE setup with Exchange EE 2K3 SP1 on both machines (Opsys is Win2K3 EE). The FE has SP1 for Windows 2003 server, the backend is just Win2K3 server. We have OWA working fairly well using forms authentication, however periodically, about once every 6-10 logins, the login page will just sit after clicking login. It will timeout in about 5 minutes. However, if during that pausing period, the user hits F5 or refreshes the page, they instantly go to their inbox! We are presently using Vasco tokens to authenticate, but the issue happens even when Vasco is turned off, usi...

Inconsistent conditional formatting
Hi all Office XP service pack 2 (pack 3 not yet installed) I have a workbook that contains cells that are subject to conditional formatting. By way of example, Condition 1 of cell Q9 is set to =AND($D9>0,ISNA(MATCH($Q9,L_Charity,0))) If I select cell Q9 and then from the menu bar select Format/Conditional Formatting, then Condition 1 changes to: =AND(#REF!>0,ISNA(MATCH(#REF!,LCharity,0))) If I click on "OK", and then repeat the process, then it reverts back to =AND($D9>0,ISNA(MATCH($Q9,L_Charity,0))) It seems to alternate. When this sort of thing happens generally, my ...

Inconsistent Meeting Request handling
Version: 2008 Operating System: Mac OS X 10.6 (Snow Leopard) Processor: Intel Email Client: Exchange Entourage meeting requests do not consistently provide attendee lists, meeting detail content, and/or ability to accept/decline. <br><br>As they arrive in my Inbox, <br> &nbsp;-- some requests display a yellow heading box with hypertext blue text that lets me accept or decline or tentative. <br> -- some requests do not have this heading box, but I can right-click on the inbox item and see &quot;accept/decline/tentative&quot; context menu choices <...

"Inconsistent" Authentication
Win 2000 AD, Exchange 2000, Outlook XP, WinXP, remote access integrated with AD When I RAS in on my work laptop (I don't have LAN access to the network at present) I changed my password on the Directory and now I am presented with the Exchange "Enter Password" dialog - I enter password and get the Exchange Error "Your logon information was incorrect bla bla bla". The laptop was joined with a computer account to the domain and is now in it's own workgroup - fault remains in both configs. However on my home desktop (never been directly connected to the LAN) I RAS in...

CPropertyPage Background Color Inconsistency
I have 3 CPropertyPage inside a CPropertySheet, they look fine without XP visual styles. I added the XP manifest the other day and noticed that one of the page is having different background color than the other 2 when run in XP. That particular page appears to have COLOR_3DFACE kind of background color which is different than the others. An example of this can be found in XP by right clicking a file and chose properties, you can see the background color of the Summary tab is different than the rest. Any idea why is this so? How can I force the same background color for all CPropertyPage? T...

Can teams own records ? Inconsistency between several documents (CRM installation & Customisation exam)
Hi, I have tumbled on a inconsistency between the CRM application UI, the book "Using Microsoft CRM" and Microsoft documents. I wouldn't make a big fuzz about it, if it wasn't that this is a question in 1 of the CRM exam's. Simple Question: Can records be owned by teams ? This is asked several times in the CRM exam (it is sometimes a part of a question). However: - "Special Edition - Using Microsoft CRM" says: "Teams cannot be owners of records..." on page 81. - The user interface of MSCRM doesn't allow a Team to be the owner of a record (ex...

Inconsistency in Calendar
Hi, I got this message in my E2K server event viewer. What did the user do wrongly that cause the 'inconsistency' ? Should I advise the user to delete the entery in his calendar and re-create or can we safely ignore this message ? Thanks An inconsistency was detected in Steven Lim: /Calendar. The calendar is being repaired. If other errors occur with this calendar, please view the calendar using Microsoft Outlook Web Access. If a problem persists, please recreate the calendar or the containing mailbox. For more information, click http://www.microsoft.com/contentredirect.asp. Fo...

Inconsistent SQL Results
I use an INSERT statement in my code and it works successfully the vast majority of the time. However, some of the time it generates the error "Conversion failed when converting the varchar value '11/23/2009' to data type int". The statement that generated the error listed above is: INSERT EntityData (Entity_id, Group_id, Attr_id, Data) VALUES (6420348, 0, 39, '11/23/2009') The table definition is as follows: SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_PADDING ON GO CREATE TABLE [dbo].[EntityData]( [id] [int] IDENTITY(1,1) NOT ...