mfc

Up and Down icons in CListCtrl

I have a CListCtrl with multiple columns, all of which are able to be sorted by. I would like to add up and down icons so that it is clear which column is currently sorted upon, and in which direction; much like Windows Explorer. My thought was to add a solid up/down arrow to the column name. I tried using the extended ASCII chars 30/31;...

Launching external application and block current application till the launched application quit

I am not sure whether there is a way to Launch an external application, and block current application till the launched application had quit. Currently, I am using the following non-blocking method (MFC) to launch std::string str = "Notepad2.exe"; // Non-blocking. Return immediately. WinExec(str.c_str(), SW_SHOW); ...

MFC ugly menu font Windows 7

Hello, I'm writing an application using Visual Studio 2010 and MFC. When I create application with MFC wizard menu font is somehow ugly. Any ideas how to fix this? Here's an example and there seems to be the same ugly menu font. http://visualstudiomagazine.com/Articles/2010/06/01/~/media/ECG/visualstudiomagazine/Images/2010/06/0601vsm...

What are these odd files added to my Visual Studio MFC project?

Hi, I have a visual studio solution where one of the projects has somehow acquired several .bin files. They are named bin00001.bin, bin00002.bin, etc... and contains some kind of registry information. The contents of these files are one section repeated a number of times. bin00001.bin: HKCR { NoRemove AppID { '%APPID%'...

How to create BitMap Images using different colors in VC++?

Hello Friends.... I'm trying to develop a Desktop application using VC++ and MFC I'm new to it. Please help me.. ...

Buffer too small when copying a string using wcsncpy_s.

This C++ code is kind of lame, but I need to maintain it. I cannot seem to figure out a "buffer too small" problem. I am using Visual Studio 2010. I will come up with minimal code required to reproduce based on the values I see in the debugger. Sorry, I will not have tested the actual snippet itself. Also, since my system clipboard is "b...

codejock/MFC double key shortcuts

Hello, I want to use double key shortcuts like in MS Visual Studio but I have problems defining them. I use CodeJock and therefore the CXTPShortcutManager. If I manually assign a shortcut e.g. "Ctrl+K, Ctrl+C" directly in the program for a menu action it works properly. However, I was unable to define such a double key shortcut within...

Drawing with GDI and text with Qt

Hi I have an existing MFC application which draws some shape on screen, Now A Qt plug in is being developed whose one job is to add some text in the MFC drawing. We are using Qt to draw the text in bitmap and then bitblting that on screen so that MFC Cview shows both together. But when we are trying to print(usign Qprinter for text) Text...

Difficulty with MFC template project in VS2010

I'm using Visual Studio 2010 to experiment with MFC. I have created a template MFC project by following the wizard. I chose a dialog based app, and unchecked other options like ActiveX controls. After making no code changes, I hit F5, and the app runs. Then, using the form designer, I drag a rich edit control from the toolbox onto th...

CreateCompatibleBitmap failing on Windows mobile 6

I'm porting an application from Windows Mobile 2003 to Windows Mobile 6, under Visual Studio 2008. The target device has a VGA resolution screen, and I was surprised to find that the following code fails; CClientDC ClientDC(this); CRect Rect; GetClientRect(&Rect); int nWidth = Rect.Width(),nHeight = Rect.Height(); CBitmap Temp; i...

Sending string from console application to MFC

Hi, Im invoking console application from my MFC application through ShellExecuteEx(). After the exe get loading,i want to receive one test string form console apllication to MFC,if i cannot receive the string then i will close both MFC and Console application. For this,i want to send any string or valu from console application to MFC. I...

OnRButtonDown on a modal dialog

I have a modal dialog that I would like to implement a right mouse click event on. I have added ON_WM_RBUTTONDOWN() to the class's message map. BEGIN_MESSAGE_MAP(MyDialog, CDialog) //{{AFX_MSG_MAP(MyDialog) ON_WM_RBUTTONDOWN() //}}AFX_MSG_MAP END_MESSAGE_MAP() and have overridden the class's afx_msg void OnRButtonDown(UINT...

MFC Redo Function

I m trying with the Redo option, I have written the following code for Redo but insted of Redo Undo is working for the same. Please guide me where i went wrong. My code sample is..... void EIWBDoc::OnEditRedo() //for REDO. { // TODO: Add your command handler code here int Index = m_FigArray.GetUpperBound (); if (Index > -1) {...

How to detect when a device is added to the system?

Hello all. I've had this problem for a while now but I have to remedy it as I must tackle it now. I'm trying to detect when a device is connected to the system in windows 7 and I receive the WM_DEVICECHANGE just fine, however the message in wParam is always DBT_DEVNODES_CHANGED. Never a DBT_DEVICEARRIVAL or DBT_DEVICEREMOVECOMPLETE. I ha...

What is a "story" in the Text Object Model?

This documentation describes RichEdit and ITextDocument, which are part of MFC. RichEdit uses TOM, or text object model. The documentation makes repeated reference to "stories": The GetStoryCount property-get method retrieves the count of stories in this document. The GetStoryRanges property-get method retrieves the st...

How to programmatically end editing of a CTreeCtrl?

I have a class derived from CTreeCtrl. In some circumstances the user might be editing it and I would like to programmatically cancel the edit which is currently in progress. How do I do this? There doesn't seem to be any appropriate function of the class which would do that, or if I have to send it some message it's not immediately obv...

Creating a shared MFC Dialog: Regular DLL or MFC extension DLL

When creating a MFC DLL project in VC++ 2005, you get a screen "application settings" with a choice of Regular DLL with static/dynamic MFC, or an MFC Extension DLL. We want a DLL that contains a few common dialogs, so we can use them in other projects e.g: CGetNameDlg *dlg = new CGetNameDlg(); dlg->doModal(); string name = dlg->getName...

window handle in MFC??

how to get window handle in MFC?? ...

MIDL compilation error (and maybe idl file generation question).

We're looking into moving our application from VS2008 to VS2010. We generate some COM objects with "attributed programming" and the IDL is automatically generated. The import directives for both files are different and the compilation fails on VS2010. on VS2008, it generates something like : import "docobj.idl"; on VS 2010 impo...

I want to monitor global mouse event, how to do it by using MFC?

I want to write a program: click a window(some other program, like firefox, explorer..) get this window's HWND do something to that window My method is using PeekMessage to get event, but looks like PeekMessage only peek the message send from my program. So how can I add a hook to all the other windows, or monitor global events? ...