Standard MFC controls behave different when showing polish characters

Hello all,

I have a rather simple to describe but difficult to solve problem.
Our customers want to use our ANSI MFC program to show different
languages.
For example Polish.
When I set the font for the different controls they behave different.

For example the CEdit shows the polish characters just right but the
CButton with checkbox style shows glyphs instead of the special
characters.
Every control that is owner draw and uses for example the DrawText()
function of the device context shows the characters right.

I've experimented with _UNICODE for the display part and everything I
could think of but cannot find a solution.
Where is the difference, or what can I do (beside making all controls
owner draw) to get all controls display the same text?

What is the difference between standard control drawing or
CDC:DrawText(..)?

It is no option to rewrite all the text manipulating functions to use
the UNICODE counterparts. Because the program is half C and half C++.
It would take several weeks to work over all the source code to rewrite
everything to UNICODE and not to speak of testing everything all over
again.

Any ideas?

Thanks,
whiteman

0
schnee (2)
10/26/2006 1:58:42 PM
vc.mfc 33608 articles. 0 followers. Follow

3 Replies
547 Views

Similar Articles

[PageSpeed] 27

>When I set the font for the different controls they behave different.

How are you setting the font for the controls?

>For example the CEdit shows the polish characters just right but the
>CButton with checkbox style shows glyphs instead of the special
>characters.

What's different about how you set the font's for those controls?

>Every control that is owner draw and uses for example the DrawText()
>function of the device context shows the characters right.
>
>I've experimented with _UNICODE for the display part and everything I
>could think of but cannot find a solution.

Have you got both _UNICODE and UNICODE defined?

Which OS are you testing on?

>It is no option to rewrite all the text manipulating functions to use
>the UNICODE counterparts.

OK, so you're stuck with a non-Unicode application. Presumably your OS
is set up to support Polish correctly? Do other applications display
those characters correctly or not?

Dave
0
davidl7375 (2060)
10/26/2006 5:53:05 PM
If the string is Unicode you may want to try using SetWindowTextW() to set 
the button's text.  If the text is ANSI SetWindowText() will work OK.  You 
may not be able to use the typical DDX stuff to put a Unicode string on an 
MBCS button since it wouldn't translate it correctly.

Tom

<schnee@pks.de> wrote in message 
news:1161871122.416576.297190@m73g2000cwd.googlegroups.com...
> Hello all,
>
> I have a rather simple to describe but difficult to solve problem.
> Our customers want to use our ANSI MFC program to show different
> languages.
> For example Polish.
> When I set the font for the different controls they behave different.
>
> For example the CEdit shows the polish characters just right but the
> CButton with checkbox style shows glyphs instead of the special
> characters.
> Every control that is owner draw and uses for example the DrawText()
> function of the device context shows the characters right.
>
> I've experimented with _UNICODE for the display part and everything I
> could think of but cannot find a solution.
> Where is the difference, or what can I do (beside making all controls
> owner draw) to get all controls display the same text?
>
> What is the difference between standard control drawing or
> CDC:DrawText(..)?
>
> It is no option to rewrite all the text manipulating functions to use
> the UNICODE counterparts. Because the program is half C and half C++.
> It would take several weeks to work over all the source code to rewrite
> everything to UNICODE and not to speak of testing everything all over
> again.
>
> Any ideas?
>
> Thanks,
> whiteman
> 


0
tserface (3861)
10/26/2006 9:25:28 PM
Tom Serface wrote:
> If the string is Unicode you may want to try using SetWindowTextW() to set
> the button's text.  If the text is ANSI SetWindowText() will work OK.  You
> may not be able to use the typical DDX stuff to put a Unicode string on an
> MBCS button since it wouldn't translate it correctly.
>
> Tom
>

I'm setting the font like this:

	aButton.SetFont( kCfgAttr.GetFont() );

And setting the text with:

	aButton.SetWindowText(_T(aString));

The text I set is always ANSI because the underlying socket layer is
completely written using ANSI functions.

What puzzles me is why does this

    pDC.DrawText(strText, LeftAlignRect,
DT_SINGLELINE|DT_LEFT|DT_VCENTER);

work and the normal CEdit also but most other controls do show glyphs?
Where is the conversion taking place?

I already tried converting the Text to UNICODE with
MultiByteToWideChar() but that didn't help me either.

I'm glad about any hint or idea you could give me.

Thanks,
whiteman

