mfc

Invalidate() debug assertion failed message (MFC, VC++)

I've made a custom control, and when I want it to repaint on the screen I call Invalidate(), and afterwards UpdateWindow(), but i get message: debug assertion failed for a file afxwin2.inl in line 150 which is: AFXWIN_INLINE void CWnd::Invalidate(BOOL bErase) { ASSERT(::IsWindow(m_hWnd)); ::InvalidateRect(m_hWnd, NULL, bErase); } ...

Keyboard Interop in MFC - DELETE key not working

Hi, Im using C# Dll in MFC.So for keyboard entering.I didnt get any alphabets.So i add this follwing code. BOOL CToolTab::PreTranslateMessage(MSG* pMsg) { return System::Windows::Interop::ComponentDispatcher::RaiseThreadMessage( *reinterpret_cast<System::Windows::Interop::MSG*>(pMsg)); } By this code i get my wo...

Trace the function implemented by DeviceioControl

I am working with a WinCE device which has a radio manager driver written for it in MFC. In the code for the Radio GUI, I can see the function Deviceiocontrol with a specific IOCTL being called. However, I'm unable to trace the particular piece of code called by this function. Can someone tell me how Deviceiocontrol works? ...

Redirect stdout and stderr on microsoft visual studio

I am using microsoft visual studio to do C++. I don't see std::err and std::out in the output console of the IDE. Is there a way to redirect them ? ...

TextOut()- right aligned in MFC

Hi,In my vew class.Im drawing one rect and im displaying numbers in right side of corner. Like 10.00 20.00 .... Like this.When the number is like more than five digits,then half then number get out of Rect. Like 20.00| 20000|.00 500.0|0 Here '|' shows the rightside of rect.So i want to align the Numbers in Right Align,It should loo...

new operator in DllMain of MFC Extension Dll

Hi, Dll best practices document from Microsoft available Here recommends avoiding use of memory management function from the dynamic C Run-Time (CRT) within DllMain. But DllMain function of MFC Extension DLL is dynamically allocating the memory for CDynLinkLibrary in the code snippet available at MSDN "http://msdn.microsoft.com/en-us/li...

Not able to copypaste using SetClipboardData in MFC?

I'am using the below code to copy paste..but it doesnt copy the whole context it just copies couple of letters and leave the rest of all as junk value..if I use char* to get the data buffer and change the project settings to Multi byte support...it will work..but then i loose to support the unicode formats and I also tried using CF_UNICO...

What's the difference between CArray<int, int> and CArray<int, int&> ?

Same for CMap, CList, and pretty much everything that uses templates (I guess). I find it a bit hard to understand when to use which. It's true that for classes and such, the <class, class&> form is usually what you want, but for basic types like int, float, etc., which form is preferred? ...

Accessing MFC classes inside ATL project in VC++ 2008

I have created an ATL Project with all default options using VC++ 2008. I have added Simple ATL object (interface IDemo) and some interface moethos inside the simple object. I want to use MFC classes (e.g. CDatabase, CRecordset and lots more) inside my ATL project. How can I achieve this? ...

Accessing a dialog from Another dialog MFC

Hi, I want to open a separate dialog box when I cllick on a button on my main dialog. I used separateDialog.DoModal() to do it. It open successfully but when I try to add data to a edit control (text box) in that seperate dialog, a debug assertion failure occurs. What is the matter and how can I overcome it? This is what I did: void C...

Screen capture of MDI app with OpenGL graphics using MFC

In our MDI application - which is written in MFC - we have a function to save a screenshot of the MDI client area to file. We are currently doing a BitBlt from the screen into a bitmap, which is then saved. The problem is that some of the MDI child windows have their content rendered by OpenGL, and in the destination bitmap these areas s...

win7 + vc7.1 + mfc = stackoverflow

Hello! I've moved my vc7.1 project from WInXP to Win7. After rebuilding i got stackoverflow error in function _malloc_dbg when i start the program. "Unhandled exception at 0x0051bf0f in XXX.exe: 0xC00000FD: Stack overflow." ---------------------- Call stack: > msvcr71d.dll!_malloc_dbg(unsigned int nSize=140, int nBlockUse=2, const cha...

CDateTimeCtrl - preventing 'focus' change when setting date

I'd like to use a CDateTimeCtrl to allow the user to select a non-weekend date. So, if the user increments the day (via a keypress) - and the resulting day is found to fall on a weekend - then the control should skip forward to the following Monday (don't let issues about month changes distract you, it's not relevant). Usually it's not ...

HTTPS and C++ - Not an easy match?

I need to access a HTTPS protected website (HTML or XML) from an C++ MFC application and I would like an easy solution. But I did a little research and it's seems to me HTTPS and C++ don't play nice and easy together. Is there any recommended class library for HTTPS web access? Should be easy to use and not too expensive. ...

How to write string from EditControl to a text file in Visual Studio 2008 , using the "Save To.." dialog ?

I'm writing my first app in MFC, and I was looking to include a very simple feature : Include a "Save To File" button that on being clicked will bring up the familiar "Save As.." Dialog box and will ultimately save the data in a text file. I couldn't find how to invoke this dialog box - can someone just point me at the right way to do i...

How to implement a FIFO listcontrol in MFC ?

I need to implement a list control using MFC with the number of lines being fixed. It should Use FIFO with the number of lines being a fixed number. Is there an inbuilt option to this? Or a programmable method. ...

Is there a Designer for MFC in Visual Studio like for windows forms in .NET?

I'm a .NET programmer. I've never developed anything in MFC. Currently I had to write a C++ application (console) for some image processing task. I finished writing it. But the point is I need to design GUI also for this. Well, there won't be anything complex. Just a window with few Buttons, RadioButtons, Check Boxes, PicturesBox & few s...

Paste or Drop, copy data and release source?

I have an MFC DocView SDI App that receives data from either the clipboard or drag and drop. The data is in either CF_HDROP or CF_TEXT format. I have a COleDropTarget derived CMyDropTarget member m_dropTarget of my CMainFrame class. I have two member functions of CMyDropTarget; OnDrop(...) and OnPaste() which each call another member fun...

Limiting the number of entries in a list control MFC

Hi, I need to limit the entries that appear in my list control since two much entries make my MFC program slow. Is there a way to show only the last few entries (say for an example the most recent 100 entries) in a list control??? Thank You!!! ...

Using a variable in a mysql query, in a C++ MFC program.

Hi, after extensive trawling of the internet I still havent found any solution for this problem. I`m writing a small C++ app that connects to an online database and outputs the data in a listbox. I need to enable a search function using an edit box, but I cant get the query to work while using a variable. My code is: res = mysql_perf...