Determining Display Metrics in an Excel MacroLast reviewed: November 2, 1994Article ID: Q51139 |
The information in this article applies to:
SUMMARYIMPORTANT: The CALL and REGISTER functions are provided for advanced users only. If you use these functions incorrectly you could accidentally cause errors in your system's operation. The following macro allows you to determine the metrics of your video display (that is, horizontal resolution, vertical resolution, number of colors) by using a macro. This information may be helpful in creating macros that create variable-sized custom dialog boxes based on display size or take into account the effect of display resolution on printed output.
A2 : =REGISTER("USER","GetActiveWindow","H") A3 : =REGISTER("GDI","GetDeviceCaps","HHH") A4 : =REGISTER("USER","GetDC","HH") A5 : =CALL(A2) hWnd A6 : =CALL(A4,A5) hDC A7 : =CALL(A3,A6,8) HORZRES A8 : =CALL(A3,A6,10) VERTRES A9 : =CALL(A3,A6,14) PLANES A10: =CALL(A3,A6,12) BITSPIXEL A11: =RETURN()This macro returns the horizontal display resolution in pixels in cell A7 (HORZRES), the vertical resolution in cell A8 (VERTRES), the number of planes in cell A9 (PLANES), and the bits per pixel in cell A10 (BITSPIXEL).
MORE INFORMATIONThe instructions in this macro do the following:
|
KBCategory: kbusage
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |