Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!apple!vsi1!hsv3!jls From: jls@hsv3.UUCP (James Seidman) Newsgroups: comp.windows.ms.programmer Subject: Re: Creating windows with a specified client size Message-ID: <5697@hsv3.UUCP> Date: 9 Nov 90 16:55:58 GMT References: <18647@haddock.ima.isc.com> <1990Nov8.180215.10952@rti.rti.org> Reply-To: jls@hsv3.UUCP (James Seidman) Organization: Video Seven / Headland Technology Lines: 24 In article <1990Nov8.180215.10952@rti.rti.org> bcw@rti.rti.org (Bruce Wright) writes: >You do run into a minor problem when you are trying to create a >window with a specific size in (say) inches rather than pixels: >the LPtoDP function requires a Device Context (which you can't get >until you create the window). In that case you either have to >make the computation manually from information returned by >GetSystemMetrics and GetDeviceCaps, or use SetWindowPos after the >window has been created (presumably without being displayed) and >you have called LPtoDP, or play games such as getting the desktop >window with GetDesktopWindow and using it for a Device Context. I don't have the SDK reference in front of me, so I might be wrong here, but I think that you can call LPtoDP with an *Information Context* as opposed to a Device Context. ICs are designed to be used in just these sorts of cases where you run into a Catch-22 on needing information on a DC before you create it. More information should be under the command "CreateIC()" in the reference manual. I believe Petzold also gives examples of using ICs for such things. -- Jim Seidman (Drax), the accidental engineer. "It doesn't have to work... they'll be paralyzed just from laughing at me." - Dr. Who, _Shada_ UUCP: ames!vsi1!hsv3!jls INTERNET: hsv3.UUCP!jls@apple.com