0
schnee (2)
10/27/2006 7:29:39 AM
Reply:

Similar Artilces:

Logo showing white background
I have created a logo but when I save it and paste it in a different publication, the white edges show up over the background of the new publication. How can I save the original logo so the white background does not appear over new/different publications? What format is the logo? If it is a vector, you can ungroup and delete the background. If it is a bitmap use the transparency tool on the drawing toolbar, click the white background. -- Mary Sauer MSFT MVP http://office.microsoft.com/ http://msauer.mvps.org/ news://msnews.microsoft.com "pappabake" <pappabake@discussions...

IE8 Instant search box
Hi All I finally succumbed to the temptation to download IE8. I have spent the last 3/4 of an hour trying to regain control of my browser :-) I have switched off all accelerators and all that other stuff - even figured out how to stop the browser popping up the accelerator icon EVEN though I'd switched them off . . . I am happy to use the instant search box. (It's in a convenient place...). I DO NOT WANT any kind of suggestion from IE8 about what I'm looking for. I KNOW what I'm looking for - and the computer hasn't got a clue . . . So managed to sw...

How to determine difference?
If I have a cell that is 100 and another cell in which I want to demonstrate the difference - how do I set this up? The problem is that at the moment if I use a simple a1-b1 I get a negative number if b is larger. What I want is it to indicate the change as a +/-. So if A is 100 and B is 105, I would like to cell to indicate 5. If B is 95 - then -5 - does this make sense? Any help is MUCH appreciated. one way: =B1-A1 In article <10v0ggoi91s4c57@corp.supernews.com>, "Fionavar" <fionavarXXX@perlucidus.XXX.net> wrote: > If I have a cell that is 100 and an...

Using OLE DB in MFC Project
Hi, I have developed an MFC application. I now want to add database functionality to it. I have had a look at the various database technologies and have decided to try using direct OLE DB rather than ADO as it is faster. However I have noticed that in tutorials it is recommended to use the wizards in an ATL project. As i have said before my application has been written in MFC. I was wondering how easy it is to add direct OLE DB to my MFC application. I would appreciate suggesstions on how i can manage this, Thanks In Advance Macca ...

disable reports daterange dialog to show up twice
Hi, I created a report with daterange parameters. Everythings works fine but when I want to print some report, the report asks the user again for the date parameters. Having installed the CRM update CRM1.2-KB834913-Server.exe which should repair this bug, I noticed no change. The reports always asks twice for the parameters. Is there any secret for this mystery... Greetings Thomas Ott are all these parameters in a single report or are you using sub reports as well? -- John O'Donnell Microsoft CRM MVP http://www.microsoft.com/BusinessSolutions/Community/CRMFaqLanding.aspx "Th...

Want Input boxes to accept unicode strings on Standard Windows XP
I have a MFC application that is currently built with MBCS mode. If I run the program on a Chinese OS (Windows XP), the input boxes (Edit Controls) can accept Chinese chars and display correctly. If I run it on a standard English XP, the input boxes won't accept Chinese chars (display as "????") -- please note that I have already installed CKJ on the system and IE and Outlook can display Chinese correctly. Is this just because of different MFC libraries used for the application? Can I force the application running on Standard XP to use the unicode libraries so ...

Formatting
I received a pub doc from a third party. It was formatted as a 11x16 size. Once I decreased it to 8.5x11 and view the doc under 'print preview' the entirety of the image did not view. Basically, the image didn't shrink with the size. Any input? Patty wrote: > I received a pub doc from a third party. It was formatted as a 11x16 size. > Once I decreased it to 8.5x11 and view the doc under 'print preview' the > entirety of the image did not view. Basically, the image didn't shrink with > the size. Any input? Publisher doesn't resize the contents o...

How to display mfc control in new look style?
Hi, anybody knows how to show mfc controls like button or other controls in new look style? Please see below link to know about what i mean by new look style is. http://www.geocities.com/henky_arektc97/question/ I want to make my controls in dialog shown as Picture 2, not as Picture 1 (look at the button). Are there lack of some defines or codes or something else, because when I create new project again, the dialog will be displayed as I want in Picture 2. I use MFC 9 (vs2008). Thank you for any help! "Saitama" <Saitama@discussions.microsoft.com> wrote in message ne...

