I am developing an application that is available in multiple languages. Currently we set the UI language for the application using an installer which means that you can run in German on any language OS. However there is one problem and that is with Microsoft dialogs and wizards. They seem to want to load the resources based on the current locale. An example is: OS is English, Locale is France, and you install German application. This results in French resources being used for property sheets while German is used everywhere else. There are two ways that I have found to stop this. One was to create a seperate DLL for each language. However the company I was hired to do localization work for seems to still be in afterthought mode and there is too much resistance for this. Not to mention if I had unlimited time to really do localization right there are many problems to fix. The second way was to call SetThreadLocale(). This loads the wizards correctly, however I keep seeing that SetThreadLocale() is a bad function and should never be used. Is this true? We already use our own version printf() to allow different non-standard tokens to be used in strings. So I also overwrote this so the use of formatting numbers, dates, and other localization settings is already preserved based on user locale. I just wanted to make sure I would or wouldn't be making a huge mistake using SetThreadLocale because I didn't know all the reasons it has been blacklisted. Thanks If you start a fire for a man, he will be warm for a day. If you start that same man on fire, he will be warm for the rest of his life.
SanShou
Posts
-
SetThreadLocale -
English App on Japanese OSThanks I will try that... Not worried about handling DBCS strings. We build our software in all UNICODE, with a few exceptions where the interfaces call for DBCS. Then we worry but I have a good handle on that. I also wrote a quick application to allow me to actually psudeo translate all the resources and insert DBCS characters in preparation for actually localizing the software. The only thing I couldn't figure out was why the property pages and the wizards would always truncate the English version of the dialog boxes when running on a Japanese OS. The strings which would normally be wide enough on an English wizard would be too wide for the Japanese wizard. If I expand the size of the English dialog resources without expanding the controls, then they would fit. However this made it look bad in English. I think this solution will help and I will try it. Thanks, Brian If you start a fire for a man, he will be warm for a day. If you start that same man on fire, he will be warm for the rest of his life.
-
English App on Japanese OSHey, I am looking for a solution to an eternal problem. We get complaints that our software does not look good in English when running on a Japanese OS. Most of the problems revolve around the wizards and property pages not sizing correctly. This is because I cannot find a way for the MS PropertySheet and PropertyPage to use a more English favorable font. Does anyone know a way to force the MS controls to use the current dialogs font and sizing and ignore the OS specifications? I should say and do this without affecting the users OS in a deterimental way. I don't want to change things on the OS out from under a user obviously. Just as a side note, the applications are not MFC but Win32 API. Thanks, Brian If you start a fire for a man, he will be warm for a day. If you start that same man on fire, he will be warm for the rest of his life.
-
RESX Comparison UtilityI am looking for a utility that will allow me to compare RESX (i.e. XML) files even if the data is not in the same position. I am currently trying to integrate the translations from our localization vendor in to our active development tree and it is not easy when data has been moved around. A standard line by line compare looks worse than most Christmas tree light displays. I tried examxml but it was so hard to use to integrate between files. I cannot seem to find another one out there though that performs better. Too many of them say they handle xml files to find out they still do a line by line comparison. Thanks, Brian If you start a fire for a man, he will be warm for a day. If you start that same man on fire, he will be warm for the rest of his life.
-
ResX File DifferenceHey, I am not sure if this is the correct place to put this, but I am currently localizing an active project that is using .resx files. While the developers are making simple changes, it seems to randomly re-order the files. So I was wondering if anyone knew of a good file difference program (like Beyond Compare or Win Diff) that can handle .resx files that keep switching order but not neccessarily data. Thanks, Brian If you start a fire for a man, he will be warm for a day. If you start that same man on fire, he will be warm for the rest of his life.
-
Switching TCHAR to UTF-8Hey all... I am trying to write out a Japanese text string in a data file which was originally specified for ANSI text and used across several applications. Basically what was suggested was that I use UTF-8 to write out the text strings and read them back in. One of the constraints is that the current applications that read English only should still be able to read English data if this application writes it. However the old applications can punt on the Japanese until they are also updated. I can figure out how to write from MBCS to UTF-8:
#ifndef UNICODE MultiByteToWideChar(CP_UTF8, dwFlags, lpMBCSStr, cbMBCS, lpWCStr, cchWCStr) #endif
However we normally build in UNICODE using TCHAR, and it is normally UTF-16. However I just want to convert this one string from UTF-16 to UTF-8. Anyone ever done this? You can also just call me insane and stupid as long as you can suggest a better approach. I don't mind being insulted if I can learn something. :-D Brian If you start a fire for a man, he will be warm for a day. If you start that same man on fire, he will be warm for the rest of his life. -
Returning a String from Managed to Unmanaged CodeThanks for the response. I did try that and it caused me some issues with building the unmanaged code. However I was able to change the string to a stringbuilder which is listed as a both an in and out in the built type library. This was suggested in the big purple book that I borrowed from a friend. Thanks, Brian If you start a fire for a man, he will be warm for a day. If you start that same man on fire, he will be warm for the rest of his life.
-
Returning a String from Managed to Unmanaged CodeHey, I am trying to get a string returned from my managed code to my unmanaged code. Basically what I have so far is an interface as follows:
[ComVisible(true)] [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] [Guid("")] public interface IGet { void GetString([MarshalAs(UnmanagedType.LPWStr)] out string Value); } public class PropertyGet : IGet { public PropertyGet(Item item) { m_item = item; } public void GetString(out string Value) { Property prop = m_item.GetProperty(); Value = prop.ToString(); } }
In the managed codeHRESULT CFileProperties(BSTR fileName, IGet pIGet) { WCHAR wszWideBuffer[1024]; // NULL_CHARACTER is appropriate for wide characters wszWideBuffer[0] = NULL_CHARACTER; pIGet->GetString(wszWideBuffer); }
So in the managed code right now, the wszWideBuffer is filled with some wierd characters. So something is not marshalling correctly and with my limited experience I am not sure where to look for the problem. Most articles seem to handle passing strings the other way (i.e. getting a string back from the unmanaged which works in my property setting code.) Any help would be appreciated. Brian If you start a fire for a man, he will be warm for a day. If you start that same man on fire, he will be warm for the rest of his life. -
Control ArraysI was just wondering if there is a way to do a control array for ease of setting up some controls. Basically I am trying to do this (syntax is more psuedo code):
controlA_View1.Top = controlA_View2.Top; controlA_View1.Left = controlA_View2.Left; controlA_View1.Visible = false; controlB_View1.Top = controlB_View2.Top; controlB_View1.Left = controlB_View2.Left; controlB_View1.Visible = false; ... controlN_View1.Top = controlN_View2.Top; controlN_View1.Left = controlN_View2.Left; controlN_View1.Visible = false;
I was wondering if I could do this:// Assume all controls were inserted by the designer Array arrView1; arrView1.Add(controlA_View1); arrView1.Add(controlB_View1); ... arrView1.Add(controlN_View1); Array arrView2; arrView2.Add(controlA_View2); arrView2.Add(controlB_View2); ... arrView2.Add(controlN_View2); for(int i = 0; i < arrView1.Count() && i < arrView2.Count(); i ++) { // Not casting even though I know array returns an object arrView1[i].Top = arrView2[i].Top; arrView1[i].Left = arrView2[i].Left; arrView2[i].Visible = false; }
I am adding the controls via the form desinger because it is obviously easier to lay them out. I am using my current home project to explore deeper in to C# however I know I could do something like this with pointers or maybe with unsafe code. I remember the ref keyword can cause a reference to be passed to a function but can a ref be passed to an array? Thanks for any help... Brian If you start a fire for a man, he will be warm for a day. If you start that same man on fire, he will be warm for the rest of his life. -
Multiple Forms\ViewsHey All, I am looking for some advice. I am pretty new to C# with a little experience making form based windows applications that are pretty quick and dirty just to get them done (such as my psudeo translator that allows me to replace characters in a resource file with Japanese characters to test localization of products.) However I am trying to do something new which is to create an application that has multiple forms, however I am not a big fan of having several different windows open on the screen free floating when they could be wrapped in a single window. I would like a cleaner solution than closing one window with form1 and opening a new window with form2 on it. After looking at my options I came up with several ways of doing this: 1) Instead of creating several forms, just use several panels that hide the controls based on a view switch. This seems cumbersome to do with the form designer, but seems possible if I hand write everything. I think this would work the way I want it to. Also I am a little afraid that this might mean all the code is in the form1 class which would be hard to maintain. 2) Not sure if I could just create a custom control that mimics the functionality that I looking for and then hide and show these based on views. This would allow me to create different elements of each control and re-use some other external controls such as listviews for displaying drag and drop elements. Not sure what I just said or if I can accurately express what I was thinking. 3) Rewrite the MFC Formview architecture in C#. Sounds like a lot of work but it may be worth it in the long run. Then I can feel like I accomplished something. Just not sure that it would be any better than a simplier idea though.... Any advice from someone that knows a bit more... Am I missing something (other than my own sanity)? Thanks, Brian If you start a fire for a man, he will be warm for a day. If you start that same man on fire, he will be warm for the rest of his life.
-
Localizing a Property Sheet WizardI am trying to localize a Property Sheet Wizard for a Japanese version of the software. However when I do include Japanese resources, the wizard seems to retain the size of the English version of the dialogs. Both resources actually have the same size in dialog units, but the Japanese version uses a different font which causes it to be slightly wider. However it appears cutoff in the wizard. Anybody seen this before and better yet know any fix for this? Thanks If you start a fire for a man, he will be warm for a day. If you start that same man on fire, he will be warm for the rest of his life.
-
Using Japanese ResourcesI am currently attempting to localize a dialog for Japanese. This dialog inherits off of CAxDialogImpl. The seemingly simple way to localize this was to set the _Module.hinstResource to our language DLL. This seems to find the dialog and seems to load it. It does call _DialogSplitHelper::SplitDialogTemplate which finds all the controls and builds the template. However when it proceeds to call DialogBoxIndirectParam it returns a -1. Called GetLastError and of course it returns "Operation Completed Successfully". Then I tried to modify the dialog to use our internal resources. I did that by overriding DoModal and creating a Modal Pump. This allows me to use our internal dialog creation tools that are designed to load from our Japanese language DLL and if that fails load from the embedded English resources. However the Japanese dialog fails to load, and then StartWindowProc asserts when trying to load the English dialog. This is because _Module.ExtractCreateWndData() returns a NULL. (NOTE: I do AddCreateWndData() in the DoModal call). Also if set the application to load English only, then this dialog still doesn't come up but does not assert in StartWindowProc. Anybody seen this before and solved it? Anybody have any articles on localizing CAxDialogImpl()? All help is helpful, and appreciated... Thanks, Brian If you start a fire for a man, he will be warm for a day. If you start that same man on fire, he will be warm for the rest of his life.
-
Unexpected Delay in TCP StreamsI have a quick question (okay maybe not so quick) about timing and controlling the TCP/IP stack in windows. I developed a communications stack for an application that has to support large file tranports and smaller messages across TCP connection. The smaller (< 1K) control messages seem to work fine and the stack is able to communicate. However when I drop the big 10K message on the stack, it all seems to be writing correctly, however I am seeing a significant delay of 3 seconds between each 1k Window going out. (Note the TCP ACK comes back in around 9ms.) This 3 second delay (30 seconds total to send all 10K) seems a bit of a waste. I am going to continue to test and see if it is my machine but I believe it must be a property of the sockets. One other note is that if I send a continuous stream of the small control messages, there is no 3 second delay between packets. I set up the socket as an overlapped socket:
m_Socket = WSASocket(AF_INET, SOCK_STREAM, IPPROTO_IP, NULL, 0, WSA_FLAG_OVERLAPPED);
I then set the keep alive mode on, bind it to a local port, and then connect to the remote box. That all seems to work fine, except when I rely on the TCP window streaming mechanics I get that delay. The remote side even says that I have another 7K available in it's window that I could send. Is there some sort of TCP window parameter that I cannot find in the documentation?? Thanks, Brian If you start a fire for a man, he will be warm for a day. If you start that same man on fire, he will be warm for the rest of his life. -
C++ vs. Managed C++Thanks. Yes it did help. Those articles were very interesting and provided a good look in to the architecture and the speeds, not that most of my code is tightly looped for optimization myself, but it was defitinely enlightening. Of course I also need to read them more thorougly when I get a chance. They also pointed to a few new buzz words and technologies I am going to have to reasearch such as ngen'd. However that is the fun in trying to catch up and learn new things... :-D Thanks, Brian If you start a fire for a man, he will be warm for a day. If you start that same man on fire, he will be warm for the rest of his life.
-
C++ vs. Managed C++Thank you, That was very imformative and very helpful. It gives me a good basis on what the differences are and where to start learning. I am very interested in picking up additional knowledge so I am glad people are willing to share, especially since nobody at work is available to discuss things with. The benefits of the very small company work place may be appealing but there are disadvantages to knowledge growth. Anyway thanks again, I really appreciate it. Brian If you start a fire for a man, he will be warm for a day. If you start that same man on fire, he will be warm for the rest of his life.
-
C++ vs. Managed C++I know I risk getting a huge flame :(( but, what the heck its winter and I could use some heat to spice up my life... I admit I have been out of it for a while, but I am struggling with the differences (benefits and analysis) between the different technologies out there. I understand and use Visual C++ (presumably unmanaged since my company doesn't want to spring for Visual Studio .Net or training... bahh). However I am seeing a lot of traffic on the managed C++ front. I am currently trying to catch up and learn the new technology (I had to buy Visual Studio.net for myself for Christmas...) and I was wondering, can anyone explain some things? First what are the benefits for Manage C++ versus the regular C++? Things like speed, code usage, MFC usage vs. Win 32 usage, syntax? Also what is the difference between these and C#? Let's say I am writing a high performance application like a game, which of the three new language technologies are worth it: Unmanaged C++, Managed C++, or :-D C#? Second, how hard is it to convert over from my old unmanaged habits to the managed version? I am trying to decide whether it is worth making the change, even though I cannot do it where I work presumably... I guess I could ask what other technologies are out there that I should concentrate on learning... I already want to learn XML (and yes I do not know it yet... :omg: ), but I figure I am going to get flamed enough. I thank anyone for their help, and I am attempting to research it myself, but between working on finishing up the project that will keep 20 some people employed going in to the new year, deciding that I have had enough of training for international level Kung Fu competitions (my hips, knees, and shoulders really could use a warm winter :mad: not to mention they are they only keeping me awake while I work late into the night :zzz: ), and dealing with these Christmas things such as buying presents.... I am sure everyone knows how it goes, but I could use the help focusing my learning and growing, not to mention actually understanding... Thanks, Brian Now assembling the pyre... waiting for the first spark...:cool: If you start a fire for a man, he will be warm for a day. If you start that same man on fire, he will be warm for the rest of his life.
-
Saving File Formats;) Tell me about it. My boss laid down the requirments at just the right level to be dangerous without exactly knowing what he wants. Now I am just researching what I can actually give and then counter proposal time... If you start a fire for a man, he will be warm for a day. If you start that same man on fire, he will be warm for the rest of his life.
-
Saving File FormatsThanks for the suggestion, but I checked out the "other site" and the articles on Excel. They all require excel ODBC drivers to read and write files. I need to learn how to automated create ODBC or DAO drivers. I just need a method of letting others use additional software to edit the file outside of the actual GUI program. I will keep looking... Brian If you start a fire for a man, he will be warm for a day. If you start that same man on fire, he will be warm for the rest of his life.
-
Saving File FormatsI feel like I should know this question, but it seems to me to be harder than I want it too. Preface: I am working on a windows GUI interface for a embedded system. My boss wants to save off the current state of the system in to a file. However he has laid some requirements on the file format 1) it should be hand editable, 2) other applications should be able to open it, and 3) we don't need to rely on the having an outside application. My boss understands enough about software to be annoying and he is insisting that the file save be ODBC, however I admit I am not familiar enough with it. I do realize that you need to register a datasource and I am not sure how to do this on a different machine. My predecessor wrote the GUI in VB and he saved the file in Access format which was not hand editable. I have cruised the site here and found some nice demonstrations. I had orginally thought that I would save the file in an Excel format. I noticed it used ODBC and my boss would be pleased. However I began to be concerned that it might fail on machines that don't have excel. We cannot require installation of Excel on a machine to run our GUI. I think automation solutions I found on Microsofts site will also have this problem. I am not sure how the orginal VB code got around this problem with the Access format file using type libraries. (Not real familiar with those either.) Does anyone have any advice on what to do and where to find documentation on doing it? I mean I can use ODBC if I can find a way to automate the registration of the data source.. but I need to brush up on this stuff again.. Thanks for any help, Brian If you start a fire for a man, he will be warm for a day. If you start that same man on fire, he will be warm for the rest of his life.
-
New to computer programmingThe standard in the gaming industry is still C++ at this point. There are several options to programming out there as far as languages and I have heard of some games programming done in every language that exists. I would recommend Computer Science, although Electrical Engineers are good as well. However I think in Electrical Engineering you may learn more fun stuff (I am an electrical Engineer) you lose some of the theory of programming that may give you an edge over other candiates if all you want to do is software. However you may want to look at a software engineer program if one is available as that would merge more of the two disciplines. In my honest opinion for what you hope to accomplish studying C++ would be your best choice. Getting used to the Microsoft Visual C++ will get you closet to most gaming environments that are out there, but once again it is not the only flavor of c++ on the market. Linux has gcc. There is borland c++. Each of these will allow you to learn the language and get you in to programming and give you experience. Another approach for entering the gaming industry and one that I have been exploring is to download the tools for modifying a current game. These modifications often have a script language which is very similiar to C/C++. These are good tools to let you see what is ahead of you, however they may be a little confusing to start with. Don't worry too much about that, but they are good demos. Lastly, coding or programming to me is a skill that translate well accross boundaries more readily than most. I have worked in Visual C++ for many years now, but after I was laid off and started my new job, I was forced to support Visual Basic code for a while. The reason I say this is that even studying visual basic will help you learn to code and understand object oriented programming. The syntax however will be different, but if you learn to understand outside the syntax and understand the concepts, any language will work for you. Brian If you start a fire for a man, he will be warm for a day. If you start that same man on fire, he will be warm for the rest of his life.