mfc

MDI Document taskbar thumbnails with no decorations

Is it possible to remove the close window decoration from an mdi document taskbar flyout window? That is, remove the red "x" to prevent the user from closing the document via the taskbar. ...

Changing Selection Colour for CRichEditCtrl to black by default.

I am using a CRichEditCtrl object. Now when I select any text, the selection is highlighted in Blue Colour. However I need the selection to be highlighted in Black Colour. I have tried the SetSelectionCharFormat, but it only seems to be changing the colour of the selected part when the code is executed. However when I select the te...

Correct way to replace CHeaderCtrl with custom version in a CListCtrl

CListCtrl has a CHeaderCtrl 'built-in' and we want to override it with something customized, i.e a class which derives from CHeaderCtrl. What's the best/correct way to do this, assuming we have a dialog CMyDlg which contains a CListCtrl m_List, and a custom header CCustomHeader. ...

Show MFC GUI from UnitTest in Visual Studio 2008

I have two projects in my solution. One is a MFC project which shows a simple GUI saying "Hllo World" If I compile the MFC Application Project as Application (exe) it runs without problems. What I want to do now is to show the window from my UnitTest. (Doesn't make much sens, but it has to be like that). Therefore the MFC application i...

Calculating toolbar icon width

I am building an RDP client and I have toolbar that shows the running applications, same as the Windows toolbar. I need to support dual monitors, so my questions are 1) How do I detect that there is more than one monitor and 2) Is there a formula for calculating the width of the icons on the toolbar? I know that at the start, the width...

Avoid Resource Conflict

I have a MFC exe, trying to dynamic load a MFC dll. // This is code in MFC exe HINSTANCE h = AfxLoadLibrary(_T("DLL.dll")); typedef void(*FUN)(); FUN fun = (FUN)GetProcAddress(h, "loveme"); FreeLibrary(h); Both MFC exe and MFC dll, are having their own resource file. However, I realize that, if MFC exe and MFC dll are having a same r...

Override OnClose()

I got this class class CWebBrowser2 : public CWnd And i want to override OnClose What i have done so far is in the header file I added void OnClose(); and in the .cpp file i added void CWebBrowser2::OnClose () { int i=0; i++; } But the OnClose is never called. Then I tried to to modify the header file to afx_msg...

How do I bypass GUI in MFC app if command line options exist?

I've got an existing simple MFC app that the user specifies the input file, output file, and then a "Process" button. I'd like to just add the capability so that the input/output files are command line parameters. But, if they exist, I don't want the GUI to show up. I just want the "Process" to execute. I see where I can get the comm...

How can i prevent a CWnd from getting the focus?

I write a MFC application and need a button which is not taling the input focus away from another window. Removing the WS_TABSTOP style does unfortunately not help when the use clicks the button with the mouse. When i block WM_LBUTTONDOWN i don't get a visual pressed indication so this doesn't work either. ...

How to write INT64 to CString

I am coding in c++ windows. INT64 dirID = -1; CString querySQLStr = _T(""); querySQLStr.Format(L"select * from ImageInfo where FolderPath=%64d;", dirID); querySQLStr always like this: select * from ImageInfo where FolderPath= 1214; is it right to use %64d? Many Thanks ...

How to change the text color in a disabled edit box using MFC?

Hello all, I have a dialog in which the edit box is disabled but the text should be displayed in red instead of the default grey. I tried the following: void CMyEdit::OnEnable(BOOL bEnable) { CEdit::OnEnable(bEnable); if (bEnable) { m_BackGroundColor = kRGBWhite; } else { m_BackGroundColor = kRGBDefaultGray; } ...

Creating an Ctablctrl on a CFrameWnd

hi im new here, I want to create a mfc window that has tabs on top. I cannot find a good tutorial or example of this. Can someone give me a link to a good tutorial of example? please help me. ...

Convert unicode character to corresponding text ?

Hi All, I want to know is there any way to convert unicode char to its text rather than using static map ? e.g. $ -> Dollar Sign , A - >Latin Capital Letter A I wish to do exactly same as charmap.exe utility. Thanks in advance... ...

FormCloseQuery equivalent in MFC

In Delphi, there is FormCloseQuery event. What is equivalent in MFC? I want to stop CMainFrame from closing ...

List of good MFC libriares?

The reason I ask this question is there is no list available on Internet so far. There's BCGSoft - www.bcgsoft.com CodeJock - www.codejock.com CMarkup - www.firstobject.com XHTML - www.hdsoft.org UCanCode - www.ucancode.net ProfUIS - www.prof-uis.com Ultimate Toolkit - www.codeproject.com Are there any good recommended MFC/ATL librar...

Ampersand accelerators cause a beep in a Win32 dialog

I have a dynamically created toolbar on a plain Win32 dialog. My buttons are added with & shortcuts which correctly puts underscore to characters following ampersand but pressing Alt+(char) causes a beep and the button is not clicked. It has been a while since I have done Win32 API development. Is there something that needs to be done t...

Different ways of loading DLL into MFC?

Hi What are the different ways to load a win32 or MFC DLL into an MFC application? I know there are 2 ways to link a DLL. 1.) Include the lib file created with the DLL 2.) Using .def file and LoadLibrary function. Is there any other ways to link the DLL? Regards, AH ...

IsDirty name for member function of CField class

What was the raionale behind having a function by the name IsDirty() in CField Class in MFC. ...

Use Windows 7 taskbar features in VS 2008 with MFC

Hello, Is it possible to use the new taskbar Windows 7 features in Visual Studio 2008, with MFC? I know it is possible in VS 2010 and in VS2008 using WTL, But what about in VS 2008, is it possible to update MFC to v10? Thank you. ...

WPF App - MFC App interoperation

I have a small WPF application. I wish to integrate it within our exisiting systems. I have two COM servers implemented as MFC MDI apps, lets call them COM_Srv1 and COM_Srv2. COM_Srv1 needs to call a method of WPF app, say StartTask. On Task Completion WPF app notifies the COM_Srv1 app WPF app may need to invoke a method on COM_Srv2 to...