mfc

ComboBox changes text when dropped down

I have ComboBox (DropDown one) with 2 items in it ("One", "Onion"). When I type 'on' in combo and push dropdown arrow then the text i wrote automatically changes (item "One" is highlighted in list and text changes to "One"). How to prevent it? ...

Working with sockets in MFC

I'm trying to make a MFC application(client) that connects to a server on ("localhost",port 1234), the server replies to the client and the client reads from the server's response. The server is able to receive the data from the client and it sends the reply back to the socket from where it received it, but I am unable to read the reply...

Client Server Communication Using Sockets

What's the easiest way to send a message to a server and read the response it gives you in a non-blocking way ? (using sockets and mfc maybe) ...

By knowing VC++ MFC, how easy or difficult is to learn C#.Net?

Right now, I'm more into design & maintenance of MFC based application. I'm seeing good progress and requirement for C#.Net application. With this background knowledge, how easy or difficult is to learn C#.Net? Is there any tutorials available online that helps MFC developers to easily learn C#.Net quickly? Any help on this much apprec...

RC2135 file not found error

Hi, I manually added code fro a new dialog box in my .rc file and I have started getting this error. error RC2135: file not found: 0 I don't understand this error as it is not specifying any filename. Any help is appreciated. Thanks, SG ...

How to create an INI file with an empty section?

I want to write a *.ini file in MFC. I know those typical methods with section names, key names and key values. I`m wondering how to write a ini file which contains only a section name, an ini file like below: ... [section] ... I tried the function WritePrivateProfileString() with two NULL parameters; I thought it would work but fail...

MFC: Best way to get text from a CRichEdit?

I've got a CRichEdit that I need to get the text from. What is the best way to do that? GETTEXTEX? StreamOut? If I go the StreamOut approach, what would my callback look like? ...

Changing a dialog's style at creation to override what's in the .RC template

I have a little dialog I created using Resource Editor in VS2005. It's going to be used as a child dialog of another dialog, in 2 different ways... either as a child which sits on top of the dialog like a custom control, or as a popup which can move beyond the boundaries of the parent window. If I modify a single style in the RC file, bo...

Visual C++: Invalid allocation size. How to force the debugger to stop on this message?

The MFC program I am debugging is printing this message in the "Output" window in Visual Studio 9.0: HEAP[AppName.exe]: Invalid allocation size - 99999998 (exceeded 7ffdefff) I'm pretty sure this is due to a bad "new", uninitialized variable or similar error. The question is: how do I get the debugger to stop on this message so that ...

Is there a way find out which second event will happen in MFC

Hello, I stumbled upon a curious problem with MFC. I have a Dialog where I check every Edit field on ON_EN_KILLFOCUS if it's valid. If validation doesn't go through I set focus back and show error message. This would be fine, if only I would close the dialog. I mean if I leave wrongly entered field and press close button or X, then ON_E...

MFC: Deleting dynamically created CWnd objects

Lets say in a dialog, we dynamically create a variable number of CWnds... like creating a and registering a CButton every time the user does something/ Some pseudo-code... class CMyDlg : public CDialog { vector<CWnd *> windows; void onClick() { CButton *pButton = new CButton(...); //do other stuff like position it here window...

Convert C++/MFC from visual studio.net 2002 to visual studio 2010

We will convert a number of programs written in C++ and MFC in Visual Studio.NET 2002 to Visual Studio 2010. What problems can we expect to encounter? What changes are there in the libraries that are worth knowing? ...

How to tell if a MFC Dialog has been created/initialized?

I have an OnMove handler in my dialog class, which does some stuff with control objects (i.e a CButton). I'm finding this handler gets called before the dialog OnInitDialog method is called, and hence when I try to call methods on the child controls, I get ASSERTS in debug as the controls don't yet exist... they are created in OnInitDial...

mfc socket onreceive is not called

I am making a project in VC++ using mfc. I'm connecting to a server, sending a notification message like "user blabla" and start awaiting messages from that server. The server receives the initial message and responds with a message but the onReceive method isn't called on the client. The client is receiving the message because when I ca...

Migrating a big project in MFC from Visual C++ 6.0 to Visual Studio 2005

I am maintaining a big project (~250k loc, not counting code generated from idl) in Visual C++ 6.0, that uses Visibroker (VB for short) 5.2.1 (which is a CORBA implementation from Borland). Recently, the other module that communicates with my project was upgraded to VB 8.0 and I got a bunch of incompatibility issues. Since VB 5.2.1 is no...

how to omit extra bits in a file?

I want to omit extra bit in txt file.eg ....ÿ 0111111110111101100011011010010001 in this string we want to omit extra bit ÿ which is appeared when we save a binary string. Save fun is as follow. please help me. void LFSR_ECDlg::Onsave() { this->UpdateData(); CFile bitstream; char strFilter[] = { "Stream Records (*.mpl)|...

UNICODE Names From Character.

Hi, Can anyone tell me how to get the Unicode name of a character in MFC. e.g. - Character - Name Z - LATIN CAPITAL LETTER Z [ - LEFT SQUARE BRACKET etc. Thanks, Dev ...

How do you send a named pipe string from umnanaged to managed code space?

I appear to have a named pipes 101 issue. I have a very simple set up to connect a simplex named pipe transmitting from a C++ unmanaged app to a C# managed app. The pipe connects, but I cannot send a "message" through the pipe unless I close the handle which appears to flush the buffer and pass the message through. It's like the message ...

bitmap button not displaying in 3D style

Hi, I want to display on my dialog, a bitmap button. I am using the below code CImage image; hr = image.Load(_T("myimage.png")); // just change extension to load jpg bitmap.Attach(image.Detach()); m_button.ModifyStyle(0,BS_BITMAP); m_button.SetBitmap(bitmap); This way bitmap is correctly displayed on button, but the button is not dis...

Can a custom MFC window/dialog be a class template instantiation?

There's a bunch of special macros that MFC uses when creating dialogs, and in my quick tests I'm getting weird errors trying to compile a template dialog class. Is this likely to be a big pain to achieve? Here's what I tried: MyDlg.h template <class W> class CMyDlg : public CDialog { typedef CDialog super; DECLARE_DYNAMIC(CMyD...