Re: SetMapMode



"Steve" <sredmyer@xxxxxxxxxx> wrote in message
news:1174605512.159786.7910@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

I need to find out the current mapping mode being
used by a window given only that windows hWnd.

As Michael C has already said, you can use the GetMapMode API. You can't use
it on the hWnd though, so you'll need to obtain the DC of the window and use
it on that:

z = GetMapMode(GetDC(Me.hwnd))

However, and this is a major point if you're using it on a VB window such as
a Form or PictureBox or any other VB window, which I think you may be doing,
you need to be aware that VB itself always uses a mapping mode of MM_TEXT
(device pixels), so you will get the same result (1) regardless of the VB
ScaleMode of the window, unless your code has temporarily altered the mode
of the window itself using the SetMapMode API (which is something you need
to take great care with if you don't want to badly upset VB and which I
think is unlikely in your case because if you had done so then you would
already know what the mapping mode was).

Mike



.



Relevant Pages

  • Re: SetMapMode
    ... even be assured that the passed in window will be a VB window ... current mapping mode of the DC in question. ... Just have your routine draw its stuff on the assumption that ... That's what most of the API functions do. ...
    (microsoft.public.vb.general.discussion)
  • Re: SetMapMode
    ... even be assured that the passed in window will be a VB window ... Then you'll just have to do what almost all API functions do and assume that the units which are being passed to them are in units appropriate to the current mapping mode of the DC in question. ... People who write code which passes coordinates to an API routine to perform some drawing function in a window DC should know what the current mapping mode of that DC is when they decide on the values of the coordinates they want to pass, otherwise they should not be writing code. ...
    (microsoft.public.vb.general.discussion)
  • Re: Cannot convert to mm units :(
    ... When i change Mapping mode in device content to MM_LOMETRIC printer doesn't print anything. ... corner of a window, the x axis points to the right and the y axis ... near the top left corner of the window or page and is drawn 200 units to the right and 200 units down. ... Move the origin of the DC's coordinate system to the bottom of the page. ...
    (microsoft.public.vc.mfc)
  • Re: Mem DC (Mike Once again)
    ... In fact I am not looking to compare with AutoCAD, but looking for some how to give good speed for my application. ... >> i make same Mapping mode for front and Back Dc. ... > mapping mode defined after you've finished with the DC then when VB comes to paint the window it has all kinds of problems (since it ... > custom mapping mode set until it actually needs to be changed. ...
    (microsoft.public.vb.winapi.graphics)
  • Re: ActiveX painting problems
    ... It's intended for use within PowerPoint. ... > DLL and assumes that the mapping mode will be MM_TEXT. ... > It works fine within PowerPoint during a presentation (when the control ... > a window and is in MM_TEXT mode). ...
    (microsoft.public.win32.programmer.ole)

Loading