The TRACE is just something to use in MFC apps. If you don't use MFC, just ignore it and use printf or something of the sort. I was just trying to demonstrate the value of zDelta and needed an output mechanism.
There are LOTS of utilities (executables) for mounting ISO files to drive letters, but I want to open and read the contents of an ISO file through some kind of library, not a separate EXE. Any way to do that? I don't mind mind mounting the ISO to a drive letter or directory, I just don't want to make the user do it manually.
It's not that critical, just a "nice to have" for my app. Besides, if it was that easy, it seems like there would already be a free code library available for this. Heck, my boss may even be willing to pay a reasonable price for one.
Hi, I added code for supporting multiple languages and are suprised about the following behaviour of Windows XP.
I have an English Windows version and selected English (United Kingdom) as my user interface language, I verified this in Control Panel -> Regional and Language Options. The function GetUserDefaultUILanguage from kernel32.dll returns 0x0409 (ENU, United States) and GetSystemDefaultLangID returns 0x0809 (ENG, United Kingdom)... shouldn't they both return the same?
GetSystemDefaultLangID() returns the system locale. This is used to determine which code page is used for non-Unicode (aka "ANSI") text on a system. It can be changed (on XP) from the advanced tab on the "regional and language options" in Control Panel (probably needs to be rebooted before the change takes effect)
returns the current UI language which can be set by a user if MUI pack is installed.
Thanks for the info. What I don't understand that if I detect the language according to MSDN[^] then I would detect the wrong language (in a case where both UK and US language resources are available for an application).
GetUserDefaultUILanguage() Win32 API: 0x0409 US English GetSystemDefaultUILanguage() Win32 API: 0x0409 US English GetSystemDefaultLangID() Win32 API: 0x0809 UK English
What would be the correct order in an application to check?
I am not sure what you are trying to check from your application. The link you left points to the article explaining how MFC is choosing a satelite dll.
Quote from MSDN: MFC attempts to load the resource DLL for each of the following languages in order, stopping when it finds one.
It starts with GetUserDefaultUILanguage(), which returns ENU (US English) on my computer which is wrong as I have ENG (UK English). If the application is delivered with both US and UK english satelite DLLs, the wrong English language would be auto detected.
It starts with GetUserDefaultUILanguage(), which returns ENU (US English) on my computer which is wrong as I have ENG (UK English).
Based on what you described it is not wrong. The value returned by GetUserDefaultUILanguage() can be set by the user on XP Pro with MUI pack installed with the "Language used in manus and dialogs" option only.
What exactly did you do to set the language to UK English in Control Panel? My guess is that you changed either user locale (dates, currency, etc), input locale (kayboard) or both, but it does not affect the default UI language.
The value GetUserDefaultUILanguage() returns tells about the language of the menues, etc in Windows. As I said, you can't change it with Windows XP unless you have MUI pack installed.
Well, thanks for taking the time to explain! To answer your question, in the control panel -> Regional and Language Options -> tabs (Regional/Languages/Advanced) the language is set to "English (United Kingdom)", I didn't change it after Windows installation. I don't have a MUI pack installed as far as I know.
I think something is wrong... because with my settings I would expect "English (United Kingdom)" to be detected... but I am not sure what it is (my code or the explanation in the MSDN article).
You're welcome. I know international programming can be frustrating - after all I worked in language/localization industry 7 years before I finally had enough
in the control panel -> Regional and Language Options -> tabs (Regional/Languages/Advanced) the language is set to "English (United Kingdom)",
OK. If you read carefuly the explanation on that tab, you'll see that it sets the "Language for non-Unicode programs", or "system locale". What it does is determine which code page is used for multibyte ("ANSI") characters. For instance, when you use MultiByteToWideChar function, and set the CodePage parameter to CP_ACP, it will be this setting that decides from which multibyte encoding we are converting to Unicode. Mind you, all Windows API functions internaly do that if the application does not compile as UNICODE. This value gets returned by GetSystemDefaultLangID as you already noticed.
However, GetUserDefaultUILanguage does not look into this setting at all! It returns the language in which the UI controls of your OS are rendered (and MFC correctly looks at that one first - after all you would want your application to e displayed in the same language as the OS). This setting you can change on Windows XP Pro only if you have MUI pack installed, and in that case you'll have a combo box "Language used in menues and dialogs" displayed in the "Language" tab in the Control Panel "Regional and Language Options". Otherwise, it is just predetermined by the version of Windows you installed (En-UK, or En-US) and you can't change it.
It was a joke referring to the bottom of the link I posted.
Who is Dr. International?
Dr. International's identity is one of the most closely guarded secrets of Microsoft. Since (1) he has the support and help of the entire Windows International Division, (2) he is very knowledgeable about i18N issues, and (3) he gets to choose what questions/answers are posted, he can maintain the illusion of knowing everything.
I had wanted to customize the tree control by adding a header. I wanted to do the same thing the list view control does and simply add the header as a child of the tree wnd at the top of it's client rect. I got this to work OK, but when it paints it of course covers the first item of the tree ctrl. No problem I thought, I'll just override the WM_PAINT and use SetViewportOrgEx and shift the HDC's y origin up by the height of the header. That seemed to work OK. But when I clicked on an item, things would not get drawn correctly. It's as if it got shifted down too much or copied from the wrong point. If a full repaint occured then things looked OK, but if a the paint rect for the WM_PAINT was a partial, then there seemed to be nothing I could do to get it to paint correctly.
I overrode the CUSTOM_DRAW callback and verified that the correct items were getting processed. They just don't seem to show up where you would expect them. What am I missing?
Here's the default tree with one item and one child item underneath it: pic1.PNG[^]
Now if you click on the + to open it up: pic2.PNG[^] - obviously that's not right! the partial update doesn't seem to get handled correctly.
After some experimenting, the problem seems to revolve around the use of the SetViewportOrgEx call. If that is not called, the first item will not show, but the updates will be processed correctly (for example, if you add more items to the tree and try opening/closing them). But if you then adjust the origin with SetViewportOrgEx then the painting gets screwed up.
Note: I have NOT solved this problem - at the moment I'm completely stumped as to why it doesn't work right and what I can do to fix it.
¡El diablo está en mis pantalones! ¡Mire, mire!
Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)!
Glad to hear you solved the problem. I'll have to keep this approach in mind in the future.
An alternative that I use myself, is to just handle the WM_NCCALCSIZE & WM_NCPAINT messages. For example
LRESULT CLeftView::OnNcCalcSize(WPARAM wParam, LPARAM lParam)
RECT *prect = (RECT *)lParam;
// let the old wndproc allocate space for the borders,// or any other non-client space.
WndProcDefault(GetHwnd(), WM_NCCALCSIZE, wParam, lParam);
// calculate what the size of each window border is,// we need to know the location of the non-client area.
m_ncRect.left = prect->left;
m_ncRect.right = prect->right;
m_ncRect.top = prect->top;
m_ncRect.bottom = prect->top + 22;
// now we can allocate additional space
prect->top += 24;
// take scrollbar into account
sbi.cbSize = sizeof(sbi);
if (::GetScrollBarInfo(GetHwnd(), OBJID_VSCROLL, &sbi))
if (!(sbi.rgstate & STATE_SYSTEM_INVISIBLE))
m_ncRect.right += ::GetSystemMetrics(SM_CXVSCROLL);
// that's it! Easy or what!return0L;
LRESULT CLeftView::OnNcPaint(WPARAM wParam, LPARAM lParam)
// let the old window procedure draw the borders / other non-client// bits-and-pieces for us.
WndProcDefault(GetHwnd(), WM_NCPAINT, wParam, lParam);
// get device context
HDC hDC = ::GetWindowDC(GetHwnd());
// make sure there is some distance (2 pixels) between the non-client and client area
rc.left = m_ncRect.left;
rc.right = m_ncRect.right;
rc.top = m_ncRect.bottom;
rc.bottom = m_ncRect.bottom + 2;
HBRUSH hBrush = ::CreateSolidBrush(RGB(248, 249, 252));
::FillRect(hDC, &rc, hBrush);
// draw the title bar...if (isThemed != 0)
drawVistaTitleBar(hDC, "Item Library");
// release device context
// that's it!return0L;