From bamforh at cisco.com Tue Sep 13 08:54:42 2011 From: bamforh at cisco.com (Harold Bamford (bamforh)) Date: Mon, 12 Sep 2011 18:54:42 -0500 Subject: [Xkeymacs-dev-en] problem building xkeymacs (GetString() is not a member of CString) Message-ID: Greetings, I've been trying to set up my build environment for compiling Xkeymacs. I have VS2010 Premium and it was giving me errors so I decided to start with a fresh machine and use the VC2010 Express. For this test, I am using a new, clean, Windows 7 (64-bit) virtual machine. I cloned xkeymacs using git: git clone git://git.sourceforge.jp/gitroot/xkeymacs/xkeymacs.git I downloaded and installed the 2010 Express. I then downloaded and installed the SDK 7.1 and the DDK 7.1. Finally, I compiled the solution and got this error: 1>Utils.cpp(461): error C2039: 'GetString' : is not a member of 'CString' C:\WinDDK\7600.16385.1\inc\mfc42\afx.h(385) : see declaration of 'CString' This is the error I was getting from my VS2010 Premium. Next, I downloaded and installed SP1 for VS2010. I compiled again and got the same error message. So, it looks like there is a change missing from github. Can somebody check if there are private changes in the WinDDK directory? In Utils.cpp, starting at line 452, the function SetClipboardText() calls text.GetString(). Unfortunately, this function is defined only for Unicode. BOOL CUtils::SetClipboardText(const CString& text) { ... memcpy(pMem, text.GetString(), nLength); ... } In C:\WinDDK\7600.16385.1\inc\mfc42\afx.h, you can see the GetString() stuff: #if (_MFC_VER >= 0x0600) && defined(UNICODE) public: PCTSTR GetString() const; And again later on: #if (_MFC_VER >= 0x0600) && defined(UNICODE) inline PCTSTR CString::GetString() const { return operator PCTSTR(); } Looking at the Property Pages, you can see that UNICODE is not being used: So, can somebody help me here? Thanks for your help. -- Harold Bamford -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.sourceforge.jp/mailman/archives/xkeymacs-dev-en/attachments/20110912/d7e525f1/attachment-0001.htm -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: image/jpeg Size: 27799 bytes Desc: image003.jpg Url : http://lists.sourceforge.jp/mailman/archives/xkeymacs-dev-en/attachments/20110912/d7e525f1/attachment-0001.jpeg From fujieda at users.sourceforge.jp Tue Sep 13 14:10:50 2011 From: fujieda at users.sourceforge.jp (Kazuhiro Fujieda) Date: Tue, 13 Sep 2011 14:10:50 +0900 Subject: [Xkeymacs-dev-en] problem building xkeymacs (GetString() is not a member of CString) In-Reply-To: (Harold Bamford's message of "Mon\, 12 Sep 2011 18\:54\:42 -0500") References: Message-ID: >>> On Mon, 12 Sep 2011 18:54:42 -0500 >>> "Harold Bamford (bamforh)" said: > I downloaded and installed the 2010 Express. I then downloaded > and installed the SDK 7.1 and the DDK 7.1. Finally, I compiled > the solution and got this error: > > 1>Utils.cpp(461): error C2039: 'GetString' : is not a member of 'CString' > C:\WinDDK\7600.16385.1\inc\mfc42\afx.h(385) : see declaration of 'CString' My mistake causes this error. I missed the MBCS version of CString in old MFC doesn't support GetString. I replaced it with the typecasting to LPCTSTR to solve this error. Regards, -- Kazuhiro Fujieda fujieda at users.sourceforge.jp From bamforh at cisco.com Tue Sep 13 23:49:36 2011 From: bamforh at cisco.com (Harold Bamford (bamforh)) Date: Tue, 13 Sep 2011 09:49:36 -0500 Subject: [Xkeymacs-dev-en] problem building xkeymacs (GetString() is nota member of CString) In-Reply-To: References: Message-ID: So, in Utils.cpp you have changed this: memcpy(pMem, text.GetString(), nLength); to this: memcpy(pMem, (LPCTSTR)text, nLength); Correct? Or did you change afx.h? -- Harold Bamford -----Original Message----- From: xkeymacs-dev-en-bounces at lists.sourceforge.jp [mailto:xkeymacs-dev-en-bounces at lists.sourceforge.jp] On Behalf Of Kazuhiro Fujieda Sent: Tuesday, September 13, 2011 12:11 AM To: xkeymacs-dev-en at lists.sourceforge.jp Subject: Re: [Xkeymacs-dev-en] problem building xkeymacs (GetString() is nota member of CString) >>> On Mon, 12 Sep 2011 18:54:42 -0500 >>> "Harold Bamford (bamforh)" said: > I downloaded and installed the 2010 Express. I then downloaded > and installed the SDK 7.1 and the DDK 7.1. Finally, I compiled > the solution and got this error: > > 1>Utils.cpp(461): error C2039: 'GetString' : is not a member of 'CString' > C:\WinDDK\7600.16385.1\inc\mfc42\afx.h(385) : see declaration of 'CString' My mistake causes this error. I missed the MBCS version of CString in old MFC doesn't support GetString. I replaced it with the typecasting to LPCTSTR to solve this error. Regards, -- Kazuhiro Fujieda fujieda at users.sourceforge.jp _______________________________________________ Xkeymacs-dev-en mailing list Xkeymacs-dev-en at lists.sourceforge.jp http://lists.sourceforge.jp/mailman/listinfo/xkeymacs-dev-en From fujieda at users.sourceforge.jp Wed Sep 14 01:05:47 2011 From: fujieda at users.sourceforge.jp (Kazuhiro Fujieda) Date: Wed, 14 Sep 2011 01:05:47 +0900 Subject: [Xkeymacs-dev-en] problem building xkeymacs (GetString() is nota member of CString) In-Reply-To: (Harold Bamford's message of "Tue\, 13 Sep 2011 09\:49\:36 -0500") References: Message-ID: >>> On Tue, 13 Sep 2011 09:49:36 -0500 >>> "Harold Bamford (bamforh)" said: > So, in Utils.cpp you have changed this: > > memcpy(pMem, text.GetString(), nLength); > > to this: > > memcpy(pMem, (LPCTSTR)text, nLength); > > Correct? Or did you change afx.h? Yes, it is correct. This actually solves the problem. -- Kazuhiro Fujieda fujieda at users.sourceforge.jp From bamforh at cisco.com Wed Sep 14 01:13:39 2011 From: bamforh at cisco.com (Harold Bamford (bamforh)) Date: Tue, 13 Sep 2011 11:13:39 -0500 Subject: [Xkeymacs-dev-en] problem building xkeymacs (GetString() isnota member of CString) In-Reply-To: References: Message-ID: Great! I will give it a try. Thanks! -- Harold Bamford -----Original Message----- From: xkeymacs-dev-en-bounces at lists.sourceforge.jp [mailto:xkeymacs-dev-en-bounces at lists.sourceforge.jp] On Behalf Of Kazuhiro Fujieda Sent: Tuesday, September 13, 2011 11:06 AM To: xkeymacs-dev-en at lists.sourceforge.jp Subject: Re: [Xkeymacs-dev-en] problem building xkeymacs (GetString() isnota member of CString) >>> On Tue, 13 Sep 2011 09:49:36 -0500 >>> "Harold Bamford (bamforh)" said: > So, in Utils.cpp you have changed this: > > memcpy(pMem, text.GetString(), nLength); > > to this: > > memcpy(pMem, (LPCTSTR)text, nLength); > > Correct? Or did you change afx.h? Yes, it is correct. This actually solves the problem. -- Kazuhiro Fujieda fujieda at users.sourceforge.jp _______________________________________________ Xkeymacs-dev-en mailing list Xkeymacs-dev-en at lists.sourceforge.jp http://lists.sourceforge.jp/mailman/listinfo/xkeymacs-dev-en From bamforh at cisco.com Wed Sep 14 06:14:56 2011 From: bamforh at cisco.com (Harold Bamford (bamforh)) Date: Tue, 13 Sep 2011 16:14:56 -0500 Subject: [Xkeymacs-dev-en] Another building problem (with solutions!) In-Reply-To: References: Message-ID: Greetings, I have found another problem. When compiling in Debug configuration (the way the project files are stored in github), there are missing functions like AfxThrowInvalidArgException(). Well, it turns out that these are not included in the WinDDK debug (mfc*d.lib) files. The fix is just to ensure that Xkeymacs is compiled in Release mode. But it took me quite a while to discover this. -- Harold Bamford -----Original Message----- From: xkeymacs-dev-en-bounces at lists.sourceforge.jp [mailto:xkeymacs-dev-en-bounces at lists.sourceforge.jp] On Behalf Of Kazuhiro Fujieda Sent: Tuesday, September 13, 2011 11:06 AM To: xkeymacs-dev-en at lists.sourceforge.jp Subject: Re: [Xkeymacs-dev-en] problem building xkeymacs (GetString() isnota member of CString) >>> On Tue, 13 Sep 2011 09:49:36 -0500 >>> "Harold Bamford (bamforh)" said: > So, in Utils.cpp you have changed this: > > memcpy(pMem, text.GetString(), nLength); > > to this: > > memcpy(pMem, (LPCTSTR)text, nLength); > > Correct? Or did you change afx.h? Yes, it is correct. This actually solves the problem. -- Kazuhiro Fujieda fujieda at users.sourceforge.jp _______________________________________________ Xkeymacs-dev-en mailing list Xkeymacs-dev-en at lists.sourceforge.jp http://lists.sourceforge.jp/mailman/listinfo/xkeymacs-dev-en -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.sourceforge.jp/mailman/archives/xkeymacs-dev-en/attachments/20110913/90c0bdb0/attachment-0001.htm From fujieda at users.sourceforge.jp Mon Sep 19 23:43:05 2011 From: fujieda at users.sourceforge.jp (Kazuhiro Fujieda) Date: Mon, 19 Sep 2011 23:43:05 +0900 Subject: [Xkeymacs-dev-en] Another building problem (with solutions!) In-Reply-To: (Harold Bamford's message of "Tue\, 13 Sep 2011 16\:14\:56 -0500") References: Message-ID: Harold, >>> On Tue, 13 Sep 2011 16:14:56 -0500 >>> "Harold Bamford (bamforh)" said: > > I have found another problem. When compiling in Debug > configuration (the way the project files are stored in > github), We can't specify the default configuration in the solution file. It always becomes a Debug build. If you want to do so, you can build XKeymacs in a Debug build with Visual Studio Premium. In addition to it, you have to install Windows SDK 7.1. You must never install WDK to prevent the old MFC being installed. Regards, -- Kazuhiro Fujieda fujieda at users.sourceforge.jp From bamforh at cisco.com Tue Sep 20 01:04:56 2011 From: bamforh at cisco.com (Harold Bamford (bamforh)) Date: Mon, 19 Sep 2011 11:04:56 -0500 Subject: [Xkeymacs-dev-en] Possible fix for altered screen DPI (was: Another building problem (with solutions!) In-Reply-To: References: Message-ID: Kazuhiro, Interesting! Well, perhaps a note in the README indicating that it must be built in Release mode would help. BTW, I have a fix for the problem with the Properties window not completely showing when the text size has changed. It turns out to be somewhat more complicated than I thought but I have it working. I've tested it on Win7-64 and Win XP-32 at 100% (normal text size), 125%, and 150%. However, there is one piece that is somewhat of a hack and I am reluctant to put it in without somebody else (How about you!) looking at it. The change is in Properties.cpp in the function OnInitDialog() between the first call to SetWindowPos() and SetForegroundWindow(): m_sheet.SetWindowPos(NULL, rcSheet.left - 11, rcSheet.top - 8, 0, 0, SWP_NOZORDER | SWP_NOSIZE | SWP_NOACTIVATE); // heb: fix size of parent window. This is needed if the user has changed the effective DPI on the screen, // usually to get larger characters. // // Using LOGPIXELSX and LOGPIXELSY with GetDeviceCaps() doesn't help as the font size change only increases // things slightly. We need to ensure that all the controls fit. Which is laborious as the buttons // at the bottom need to be moved. Fortunately the top position of the property sheet is known already. // // This is the window that needs to be resized CWnd *parent = GetParentOwner(); if(parent) { CRect parentRect; parent->GetWindowRect(&parentRect); // This tells us the typical height of a button at the bottom of the window (the OK button) CRect okRect; CWnd *btnWnd = GetDlgItem(IDOK); btnWnd->GetWindowRect(&okRect); ScreenToClient(&okRect); // This tells us the size of the property sheets (which changes size according to screen DPI) CRect m_sheetRect; m_sheet.GetWindowRect(&m_sheetRect); ScreenToClient(&m_sheetRect); // Now calculate parent window dimensions int newWidth = m_sheetRect.Width() + 11; // 11 pixel margin on right // Height doesn't make sense. It should be bottom of property sheet + room for // buttons + margin. So a small margin (say, 10) should just squeeze everything // together but still show everything. Instead, part of the buttons disappear. //int newHeight = m_sheetRect.bottom + okRect.Height() + 40; int newHeight = m_sheetRect.bottom + (okRect.Height() * 2) + 11; // this seems to work OK parent->SetWindowPos(NULL, 0, 0, // x and y ignored when SWP_NOMOVE is set newWidth, newHeight, SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE); m_sheet.GetWindowRect(&m_sheetRect); ScreenToClient(&m_sheetRect); // Now move the buttons down as needed. Don't seem to need to move them horizontally. // We need to reposition a lot of buttons at the bottom of the dialog. This allows us to // use a loop. int btnList[] = {IDC_LOAD_DEFAULT, IDC_SELECT_ALL, IDC_CLEAR_ALL, IDOK, IDCANCEL, IDC_APPLY, -1}; CRect btnRect; for(int loop = 0; btnList[loop] >= 0; ++loop) { CWnd *btnWnd = GetDlgItem(btnList[loop]); btnWnd->GetWindowRect(&btnRect); ScreenToClient(&btnRect); btnWnd->SetWindowPos(NULL, btnRect.left, m_sheetRect.bottom, 0, 0, SWP_NOZORDER | SWP_NOSIZE | SWP_NOACTIVATE); } } // end of resizing window for adjusted DPI SetForegroundWindow(); This works, but I don't understand why the calculation for newHeight doesn't work as expected. Any ideas? Thanks for your help. -- Harold Bamford -----Original Message----- From: xkeymacs-dev-en-bounces at lists.sourceforge.jp [mailto:xkeymacs-dev-en-bounces at lists.sourceforge.jp] On Behalf Of Kazuhiro Fujieda Sent: Monday, September 19, 2011 9:43 AM To: xkeymacs-dev-en at lists.sourceforge.jp Subject: Re: [Xkeymacs-dev-en] Another building problem (with solutions!) Harold, >>> On Tue, 13 Sep 2011 16:14:56 -0500 >>> "Harold Bamford (bamforh)" said: > > I have found another problem. When compiling in Debug > configuration (the way the project files are stored in > github), We can't specify the default configuration in the solution file. It always becomes a Debug build. If you want to do so, you can build XKeymacs in a Debug build with Visual Studio Premium. In addition to it, you have to install Windows SDK 7.1. You must never install WDK to prevent the old MFC being installed. Regards, -- Kazuhiro Fujieda fujieda at users.sourceforge.jp _______________________________________________ Xkeymacs-dev-en mailing list Xkeymacs-dev-en at lists.sourceforge.jp http://lists.sourceforge.jp/mailman/listinfo/xkeymacs-dev-en -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.sourceforge.jp/mailman/archives/xkeymacs-dev-en/attachments/20110919/42b18481/attachment-0001.htm