mfc

What are the possible classes for the OpenThemedata function?

Hi Everybody, I'm trying to call the OpenThemeData (see msdn OpenThemeData) function but I couldn't determine what are the acceptable Class names to be passed in by the "pszClassList" parameter. HTHEME OpenThemeData( HWND hwnd, LPCWSTR pszClassList ); Could anybody tell me what are the acceptable class names that I can pass in...

Searching CStrings in C++

Hi all, I was wondering if there is a native C++ (or STL/Boost) function which will search a CString for a specified string? e.g. CString strIn = "Test number 1"; CString strQuery = "num"; bool fRet = SomeFn(strIn, StrQuery); if( fRet == true ) { // Ok strQuery was found in strIn ... I have found a small number of functions lik...

MFC: Changing the colour of CEdit

Guys, can someone give me a brief run through of how to change the background colour of a CEdit control at runtime? I want to be able to change the background to red if the field is zero length and the normal white otherwise. ...

How can I implement the "tap and hold" behavior in an MFC CListCtrl?

How can I implement the "tap and hold" behavior in an MFC CListCtrl? I have an MFC CListCtrl in a CDialog and I need to add to the CListCtrl the "tap and hold" behavior. That is what I mean for "tap and hold": If the user clicks (a "standard" click with the left button of the mouse) on a CListCtrl item then function A will be called. ...

VC++ MFC edit box sorting

How do I sort the date and time in decending order in edit box? ...

C++/CLI from MFC extension DLL

I have an MFC application that uses several MFC extension DLL's. I want this app (and several other similar apps) to be able to access some parts of the .net framework. I wrote a C# library to do the .net work I want and was hoping to be able to write an MFC dll to hide all the C++/CLI code from my apps. The apps would stay as pure MFC a...

Need ActiveX control to embed Excel into a dialog

I'm building an "import from Excel" function. It has to be in a DLL, called from a non-MFC app. Has to provide an image of the spreadsheet that users can drag a select box around (to select cells), then click an IMPORT button, and have the right thing happen. Having trouble getting the spreadsheet up, having a button adjacent to it, an...

Private and Protected Members : C++

Can someone enlighten me as to the difference between private and protected members in classes? I understand from best practice conventions that variables and functions which are not called outside the class should be made private - but looking at my MFC project, MFC seems to favour protected. Whats the difference and which should I use...

Best XML serialization library for a MFC C++ app

I have an application, written in C++ using MFC and Stingray libraries. The application works with a wide variety of large data types, which are all currently serialized based on MFC Document/View serialize derived functionality. I have also added options for XML serialization based on the Stingray libraries, which implements DOM via t...

Embed image in code, without using resource section or external images

I'm looking for a way to embed an image in a library (Windows-only). I don't want to go the 'traditional' way of putting it in the resources (because of special circumstances that make it not so convenient to mess around with the resource handle. Ideally, there would be something like xpm files: a 'text' representation of an image that ...

True color CImageList

How do I load a true color image into a CImageList? Right now I have mImageList.Create(IDB_IMGLIST_BGTASK, 16, 1, RGB(255,0,255)); Where IDB_IMGLIST_BGTASK is a 64x16 True color image. The ClistCtrl I am using it in shows 16 bpp color. I don't see a Create overload that allows me to specify both the bpp and the resource to load fro...

How could I insert a bitmap or other image objects in a CListCtrl in MFC?

I want to list the thumbnails of a set of photos in a listctrl. But the only way to achieve this is to use the setImageList method to bind a image list to the CListCtrl object and insert items like this: InsertItem (int nItem, LPCTSTR lpszitem, int nImage). I also must modify the listctrl's style by ModifyStyle(LVS_TYPEMASK, LVS_ICON) to...

Can I changed an item's size (width and height) in the CListCtrl?

If don't use owner draw? thanks ...

How to load string of array in to combobox faster in MFC?

I have an array of 1000 strings how to load them in to combo box faster like kind of dumping in to rather than iterating it? And to copy the combo box data to some 10 other combo box? ...

Window Handle and window dimension

The MFC application that i created is dialog based. Just one dialog thats all. How do I get the window handle to this window, while the application is performing the InitDialog. I need to find out its dimension as well. GetForegroundWindow not necessarily gives you the handle to this window that is loading up ...

What message or event is raised which I invoke CListCtrl::InsertItem() method?

I was planning to implememt owner-drawn of CListCtrl. I thought that drawing an item is after the item is inserted into the control. So my method is declare a class which is derived from CListCtrl and override its DrawItem() method. The problem is DrawItem is never invoked after inserting an item. Is there anything wrong with my method? ...

How to change item size and gap between them in Custom Drown CListCtrl

As far as I know ON_WM_MEASUREITEM does not get called in Custom Draw list control. It is only used if control is Owner Drawn. I have found a way to do that, but it is somewhat a HACK and I still can not control gaps between items they are set up somehow automatically. The trick is that you can create CImageList with the unused images of...

Static or dynamic linking the CRT, MFC, ATL, etc.

Back in the 90s when I first started out with MFC I used to dynamically link my apps and shipped the relevant MFC DLLs. This caused me a few issues (DLL hell!) and I switched to statically linking instead - not just for MFC, but for the CRT and ATL. Other than larger EXE files, statically linking has never caused me any problems at all...

Can CListCtrl use OnMeasureItem() method?

I want to change item's height and width according to a slider, but as far as I know, there's no measureitem method as CListBox. How can I fix this? Thank you! ...

How can I change the size of scroll box(thumb) of a CScrollBar?

I can't find any method to change it. Any help will be appreciated! ...