mfc

Always-in-front dialogs

Is there a way to create a modeless dialog box in C++ MFC which always stays on top of the other windows in the application? I'm thinking sort of like the Find dialog in Visual Studio 2005 - where it stays on top, but you can still edit the underlying text. (If it makes any difference, it's not MDI; it's a dialog-based app) ...

How to place multiple control in single pane

Hi Friends, I am using Xtreme Toolkit Pro for creating docking pane in my MFC application. The Pane class allows to attach only one control (which is inherited from CWnd class) at a time. I want to add multiple controls in my pane. How can I achive it? If any one has an experience in this or relevant area please share it with me. Info ...

How to make an MDI child window stay on top of its siblings?

This question is related to my previous one. I have an MFC (VC6) MDI Application which has several MDI child windows acting as different views for one document. Is it possible to set one of those frames to stay on top of the others? I have tried to call SetWindowPos( &GetParentFrame()->wndTopMost, 0, 0, 0, 0, SWP_NOMOVE | SWP...

How to screen capture my program?

Duplicate: Best way to take screenshots of a window with c++ (windows) I have a Windows (2000/XP/Vista/W7) C++ desktop application that would like to save a screen capture of itself. It is an MFC dialog application. Can someone pass me a pointer that would get me on the road to implementing this feature? ...

sending the message Ctrl+Alt+Del from my application

I want to write a small utility in MFC which sends the Ctrl+Alt+Del message to OS. Can any one help me how do I achieve this ? I tried ::PostMessage(HWND_BROADCAST, WM_HOTKEY, 0, MAKELONG( MOD_CONTROL | MOD_ALT, VK_DELETE)); But this is not working. Thanks. I want to Send Ctl+Alt+Del not to invoke TaskMgr.exe. Also, it is for my local...

Which is the best book to learn visual C++ ?

I've learned the essentials of C++ and would like to learn Visual C++ (VC++) I want to be master in native , MFC and .NET for Windows programming. I already bought a book on VC++ by Ivor Horton. But the language seems hard to understand. Does anyone have any better book recommendations? ...

Where do I translate MFC message boxes

I'm localizing an MFC app into Japanese, and have the resources working right. My current problem is that, when I use AfxMessageBox, or MessageBox, the dialog title and button messages come up in English, and I haven't found anywhere to change that. I haven't found anything useful searching MSDN or Google. So, Does this work? Does W...

C++ string memory management

Last week I wrote a few lines of code in C# to fire up a large text file (300,000 lines) into a Dictionary. It took ten minutes to write and it executed in less than a second. Now I'm converting that piece of code into C++ (because I need it in an old C++ COM object). I've spent two days on it this far. :-( Although the productivity di...

MFC CLinkCtrl

How do you use CLinkCtrl? ...

Showing size grip in CDialog?

I have seen code which handles the drawing of this thing (DFCS_SCROLLSIZEGRIP), but surely there is a window style which I can apply to get it "for free". Right? ...

Reasons for stack unwinding fail

I was debugging an application and encountered following code: int Func() { try { CSingleLock aLock(&m_CriticalSection, TRUE); { //user code } } catch(...) { //exception handling } return -1; } m_CriticalSection is CCricialSection. I found that user code throws an exception such that m_CriticalSection is...

Stack unwinding in case of structured exceptions

This question provides more clarity on the problem described here. I did some more investigation and found that the stack unwinding is not happening in the following piece of code: class One { public: int x ; }; class Wrapper { public: Wrapper(CString csText):mcsText(csText) { CString csTempText; csTempText.Format...

Screen ratio distorted in Windows MFC application in VMware

I have a C++ MFC application that uses DPtoLP to calculate logical coordinates from device coordinates. Normally this works fine. I have a screen with square pixels. It is 1280x1024. My VMware runs W2K, with a resolution set to 800x480. In the program the MapMode is MM_LOMETRIC. My OnDraw code: void CMyView::OnDraw(CDC* pDC) { // TE...

CComboBox automatically selects text after call to MoveWindow

I'm currently experiencing a very strange problem with a CComboBox used within a CFormView. After adding strings to the combobox (created with WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_VSCROLL | CBS_DROPDOWN | CBS_SORT | CBS_AUTOHSCROLL), I'm selecting an entry via CComboBox::SetCurSel and resize the combobox via MoveWindow in the OnSize(...

How to handle notify messages in child & parent classes?

I have a custom CTabCtrl which I am trying to customize (to automatically change pages). If I handle ON_NOTIFY_REFLECT(TCN_SELCHANGE, ...) in my tab control, ON_NOTIFY(TCN_SELCHANGE, ...) is not received by the parent class. How can I receive both notify messages in the child and parent classes? Currently I am using a "workaround" of...

False memory leaks in a MFC project

I have an MFC project, that is linking to a third party dll. At program exit, the IDE reports back that "Detected memory leaks!" and dumps the leaks. These leaks are from the third party dll. I'm pretty sure that these are falsely being reported. (A quick Google check states that MFC checks for memory leaks, before the CRT destroys v...

CStatusBarCtrl GetItemRect XP Manifest

When using a CStatusBarCtrl in MFC I use GetItemRect to get the bounds of each item within the CStatusBar. However I am seeing a problem now I use an XP manifest in the exe. That it will not return a correct rectangle so I no longer identify correctly when the mouse is in the far right of the control. The problem can be tested with a m...

Changing image of a menu button in a CMFCToolbar

Hello, I have a menu button inside a CMFCToolbar and I would like to replace the bitmap of the button each time a different entry is selected in the menu as each entry has its own icon. I succeed in changing the icon using CMFCToolBarMenuButton::SetImage but it changes the icon in the menu entry too... Too bad. Here is a sample...

TRACE and TRACE0, TRACE1 & TRACE2 variations

Dear All, It's possible to use TRACE macro as printf like function (variable argument list) . If it supports this facility, then why it's necessary to have TRACE0, TRACE1 and TRACE2 macros except they're imposing restrictions on number of arguments. Again, I'd like to know if there are any advantages on restricting number of arguments f...

Turn off XP Theme in VS2008 compiled MFC App

We've just recently switched our C++ MFC Application from VS2005 to VS2008. Unfortunately in doing so our UI has appearance problems, with things like group boxes appearing blue rather than black, properties dialogs having a white background etc. I presume that in VS2008, MFC has been changed to respect the OS theme (in my case XP defaul...