mfc

choosing right data structure

Hi, I need to know What is the best data structure to use when transferring and storing large amounts of data across different COM objects in MFC application. (the data is usually large strings, xml files, images etc) Is there any memory issue if I use CList, CMap etc Thanks ...

static char * vs #define in C++ VS2005

I have a large program with several large DLL's that are compiled with MFC and /clr. There is a limit of 65535 global FieldRVA entries in an assembly. If it is more the loader raises an exception. I already have Enable String Pooling (/GF). I have alot of code like: static char *pSTRING_ONE = "STRING_ONE"; if I compile witha macro su...

MFC CWnd::CreateEx throws exception when the project is DLL, but runnig fine when exe

I have a C++ gui application(MFC). I have made it dll and used its functionality from my C# windows exe application. Surely I'm not showing any window that previously were shown from C++ application. For the following line i'm getting the error Error: "Microsoft Visual C++ Debug Library... Debug Assertion Failed!... afxwin1.inl Line:2...

how to set printer quality to "best" mode?

if i set printer quality = DMRES_HIGH then also it printing in normal mode. ...

Cascading specific windows in a MFC MDI application

A MDIParent Wnd has many MDIchild Wnds, and also few child dialogs. Dialogs are created this way --- CAutoDlg *pDlg = new CAutoDlg; pDlg->Create(IDD_AUTOCARD,this); I want to cascade only a specific type of dialogs, say dialogs of CAutoDlg type only. If i give MDICascade() it cascades all the child windows and dialogs under the MD...

SendMessage WM_LBUTTONDOWN/UP works on buttons but not window

I am trying to send some simple mouse down/up messages to Windows Calculator using SendMessage. I have been able to press the buttons by sending the messages to the buttons directly. However, I have not been able to successfully send the same messages to the main calculator window handle. Given that hWnd is the window handle to calculato...

Is it safe to return local CStringW to the caller?

I have a function defined a local variable typed in CStringW, is it safe to return this object to the caller by value, not by reference? ...

Saving data to Excel/PDF from VC++ MFC application

I have written an ERP application wherein the user wants to save few reports directly to Excel and PDF. Right now I'm displaying the reports in List Control, which has to be saved to spreadsheet or PDF. I've written the application in VC++ MFC with Visual Studio 2005. Please help me how to do this. ...

Message map macros

When do you use ON_COMMAND and when do we use ON_MESSAGE. What are the differences between them. ...

HTTP Chunked Transfer Coding and MFC

I have a Proprietery Client-Server application written in MFC. No clients other then my client is going to communicate with the server . For safetly reason , we are using HTTP. Until know , we used content-length to describe the client where the response body ends. Now we are having a situation where the length isn't known in advance an...

how to resize another window not belong to my program by using MFC?

I need write a program to resize other program's windows, what I know is their HWND, How can I do it? I'm trying this: CWnd *pWnd = CWnd::FromHandle(handle); pWnd->MoveWindow(x,y,w,h); ...

afx_msg term in message handler functions

Why afx_msg is used in message handler function declarations? ...

How to set a CMFCPropertyListCtrl's column width?

I'm adding properties to an object of type CMFCPropertyGridCtrl like this: myPropertyListCtrl.AddProperty( new CMFCPropertyGridProperty( _T("Name"), foo.GetName()) ); The result is that only the second column is visible but not the first that should contain "Name". I found CMFCPropertyGridCtrl::GetPropertyColumnW...

How do I use TCHAR* Provided in Cmd Line Argument in Switch Statement?

Here's what I've got: switch(argv[0]) { case "-test1": AfxBeginThread(method1, 0); break; case "-test2": AfxBeginThread(method2, 0); break; case "-test3": AfxBeginThread(method3, 0); break; default: AfxBeginThread(method1, 0); break; } I'm using windows so the arguments come into the array as TCHAR*'s. What do I...

Does MinGW support MFC?

Hi, I have developed WinAPI applications using MinGW without problems. Now, can I do the same with MFC? ...

Programmatically set Pages per Sheet (N-Up) option when printing in Windows

I need a good way to programmatically set the Pages per Sheet setting when printing. I know that a user can select this option via a printer settings dialog and that I could make such a dialog display if I wanted to. But in the context of the program I'm working on, I need this to be selected by the software itself without requiring to ...

Diff function on two arrays, in c++/mfc/stl?

Diff function on two arrays (or how to turn Old into New) Example One[]={2,3,4,5,6,7} Two[]={1,2,3,5,5,5,9} Example Result Diff: insert 1 into One[0], One[]={1,2,3,4,5,6,7} Diff: delete 4 from One[3], One[]={1,2,3,5,6,7} Diff: modify 6 into 5 in One[4], One[]={1,2,3,5,5,7} Diff: modify 7 into 5 in One[5], One[]={1,2,3,5,5,5} Diff: app...

VC++ 6.0 MFC - Problem using Macro defined in <WINSER.H>

Hello there, I am facing a weird problem. I have got a file called in which I am using a macro called "WM_USER", the macro is defined in another header file called . Now the problem is that when I am using the macro in the compiler doesn't recognize it. Its not the case that I haven't included , because earlier I wasn't having any prob...

"String data, right truncation" warning on a select statement

I am upscaling an access 2003 database to SQL Server Express 2008. The tables appear to be created ok and the data looks ok. I have an MFC application that connects to this database. It worked fine connecting to access, but when I connect to SQL Server I am getting the following error on a select statement. DBMS: Microsoft SQL Server...

Does LVS_EX_FULLROWSELECT have any compatibility issues with other styles?

I am trying to set the LVS_EX_FULLROWSELECT style on my grid list control as I want full row selection. However apparently it doesn't have any effect. Since I am using a number of other styles as well, I am wondering if LVS_EX_FULLROWSELECT has any compatibility issues with other styles. Anyone? Following are the styles I am setting. In...