Before version 2.0, DBCS OS/2 supported only the PS/55 adapters that provide higher resolution than VGA. From version 2.0, the DBCS OS/2 supports more display devices with various resolutions. Application programs need not to be aware of the different display devices, but must aware the different resolutions. The following table shows the pel size of different display device, the PS/55 DA/2, VGA, SVGA and XGA.
1040 x 768
The difference between the resolutions will affect your code relating with pels, such as window coordinates. Take a look at the following example. This is a main window appearing in the center of the screen of the VGA display:
WinSetWindowPos( hwndFrame, HWND_TOP, 220, 140, 200, 200, SWP_SIZE | SWP_MOVE | SWP_ACTIVATE | SWP_SHOW );
On PS/55 DA/2, however, it is not in the center any longer. If the initial position of a window is important, use a scale factor, which is varied according to the resolution of the current display, to give the window an appropriate position.
You can use the DevQueryCaps call to know the resolution of the current device. For example:
HDC hdc; ULONG devcaps[2]; hwndFrame = WinCreateStdWindow( HWND_DESKTOP, 0L, (PULONG)&flCreate, "MyWindow", "", 0L, NULL, ID_WINDOW, (PHWND)&hwndClient ); hdc = WinOpenWindowDC( hwndFrame); DevQueryCaps( hdc, CAPS_WIDTH, 2L, devcaps);
After returning from the DevQueryCaps call, the first and second elements of the array devcaps contain the horizontal resolution and the vertical resolution of the current display device respectively. Using these values, you can calculate proper coordinate values for the window position parameters of WinSetWindowPos call.
The above consideration is not DBCS unique. It is also applicable to the 8514/A,VGA and XGA version of your program. It is recommended to make a program device-independent; This will help you when new devices come out.