Tabbing into continuous subform ignores the first control
When I tab into the subform, from the last position in the main form, the focus moves to the second control in the continuous subform except on the first record entered in a session. I shift+tab back to the first control and the tabbing is normal from then on until the next record gets to the subform. The order of the controls on the subform is the same as the fields in the underlying table and the effect is the same in Datasheet view (of the subform). This first control on the subform is a combo box if that effects anything. Is there a way to get the tabbing right? ern. No, I thought the...

List of Differences Between Outlook 2000 and Outlook 2003
I need to spend 45 minutes introducing Outlook 2003 to my Outlook 2000 users. Can anyone provide a site with a succinct list (screenshots would help) of differences between Outlook 2000 and Outlook 2003? Many thanks. Tom Are you looking for screenshots of Outlook 2003 or ones comparing OL2000 and 2003? Wouldn't you be a more convincing teacher if used both and took the screenshots yourself? This would help you learn and understand the products better. (Vmware or virtual pc make this really easy and you could show them the differences live. :)) -- Diane Poremsky [MVP - Outlook] ...

Full email address showing on sent emails?
Using Outlook 2000 for email (I checked this time, Brian!). In the sent file, *some* of my emails are not showing the full email address and only the name. Why is this so with some only? And how can I arrange that on all outgoing emails (as I compose them) and in the sent mailbox the full email address (including the @billyboggs.com part) is showing? TIA aalaan <aalaan@tpg.com.au> wrote: > In the sent file, *some* of my emails are not showing the full email > address and only the name. Why is this so with some only? What I suspect is that you have the Display Name define...

Deleting a single character in a text field
In one of my tables i have a field that has a text values like '123.23123' i would like , to delete the full stop. How can i do this. I cant do it in excel as the number of records that i have is over 200000. hi, ma1000 wrote: > In one of my tables i have a field that has a text values like '123.23123' i > would like , to delete the full stop. How can i do this. I cant do it in > excel as the number of records that i have is over 200000. Create a update query, use Replace([yourField], ".", "") as new value. mfG --> stefan <-- ...

adobe active share phtot have gone smaller on slide show
I have adobe active share for my photo albums on my computor. The photos for some reason have just gone half the size of my screen and on a slide show. Even when I have imported new photos from fine pix they are half the screen size to.Can you please help Are you seeing this 1/2 size issue in Windows Live Photo Gallery? What is "fine pix?" -steve gill <user@msgroups.net/> wrote: >I have adobe active share for my photo albums on my computor. The photos for some reason have just gone half the size of my screen and on a slide show. Even when I have imported new photo...

why won't my automobile loan payments show as a transaction?
I have a automobile account and a wachovia bank account. My auto loan company automatically takes $245 from my bank account each month. i can see the $245 transaction in my bank account register in MS Money but it doesnt update in my auto loan register. How can I have it automatically update my auto loan register? Thanks, Brad Nelson Have you set up an automatic bill payment? -- Neil "Brad Nelson" <BradNelson@discussions.microsoft.com> wrote in message news:71678D94-6B93-4C41-84BB-F980827B51D8@microsoft.com... >I have a automobile account and a wachovia bank acco...

Condition navigating between Controls
I have a form in access 2007, with several controls. I used the On Exit Event Procedure for navigating among controls. Example: If Method of Payment = “Check” Then Check No.Set Focus End If If Method of Payment = “Credit Card” Then Credit Card Name.Set Focus End If End Sub And so on for all controls. Form functioned well for months, however today went wild. Navigation order does not execute Event Procedure it follows exactly the order of TAB ORDER DIALOG BOX. Please advice -- Bardia It sounds like the On Exit event is not firing for some reason. Put these two lines of co...

keyboard events for different CWnds
We know that BOOL CTestDialog::PreTranslateMessage(MSG *pMsg) can be used to capture keyboard inputs for some dialog class CTestDialog and in general any window. But consider this.. If I have a MDI application and therein certain Key strokes 'belong' to the mainframe and others to the child frame and perhaps certain others to some other pane or whatever, what is the best way to implement this? For instance, Ctrl+S saves a file in many apps (message goes to MainFrame) and Ctrl+C copies content in the child window (message goes to ChildFrame). What If I want customized key presses for...

What is the difference
What is the difference between IIF condition and IF condition ? "Kutty" <Kutty@discussions.microsoft.com> wrote in message news:46A1B86F-2002-4548-916D-01E0B3F2C602@microsoft.com... > What is the difference between IIF condition and IF condition ? IIf() is a function that can be used directly in a query or control source. If is used in VBA code only. Unless you are thinking of the If() function from Excel in which case that does not apply to Access at all. -- Rick Brandt, Microsoft Access MVP Email (as appropriate) to... RBrandt at Hunter dot com On Feb ...

