mfc

Catching ON_CBN_SELCHANGE and other dropdown events when extending CFileDialog

I am trying to create a custom file save dialog for XP using C++/VS2008. My dialog will have three dropdowns and an edit box. I need the contents of the dropdowns to dynamically update when selections are made on other dropdowns. Hence, my need to catch the CBN_ events. I've created a class that extends CFileDialog and a class that exte...

CAsyncSocket and threading

I'm using a MFC CAsyncSocket to do some network communication in a multi-threaded environment. After several hours of trying to get the accepted sockets to accept incoming data I came across a page that states that for a CAsyncSocket's OnReceive function to be called the socket has to be in the context of the main GUI thread. Moving it...

problem with IHTMLDocument2::write()

I am trying to create an mshtml document object from an html buffer. But when the following code is executed it is invoking internet explorer window. How do I prevent it invoking IE. #include <atlbase.h> #include <mshtml.h> CoInitialize(NULL); CString strHTMLCode = _T("<html><head><script language=\"JavaScript\">{top.location.href=\"...

Why can't I get my CDatabase object to understand my Data Source Name?

I'm using the MFC class CDatabase. To establish a connection to SQL Server, I'm calling OpenEx() with a connection string. My problem is that the object seems unable to interpret the DSN part of the string. The connection string looks like this: ODBC;DSN=mySystemDSN;UID=myUsername;WSID=myMachineName;DATABASE=myDatabaseName;Trusted_C...

How can you make buttons on a MSVS C++ CToolBar larger along with their images?

We have a touch screen, and the toolbar is too small to hit with my meaty fingers. Is there an easy way I can have an option to make the toolbar buttons bigger and easier to hit? So far I've attempted a few things: m_toolbar.SetSizes( CSize(64,64), CSize(50,50) ); m_toolbar.SetSizes( CSize(64,64), CSize(50,50) ); m_toolbar.GetToolBarC...

Timer message in MFC/Win32

I was just trying the SetTimer method in Win32 with some low values such as 10ms as the timeout period. I calculated the time it took to get 500 timer events and expected it to be around 5 seconds. Surprisingly I found that it is taking about 7.5 seconds to get these many events which means that it is timing out at about 16ms. Is there a...

How to programmatically check Internet bandwidth in VC++?

I need to find the bandwidth available at a particular time. The code must be developed in Visual C++ or in .Net family . If anyone knows how, please help me out. ...

how to build a vc++ file in commandline

How to build a Project developed in VC++ in command line i am not visual studio(2003or 2005 or 2008) ...

System Idle Time calculation using vc++

I need to get the sytem idle time.It must be developed in vc++ and the code should not use hooks is there any possible way of getting SystemIdleTime from taskmanager ...

Getting Default browser

How can i which is the default browser in my system programatically. the codes must be developed using vc++ Is there any API for this Where in the registry is the default browser value changed can somebody help me out. ...

Visual C++: How to get the CPU time?

How can I programatically find the CPU time which is displayed in System Idle Process (in Task Manager) using Visual C++? ...

Difference between DECLARE_DYNAMIC and DECLARE_DYNCREATE?

Could you please let me know what is difference between DECLARE_DYNAMIC and DECLARE_DYNCREATE? Where exactly we can use them? ...

CoInitializeEx fails when calling OpenCV method cvLoadImage()

Hello, I am trying to integrate some OpenCV functionality into my application. Currently I have code set up with DirectShow to get a video feed from my camera, which is then showed in an MFC window. This code cannot be changed or removed. The code runs completely fine, but regardless of the location i place the following line of code...

Date project in vcpp

In VC++ 6.0 MFC application i am trying to Display date in Shot Format eg;05-10-09 but it will print 05-10-2009 Here is the code i written SYSTEMTIME st; GetSystemTime(&st); CString str; str.Format("%02d-%02d-%02d",st.wDay,st.wMonth,st.wYear); m_date=m_date + str; I will get output say eg: 05-10-2009, but i want in this format 05-10-...

How do I put strings into stringtables in MFC?

I'm trying to localize a large MFC project where all the strings are hard-coded into the source code. (It was the easiest thing to do at the time, back before we had any idea we'd expand into other markets.) I've looked at localization tools, and invariably they say to put all the strings into the .rc file first, or just assume it has ...

Column selection in ListView (MFC)

I want to select a particular column in a ListView. When I search for it I always find ways to select row-wise only. Any idea how do I do it? Also how do I get the selected column index? Using MFC-VS2005. ...

CEdit numeric validation event C++ MFC

Hi, I have a CEdit text box which is a part of a property pane and only allows numeric values (positive integers). The box works fine when people enter non-numeric values, but when they delete the value in the box a dialog pops up saying: "Please enter a positive integer." Here is the situation: 1. I have a number (say 20) in the box. ...

Record online radio stream in VC++

I want to develop a software which can record online radio streams in VC++ using MFC. Any pointers to get me started. ...

Using MFC MDI with multiple top level window

I am working with a multiple top level windows application. The main window is a MDIFrameWnd, I put some code in CWinApp to switch m_pMainWnd when switch top level window. It's work fine but fire a assert when I close one of the main window. This assert is from CMDIChildWnd: void CMDIChildWnd::AssertValid() const { CFrameWnd::Assert...

"CoInitialize failed" when one functino (from a lib) is included in VC++ MFC project

I know this is kind of vague, I'm just shooting for general possibilities here to get me on the right track. I include two libs and their .h's in my MFC Dialog program and compile it, no problem. When I call a function from one of the libs though, it shoots up a dialog box that says "Com Error" "CoInitialize Failed". That's not when I a...