Hello, everyone.
I ran into another problem a few days ago that I can't figure out. I am working with two mobile devices: TouchPro2, with Windows Mobile 6.1 Professional, and TouchPro2 with Windows Mobile 6.5 Professional. So, the hardware is the same, only the version of Window Mobile is different, and even then it's just a different build of the same version.
The problem is that the Date-Time Picker is not working correctly in the WM 6.5 device, though it is working perfectly in the WM 6.1 device. In the WM 6.5 device, the calendar is ENORMOUS, such that only a couple days are visible on the screen, and so is really unusable.
What would cause this difference?
The application I am working on is written in MFC, Embedded C++, and I am having a hard time finding resources out there for this. But, here are some things I've considered ...
Here is the code that creates the Date-Time Picker:
InitCommonControl(ICC_DATE_CLASSES);
hwnd = CreateWindow(
DATETIMEPICK_CLASS,
TEXT(""),
WS_CHILD | WS_VISIBLE | DTS_SHOWNONE | DTS_RIGHTALIGN,
0, 0, 0, 0,
m_hwndDlg, (HMENU)(IDC_ANSWER),
m_hInstance,
NULL);
At first, I tried setting the height and width of the calendar, like below, but that didn't seem to do anything at all.
InitCommonControl(ICC_DATE_CLASSES);
hwnd = CreateWindow(
DATETIMEPICK_CLASS,
TEXT(""),
WS_CHILD | WS_VISIBLE | DTS_SHOWNONE | DTS_RIGHTALIGN,
0, 0, 15, 15,
m_hwndDlg, (HMENU)(IDC_ANSWER),
m_hInstance,
NULL);
Next, I thought this might be because of a font setting being too large, so I've tried to mess with the font, but I'm not really sure what I'm doing. I've tried to mess with the font in a few ways, namely:
1) Sending a message with the DTM_SETMCFONT thingy ...
SendMessage(hwnd,DTM_SETMCFONT,(WPARAM)hFontAnswer /*Font*/,(LPARAM)1 /*Redraw*/);
2) Using a "macro," whatever that is, to accomplish the same thing as #1, above ...
DateTime_GetMonthCalFont(hwnd)
3) Some system function I found call "SetWindowFont()" ...
SetWindowFont(hwnd, hFontAnswer, FALSE);
In all of these, the HFONT object, ""hFontAnswer," evaluates to a font with the size of the integer 2, or it defaults to the "SYSTEM_FONT," if it has a problem. The system font is retrieve via this code ...
if (hFontAnswer == NULL)
{
hFontAnswer = (HFONT)GetStockObject(SYSTEM_FONT);
}
I also tried setting the system font on the device to the absolute minimum that I could. Anyway, none of that helped me reduce the size of the calendar either.
So, now I am officially out of ideas, and I am coming to you for help. I hope someone here can point me in the direction for something else to try next.