mfc

Text on MFC Controls - Unicode Characters such as Japanese get cut off

社会主义新天地 提交于 2021-01-28 06:18:31
问题 Background I'm working on a C++/MFC application and we've been converting it to display unicode characters to support foreign languages. For the most part this has been successful and unicode characters are displayed correctly. But I've encountered an issue where certain text on certain controls gets cut off. Example Here you can see a button that should display "ログアウト/終了" but gets cutoff and displays an unknown character in it's place. But if I pad the string with spaces it displays fine.

When editing a rc file, then opening it in VC Dialog Wizard, I get error RC2104 because of TBS_NOTIFYBEFOREMOVE

≯℡__Kan透↙ 提交于 2021-01-28 06:08:57
问题 I have a VC++/MFC dialog-based project. In those dialogs, I'm using some sliders with "Notify Before Move" at true. Sometimes, instead of using VS dialog wizard to edit them, I prefer to edit the related .rc file manually in a text editor. The issue is, after editing the .rc file, when I'm trying to open a dialog in VS wizard again, I get this error: "error RC2104: undefined keyword or key name: TBS_NOTIFYBEFOREMOVE" I can still compile the project successfully, but I cannot open the project

MFC - How to post a message to all views that were derived from CView class?

微笑、不失礼 提交于 2021-01-28 05:03:57
问题 I want to post a message to all views. I'm considering get a Document global reference and then implement a method like below void SomeAppDoc::DispatchToAll( UINT msg, WPARAM wP, LPARAM lP ) { //some how get all view's reference //iterate and update each views } What is the effective way? 回答1: The simplest way is to call CDocument::UpdateAllViews, which calls the OnUpdate function of each view attached to the document. If you really need to post a message to each view, rather than call

How to program to prevent the Windows “Not Responding” dialog [duplicate]

僤鯓⒐⒋嵵緔 提交于 2021-01-28 01:42:27
问题 This question already has answers here : Avoiding “(Not Responding)” label in windows while processing lots of data in one lump (11 answers) Closed 5 years ago . When an application fails to be responsive for 5 seconds (source), Windows can display "(Not Responding)" in the title bar and in some cases show a "not responding" dialog: Ideally, the 5+ second execution should not block the main/event-processing thread, but is there a simple (e.g. 1 liner for MFC C++) way to communicate to Windows

CFileDialog truncates offered file name

雨燕双飞 提交于 2021-01-27 18:30:01
问题 I have strange behaviour of CFileDialog once it is opened. The offered file name looks like it has been truncated, so that only last n characters are visible: image http://ves.fijmovi.com/cpp/CFileDialog_1.jpg As soon as I click on space for name, I get to see the whole file name: image http://ves.fijmovi.com/cpp/CFileDialog_2.jpg So it is not truly truncated, just the beginning position of shown string is not from the start. The complete file name is in this case 36 characters long and part

MFC Get Folders

假如想象 提交于 2021-01-27 18:28:09
问题 Hey how do I in MFC get names of all folders? Any examples or which classes should I look into? Any hints will be really appreciated. All I saw is the CFile, which as far as I have seen (though very very little) doesn't looks like it has the ability to do what I want. So please direct me. Thanks 回答1: Look into CFileFind There is an old article in DDJ on how to implement a recursive search using CFileFind . 回答2: A Google search revealed an nice example in: Listing the Files in a Directory It

C++ check if unicode character is full width

喜你入骨 提交于 2021-01-27 03:53:26
问题 How to check if a unicode character is full width? I use Win32 / MFC For example, 中 is full width, A is not full width, F is full width, F is not full width. 回答1: What you need is to retrieve the East Asian Width of the character. You can do it by parsing the EastAsianWidth.txt file from the Unicode Character Database. I could not find a Win32 API that returns this info, but in Python, for example, you can use unicodedata.east_asian_width(unichr). See the Annex #11 for the background of the

C++ check if unicode character is full width

爷,独闯天下 提交于 2021-01-27 03:50:38
问题 How to check if a unicode character is full width? I use Win32 / MFC For example, 中 is full width, A is not full width, F is full width, F is not full width. 回答1: What you need is to retrieve the East Asian Width of the character. You can do it by parsing the EastAsianWidth.txt file from the Unicode Character Database. I could not find a Win32 API that returns this info, but in Python, for example, you can use unicodedata.east_asian_width(unichr). See the Annex #11 for the background of the

embed window(glfwCreateWindow) as child to C++ MFC parent form

六眼飞鱼酱① 提交于 2021-01-24 12:24:37
问题 Please refer this link Embedding a GLFW window inside windows forms How can the same achieved by using VC++ to embed glfw window to Parent form? 回答1: Try this: Call glfwWindowHint() to set GLFW_DECORATED and GLFW_VISIBLE to false . Call glfwCreateWindow() . Call glfwGetWin32Window() to get the native handle of the OpenGL window. Call SetParent() to set your form as the new parent of the OpenGL window. Call GetWindowLong() / SetWindowLong() to remove the WS_POPUP and add the WS_CHILDWINDOW

How to overcome Script Error in CHtmlView?

。_饼干妹妹 提交于 2021-01-24 11:35:37
问题 I am using CHtmlView to show HTML pages from online into my application. Whenever the site/page tries to load any '.js' file or script it throws Script Error dialog and unable to load few items from the page. I have made SetSilent(TRUE) to avoid error messages, but still the Script Error occurs without showing the dialog. How can I overcome this problem? 回答1: To avoid JavaScript errors , one must create a value in registry edit under the following registry path, 32-bit : HKEY_LOCAL_MACHINE