mfc

MFC and Active Document Server - how draw document in container window

I look on the one example source code. This example implement Active Document Server (SDI Window, exe-application). When i trying insert this document in any container (such as MW WORD, or IE) , comtainer open additional window and place documant in it. I want draw document inside container window. How i can make it? Probably should i re...

DLGTEMPLATE to CWnd-derived control

Is it possible to take a DLGTEMPLATE and use it as a CWnd-derived control for placing in any other CWnd? I have a dialog template that I want to use on one of my CDockablePanes ...

How to SetFocus to a CButton so that the border and focus dotted line are visible?

I created a simple dialog-based application, and in the default CDialog added three buttons (by drag-and-dropping them) using the Visual Studio editor. The default OK and Cancel buttons are there too. I want to set the focus to button 1 when I click button 3. I set the property Flat to true in the properties for muy buttons. I coded...

SSL Socket in Windows. Library? Synchronous/Asynchronous? Threads?

Hello I have a 2 threads application. One GUI thread and one worker thread (CWinThread) in which I make time consuming operations - calculations and HTTP comunication. I have to switch from HTTP to SSL socket connection. I also need to make a verification of server certificate (is it trusted, is it expired, is it revoked) Which libr...

MFC Edit Box - Multiple Characters per Keystroke?

I am trying to create a simple dialog in MFC using Visual C++. My problem is that when I get the dialog on the screen and try to type in an Edit Box field, if I type the letter 'a' once, it appears in the edit box as 'aaaaaaaaaaa' (that's 12 a's). Furthermore, if I try to navigate around in the box using the arrow keys, the carat moves...

CStringList in MFC

Hi, I was coding with 2 CStringList objects. Each has its own data, for eg one has name and other the phoneno, and both are in sync, i.e, if there is a phoneno there is a name and viceversa. Now, i have 2 combobox in which i show the names and the respective phonenos. The name combobox is sorted, hence the sync between the two goes fo...

Not getting all windows messages in MFC ActiveX Composite Control

Hi, I have a composite control with a declaration like this: class ATL_NO_VTABLE CFooCtrl : public CComObjectRootEx<CComSingleThreadModel>, public IDispatchImpl<CFooCtrl, &IID_IFooCtrl, &LIBID_FooLib>, public CComCompositeControl<CFooCtrl>, public IPersistStreamIni...

Dynamically resizing CMFCPropertySheet with PropSheetLook_OneNoteTabs style

Hi everybody, I'm trying to resize dynamically a CMFCPropertySheet to add a custom control at the bottom of each page. As all Property Pages are not of the same height, I have a mechanism to increase the size if necessary. For this, I have overridden the OnActivatePage method and by using SetWindowPos, I can resize the sheet, first, then...

How to speak SSL from a Windows MFC client?

Hi, I've an MFC application that currently uses CAtlHttpClient to query a web server for some information. I'd like to change this so that the query goes over securely, with server authentication, using SSL. Googling reveals that Microsoft has changed the way they support this several times, e.g., WinInet, WinHTTP, but for the life of...

Iterate through the items of an MFC CComboBox

I need to iterate through the items (strings) in a CComboBox to check which string is the longest. How can I get each item in the list? ...

CVSListBox notification after delete

I've just added one of the new (MFC Feature Pack) CVSListBox controls to a project. The list of items in the control is tracked by some other objects in my application, so I need to take lots of notifications from the list-box when anything changes so that I can update other stuff. For those that don't know the control, there is a butt...

MFC SetRegistryKey... Is there a GetRegistryKey function?

I have these two lines of code. CString strHost = AfxGetApp()->GetProfileString(_T("WebServices"), _T("Server")); AfxMessageBox(strHost); Nowhere in the app do I set the value. (the installer does that). So the strHost, should be the same no matter where or when this line is run. Here's what I've got. Press A -> run function that ...

Safe to use the compiler generated assignment operator?

I'm using the CPoint class from MFC. There is no explicitly defined assignment operator or copy constructor (AFAIK). Yet, this works: CPoint p1(1, 2), p2; p2 = p1; // p2 now is equal to p1 I'm assuming this is working automagically because of a compiler generated assignment operator. Correct? If so, can I be confident that this isn'...

How to apply Test Driven development for GUI application(VC MFC)?

Can I use TDD for gui application? How to do it. ...

Question about Modeless Dialog in MFC

I have a question about modeless dialog, I want to show an dialog on the screen, then it will display some information in it. However if I used the following way, it has some problems: function() { showdialog(XXX). //heavy work. update the dialog.. //heavy work. update the dialog... } it seems the dialog displayed ,but it do not draw a...

How can I check to see if system is in standby mode?

Hello, I'd like to check if the system is in standby mode, is there any Win32 API for that? I'm not sure if it's the same as the sleep mode. There's some code that gets executed in my app, which causes it to hang when coming out of standby (it's executed during the standby mode), so I'd like to avoid running that code when the computer...

OwnerDrawn control in MFC

Hi, I am creating a MFC application in which there is a skin library which handles the UI effect of rendering the controls (it gets called in oninitdialog). But, meanwhile, I have also the requirement of displaying an icon on the buttons. For this, I am marking the buttons as ownerdrawn=true, and able to display icon, but in this case,...

What message is processed during the process of minimize or maximize of a window?

I want to self-draw the title bar of a window with MFC. So I override the OnNcPaint() method of CMainFrame. Everything seems alright, until I click the item in the control menu to make it minimize or maximize. During the minizing or maximizing process, I can see the original title bar appeared. I don't know why this happened. Maybe there...

How to change pane text of status bar from a thread in MFC?

I have a dialog in MFC with a CStatusBar. In a separate thread, I want to change the pane text of status bar. However MFC complains with asserts? How is it done? An example code would be great. ...

What's with the "Afx" in StdAfx.h?

I'm just curious what Afx stands for. And what about Fx in FxCop? ...