Control Supported Device List for Active Sync
Hi I want to restrict what devices can connect to Active Sync - there is a built in list of supported devices which the service packs keep updating but is there a way to control this list yourself i.e. to only include two devices in the list? I want to control which devices meet the company standard and stop any which don't! More Info: Overview of mobile devices that are supported by Outlook Mobile Access in Exchange Server 2003 http://support.microsoft.com/Default.aspx?kbid=821835 Thanks Clive ...

how can I show repeating values in a chart?
I would like to show modes in the form of a pie chart but am not sure how. For example the number 73 comes up 3 times in a column on my spreadsheet, how can I show that compared to the number 50 which come up 2 times in the sheet? Thanks for the help Hi, You will need to compute those values using formula or a pivot table and then chart the results. Cheers Andy Cindy wrote: > I would like to show modes in the form of a pie chart but am not sure how. > For example the number 73 comes up 3 times in a column on my spreadsheet, how > can I show that compared to the number 50 whi...

MFC extension DLL not attached to chain
Hello, I have a big problem: a simple MFC application using MFC in a shared DLL + An extension DLL (wizard-made) with a bitmap inside: IDB_BMP. When I try to load the IDB_BMP bitmap I get error 1814: "The specified resource name cannot be found in the image file. " Here is the code from myapp.cpp: ........................................................... HMODULE hh; VERIFY(hh = AfxLoadLibrary("myextension.dll")); //AfxSetResourceHandle(hh); -> if I uncomment this line it works! CBitmap bmp; int n = bmp.LoadBitmap(IDB_BMP); // n == 0 DWORD dw = GetLastError(); // -...

vbscript insert into access 2003 database with two different table
I am trying to insert data collected by WMI. Here is the script On Error Resume Next Const HKEY_CURRENT_USER = &H80000001 Const HKEY_LOCAL_MACHINE = &H80000002 Const ForReading = 1 'Create FSO Set objFSO = CreateObject("Scripting.FileSystemObject") 'Create an environment for the script to work Set wshshell = WScript.CreateObject("WScript.Shell") 'Connection to the database Set cnn = CreateObject("ADODB.Connection") 'Connection to a Recordset Set objRecordSet = CreateObject("ADODB.Recordset") 'Opens the Database ...

2 different domains/1 exchange server
Hi. I'm currently running E2k03 SP1 as my mail server in our network. Recently another company move in our building (same owner) and both company are sharing network infrastructure. Each company has a different AD domains and this domains are not related in any ways (trust relationship). Is there any way that I can provide mail services to the new neighbors without trusting the domains or using pop3? -- Elvyn Gutierrez Pellerano & Herrera MIS/Lan Manager ...

Porting MFC to Mac OS X and Linux
What would you folks suggest if I was asked to port an MFC program(+100K lines of MFC application code) to Linux and or the Mac? What migration tools could you recommend? The application uses extensively modified(owner draw) MFC controls. --Mike I have no idea about Mac. For Linux, you can take a look at http://www.mainsoft.com/products/mainwin.html and see it if it helps. -- Ajay Kalra [MVP - VC++] ajaykalra@yahoo.com "Mike Engelhardt" <nospam@spam.org> wrote in message news:jHryc.83896$Og1.41441@newssvr25.news.prodigy.com... > What would you folks suggest if I was...

email form script to show email adresses of all recipients
I see there is a field in the attributes called torecipients but I cannot add it to the email form. Is there a way I can script this into the email form to show the email addresses of all of the recipients. My idea involved creting a new attribute called all_recipients and adding it to the form then doing a onchange for each of the to, cc, and bcc fields to update all_recipients. SO far it doesnt work. All the field returns is "undefined". Any help is greatly appreciated!!! ...

Calculate data on 2 different worksheets
I have a very large workbook and for efficiency reasons I have calculation set to manual. I need to calculate 2 different worksheets, but because they refer to each other, I have to calculate them a couple of times to make all of the formulas update correctly. I've tried naming a single range: Range3 = range1,range2 then I use Range("Range3").calculate but the result if only one iteration thru the formulas and the final result still needs one more calculation. Short of putting all the data on one sheet, is there anyway I can insure 2 separate worksheets are completel...