Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!hplabs!hp-pcd!hpmcaa!marco From: marco@hpmcaa.mcm.hp.com (Marco Dalla-Gasperina) Newsgroups: comp.windows.ms Subject: Re: Mapping modes Message-ID: <6970008@hpmcaa.mcm.hp.com> Date: 23 Jun 89 15:19:05 GMT References: <3196@watale.waterloo.edu> Organization: HP McMinville Division Lines: 30 >I'm using SetMapMode(hDC, MM_ANISOTROPIC) along with SetWindowExt() and >SetViewPortExt() to transform window coordinates into constant units >(I want 1000, 1000 to always be the bottom right corner). This works >fine if I do a SetMapMode() etc. every time I redraw a window. However, >if I only do it when the window is created (WM_CREATE message) it seems >that the window extent information disappears after I do something. I've >been narrowing it down, but I haven't quite found it: I have no other >calls to these functions; the only other thing I can think of is GetDC() >and ReleaseDC() doing something to this info. > >Thanks in advance! > \tom haapanen >"now, you didn't really expect tom@mims-iris.waterloo.edu > my views to have anything to do watmims research group > with my employer's, did you?" university of waterloo >---------- Every time you do a GetDC (or BeginPaint) windows provides you with a DEFAULT DC. This is done because there is only a total of 5 DCs for the entire system. (if you do 6 GetDCs without intervening ReleaseDCs your system will appear to hang!) That means that you have to reload a DC EVERY time you get it and that includes mapping modes, extents, pens, brushes etc. There is a way around this and that is to specify CS_CLASSDC or CS_OWNDC when you register the window class. These will specify that all windows of that class will share a DC or that every window of that class wll have it's own DC, respectively. (These DCs are not counted toward the 5 of the system). Each DC takes 800 bytes (I think) so use this feature sparingly. No Bugs, marco