mfc

Screen Pixel Resolution in mm

Is it possible to get the screen pixel resolution in mm using Win32 APIs ? I have an application which is showing 0.3472222222222222 as the value for this on my 1280x1024 monitor with 96 dpi . But I am not able to find out how it got this value. Any clues will be helpful. I can use MFC also if required. EDIT Sorry for the confusion, the...

How to check if a subfile exists in a chm file?

I have a number of CHM files, and each of the files is a comressed html for 5 different Html files. I mean, lets say I have 5 different files named Alpha, Beta, Gamma, Delta, Theta. Say, I compress these 5 in a CHM file. Lets call that file CompressedHtm.CHM. I have >500 of these files. Now I want to check if all of these >500 files hav...

How to check if a link exists or not in VC++?

I have a link. I have checked that the link is a valid URL through regular expressions. Now, I want to check if the link is a valid http link or not. i.e. it should not be a non-existing link. Is there a way in VC++ 6.0 (MFC) to check that? ...

image processing in vc++ using MFC

I want to perform the following artistic effect with my MFC app. Can anyone tell me, how to perform it ? Input Image : Output Image : Waiting for the reply... Thanks in advance... ...

MFC: Floating toolbar window not visible (WS_EX_TOOLWINDOW)

In a typical MFC C++ dialog, I want to dynamically create a floating ListBox (or other standard control) over the dialog, possible extending past the dialog's boundaries - so it can't be a simple child or it'll be clipped. Looking at something similar that works, I tried to achieve it but the window never appears when shown. In my .h f...

How to add MFC support to existing Win32 C++ Project?

Hi, I am creating a C++ application which uses Qt to create the GUI. However, I need to use a third party library which relies on MFC (for CString's, etc). Is there anyway to add MFC to my application to allow me to use this library or do I need to rewrite it myself? I saw this question, but it doesn't tell me how to add MFC manually t...

How to replace a string between two substrings in a string in VC++/MFC?

Say I have a CString object strMain="AAAABBCCCCCCDDBBCCCCCCDDDAA"; I also have two smaller strings, say strSmall1="BB"; strSmall2="DD"; Now, I want to replace all occurence of strings which occur between strSmall1("BB") and strSmall2("DD") in strMain, with say "KKKKKKK" Is there a way to do it without Regex. I cannot use regex as adding...

Singleton MFC extension DLL

Hi. I declare a singleton on a MFC extension DLL, like this: //header file: SingleTon.h class AFX_EXT_CLASS CMySingleton { public: static CMySingleton* Instance() { if(!singleton) singleton = new CMySingleton(); return singleton; } int a; // Other non-static member functions private: CMySingleton() {}; ...

The legacy device context is too coarse.

Hi. I have a Process Control system. It has a huge 2D workspace where all the logic is laid out. The 2D workspace is a coordinate system. You usually do not see the whole workspace at once, but rather some in-zoomed part of it focusing on some part of the controlled process. Such subsystem views are bookmarked into predefined named ima...

Not receiving WM_PAINT message when returning from Security Screen (Ctrl+Alt+Del) in Windows7

I need to detect the closing of the security screen, this is the full screen that appears when a user presses Ctrl+Alt+Del under windows. In Xp my application receives an wm_paint message when this screen is closed but under windows 7, a message is not always received, maybe only 25% of the time. I tried catching the the WM_WTSSESSION...

CLR equivalent to MFC CStringList

Hey. I'm trying to get this code http://www.codeguru.com/Cpp/W-P/files/inifiles/article.php/c4455/#more to compile under a CLR WinForms app I'm making. But what is the right syntax? A CString under CLR is to be written System::String but what about CStringList? (I figure it's a string array) ...

DoModal() asserts at very first line

I have an MFC dialog based application created inside Visual Studio 2008. CCalendarWindowDlg dlg; m_pMainWnd = &dlg; INT_PTR nResponse = dlg.DoModal(); When I run the application, DoModal() asserts at very first line INT_PTR CDialog::DoModal() { // can be constructed with a resource template or InitModalIndirect ASSERT(m_lpsz...

File preview component (C++/MFC)

Is anyone aware of a good, general purpose file preview component for MFC/C++ desktop applications? Specifically, I'm looking for a component that I could embed in my application that would allow a broad range of file types (text files, multimedia, etc.) to be previewed without the need for original applications (such as MS Word, etc.) ...

What is private MFC and why are they not accessible through the normal interface ?

I am using MFC for gui development and I stumbled upon a function that could be useful for what I'm trying to do. The function is _AfxCompareClassName. However, it is included in the file "afximpl.h" which is located in the directory "VC/altmfc/src/mfc/afximpl.h". Normal mfc includes are in the directory "VC/atlmfc/include". Now from wh...

how to add bitmap image to buttons in MFC?

hello frnds, I am Trying to add an image to an existing button..I have done that to an extent, the problem is I can add an ownerdrawn Image but am not able to add the extact image that I want.. for the example see the below code CButton* pBtn= (CButton*)GetDlgItem(ID_WIZBACK); pBtn->ModifyStyle( 0, BS_ICON ); HICON h...

Suggestion for Grid for MFC SDI application

Currently we are using Xtreme Toolkit Pro Grid control with virtualization support for our application to show the contents in Grid. Is there any other better software which can be easily used as Grid without much changes in the application. Also can I able to achieve the full use of Grid in CMFCPropertyGridCtrl which is present in MFC...

VC++ 6.0: Why is CASyncSocket::GetLastError() causing an access violation?

I'm using Visual C++ 6.0. I'm not sure of the service pack level of the visual studio installation, but the OS is Win 2K SP4. The failing code is part of a DLL. Here's the code: EIO::OpenConnection() { m_Client = new CSocket(); if(m_Client->Create() == 0) { delete m_Client; m_Client = NULL; return CAs...

MFC: Render string in multiple formats

Using a CDC & CDC::DrawText(Ex), I want to render a string with a sub-string in bold e.g: void renderText(CDC *pDC,CString &str,int boldStart,int boldEnd) { ... } example: renderText(pDC,"Test String",0,3) -> Test String example: renderText(pDC,"Test String",5,-1) -> Test String I assume I'll make 3 CDC::DrawText calls, but how do...

Gui Design Help - MFC

Hello, I need to design a Task Manager, not like windows task manager, but a more generic one. like "i should take my kid to school" kind of task. So, i need to design an appropriate scalable gui ? (in the future there might be hundreds of tasks) Can someone suggest a place/app to look at ? in addition, and on related subject : I op...

GetProfileInt() Not Returning Default Value

I'm using GetProfileInt to get key values from the registry. When the location exists, the code works, but when it does not, it returns 0 (and initializes the registry key to 0). Why doesn't this work? Code: SetRegistryKey(_T("MyKey")); int def = 0x1FFF; def = GetProfileInt(_T("Subkey"), _T("KeyWithVal"), def); ...