mfc

Can I change the height of a specified window's caption bar?

I want to self-draw the caption bar of my application's window, so I decided to override OnNcPaint() methods. But I don't know how to set a different height of the caption bar. Everytime I use GetSystemMetrics(SM_CYCAPTION), it retruns the same value. Can anyone tell me how to do it? Thank you! ...

c++ network credentials

Hi, I have web service in my MFC Application and I want to write something like: WebService * ws = new WebService(); ws->Credentials = new NetworkCredentials(user, pass); I could not find Credentials class in MFC. Is there such class in MFC? ...

What is the proper way to cast from an 'OLE_HANDLE' to an 'HICON'?

What is the proper way to cast from an 'OLE_HANDLE' to an 'HICON' for an x64 target build? In particular with a normal C-Style cast, I get this warning when compiling with an x64 config: warning C4312: 'type cast' : conversion from 'OLE_HANDLE' to 'HICON' of greater size Here is the offending code: imgList.Add((HICON)ohIcon); The a...

Avoiding "(Not Responding)" label in windows while processing lots of data in one lump

I occasionally need to process a large amount of data from one package off the network, which takes sufficiently long that when the user tries to interact with the application windows adds the "(Not Responding)" string to the window title. I am aware this is because the processing is being done within a call to handle a message (some way...

Alternative to CString::Format?

Is there any better alternative for doing string formatting in VC6, with syntax checking before substitution? ...

Can I change the thickness of the border of a window with MFC?

Normally, the thickness of a window is 4 pixels, which can be retrieved by GetSystemMetrics method. Can I change its value, for example 2 pixels? Thank you very much! ...

Can I draw a menu (not popup menu) in any rectangular region of a window with MFC?

I override OnNcPaint() method along with OnNcLButtonDown() and OnNcMouseMove() and OnNcHitTest() method. So the original menu of the window doesn't exist. I want to add a menu with the area of the caption bar. How can I do this? Thank you very much! ...

Hiding a menu item in MFC

How can I hide a menu item under certain conditions in MFC? I'm not interested in just graying it out. ...

CFileImageLoader(LPCTSTR lpszFileName);

I have a class which expects a LPCTSTR. When i call : new CFileImageLoader(_T("Splash02.png")) OR new CFileImageLoader("Splash02.png") both don't work. Why ? I'm new to cpp... Thanks Jonathan d. ...

MFC and STL

Would you mix MFC with STL? Why? ...

CEditView not showing text

I have a view which is derived from CEditView. It is read only. I would like to set the text as a kind of logging, but nothing shows up on the screen. If I inspect temp in the debugger after GetEditCtrl().GetWindowText(temp); I can see that the text is indeed changing internally, but I see nothing on the screen. // HistoryView.cpp : ...

Does overriding OnNcPaint() affect the painting of the client area of a window?

I want to change the appearance of a window's caption bar, so I decided to override the OnNcPaint() method of CMainFrame. But when I did this, I found a problem. If there is another window covering my window, and I drag the window quickly, the content of the client area of my window disappeared, which came to sight only when I stopped th...

How to remove the border of the client area of a window?

I don't want the border of a window's client area to be seen. Is there any way to remove them? The window is a SDI(Single Document) window. I also noticed that the border appeares only on the top and left side of the client area (no on the right and bottom). I was very confused. Thank you very much! ...

How to change the size of view according to mainframe in SDI framework?

I want to set the size of view according to the size of the mainframe in a SDI framework. That is to say when I change the size of mainframe, the size of view changes accordingly, so does the client area. How can I do this? Thank you ...

MFC vs. CLR?

In a visual studio C++ project, would MFC be faster than using the CLR? I'd specificily be using 2008. Oh and the reason I ask is because I have experience with .NET but not so much with MFC. I understand what MFC is but have never really used it much. ...

Is it feasible to convert a desktop based MFC C++ application to a web app

I have a very large app, 1.5 million lines of C++, which is currently MFC based using the Document/View architecture. The application includes a lot of 3d vector graphics, spreadsheets, and very many dialogs and Windows. Within the constraints of the DVA it is fairly well written, in that there is no significant program logic in the us...

CDialog not closing when two buttons mapped

Visual Studio 2005, C++, Windows XP. I have a CDialog with a single button, which calls a function like so: BEGIN_MESSAGE_MAP(Foo, BaseDlg) //BaseDlg inherits from CDialog ON_BN_CLICKED(IDBAR, Bar) END_MESSAGE_MAP() The dialog box closes when its 'X' is clicked. I change the above code to: BEGIN_MESSAGE_MAP(Foo, BaseDlg) //BaseD...

Reduce windows executable size

I have a C++/MFC app on windows - dynamically linked it's only 60kb static it's > 3Mb. It is a being distributed to customers by email and so needs to be as small as possible. It statically links the MFC and MSCVRT libraries - because it is a fix to some problems and I don't want more support calls about missing libs - especially the...

How to create a compeletely transparent window with MFC?

I want to create a completely transparent window with MFC, but I don't know how to do this. Can you tell me the way? Thank you very much! ...

UTF-8 From File to TextBox VC++ 6.0

How do I get an old VC++ 6.0 MFC program to read and display UTF8 in a TextBox or MessageBox? Preferably without breaking any of the file reading and displaying that is currently written in there (fairly substantial). I read a line into CString strStr, then used this code: int nLengthNeeded = MultiByteToWideChar(CP_UTF8,0,strStr,1024,...