mfc

How to programmatically set the dropped control rect of a CComboBox

How to programmatically set the dropped control rect of a CComboBox? I know I can do this in the resource editor, but how do I change it, or set it if I programmatically create a combo box? I can acquire this information via the CB_GETDROPPEDCONTROLRECT message, but I don't see a corresponding set message/function. ...

Can't Display Bitmap of Higher Resolution than CDC area

Hi there dear gurus and expert coders. i am not gonna start with im a newbie and don't know much about image programming but unfortunately those are the facts :( I am trying to display an image from a bitmap pointer *ImageData which is of resolution 1392x1032. I am trying to draw that at an area of resolution or size 627x474. However,...

Method of getting text on a windows form ( unmanaged C++ project )

I'm in the process of learning C++. I've created a boilerplate Win32 app within VC++ 2008. I've studied through the code and am ready do do a bit of experimenting. I thought it would be cool to print all the windows messages received in the message loop to the form created via the boilerplate code. I for the life of me, can't figure out ...

How to make an edit box disapper at runtime (NOT gray) in MSVC 2008 using MFC ?

I want to make an EditBox disappear completely when the user selects a particular iption, instead of just graying it out. I tried using EnableWindow(false), but that just grays it out. I want the user to not see the control at all...can anyone help, or is this not possible in MSVC 2008 ? ...

Where do I put the logic of my MFC program?

I created an application core, in C++, that I've compiled into a static library in Visual Studio. I am now at the process of writing a GUI for it. I am using MFC to do this. I figured out how to map button presses to execute certain methods of my application core's main class (i.e. buttons to have it start and stop). The core class how...

windows beneath not being painted when using a layered window

Hi, I will try to explain my problem the best i can, I'm creating a layered window in c++ (using windowsXP), all works fine until i drag my created window near the windows start button, and then when i press the star button of windows taskbar and close it again all the windows beneath of my layered window aren't being painted (only in ...

Microsoft #include header file (.h) for "_HFILE"

I'm trying to compile some Microsoft SAPI example code in a non-Microsoft C++ Compiler, and am getting an error at this line: _HFILE m_hfilePrev; Presumably because it doesn't recognize the _HFILE #define. Does anybody know what .h file I should include for that? ...

Problem in getting the path of a shortcut file!!

In my application,I have an option of adding files to a list..were it will let the user to select multiple files at the same..am using CFileDialog to do tis and I enabled OFN_MULTISELECT (for multiselect)...The problem am facing is,When I try to add a shortcut file..its not taking the actual shortcut path,its reffering to the actual path...

Set window to stays always on desktop on windows7

Hi, I'm trying to set my window a child of the desktop, and i'm doing this like this: HWND ProgmanHwnd = ::FindWindowEx( ::FindWindowEx( ::FindWindow(L"Progman", L"Program Manager"), NULL, L"SHELLDLL_DefView", ...

Find which MFC child window would receive a mouse click

So, I have a plugin to an MFC program. I'm using a mouse event hook (from SetWindowsHookEx) to capture clicks. The host application can have any number of (possibly overlapping) child windows open, but I only want to intercept clicks in a particular child window. Is there a way to figure out in the hook proc which of the child windows...

Storing a value in Memory Independent of Process

Hi, I need a way to store a value somewhere for temporarily by say Process A. Process A can exit the after storing the value in memory. After sometime Process B comes accesses the same location of memory and read the value. I need to store in memory, because I dont want the data to persistent across reboots. But as long as the system is...

vs2008 resource editor changes rc file language

Hi all, I am doing some improvements to an application in vs2008 in c++. When i try to edit resources (for example add an entry in the string table), the vs2008 editor changes the rc file language from LANG_ENGLISH to LANG_NEUTRAL and a non english text is replaced with question marks. If i edit the rc file externally (in notepad), an...

How to query a CGI based webserver from an app written in MFC (MSVC 2008) and process the result?

Hi, I am exploring the option of querying a web-page, which has a CGI script running on its end, with a search string (say in the form of http://sw.mycompany.com/~tools/cgi-bin/script.cgi?param1=value1&param2=value2&param3=value3 ), and displaying the result on my app (after due processing of course). My app is written in MFC C++...

Put MFC CDialog in a WPF form

Hi, We are porting an MFC application to WPF, and will probably won't have time to port the entire application. The MFC app has many CDialog-based windows, and we are thinking of leaving some of these windows in MFC, and show them inside a WPF window, so we can control their modality from WPF. Is there an easy way to accomplish that? If...

How can I tell if CString allocates memory on the heap or stack?

How can I tell if the MFC CString allocates memory on the heap or stack? I am compiling for the Windows Mobile/Windows CE platform. I am working on a project developed by someone else and I have witnessed stack overflows under certain circumstances. I am trying to figure out if the custom SQLite recordset classes (with many CString ...

How can I initialize an ActiveX control from a URL?

I have an MFC ActiveX control embedded in a web page. Some of the parameters for this control are very large. I don't know what these values will be at compile time, but I do know that once retrieved, they will almost certainly never change. Currently, I embed the parameters like so: <object name="MyActiveX"> <param name="param" va...

Coupling an MFC CListCtrl and CTreeCtrl to get a view of the whole tree, not just one node at a time

Consider Windows Explorer (or regedit or similar). To the left side, there is a tree view, and to the right, a list view. In all cases I know of, the contents of the right view reflect the attributes of the selected node from the left pane. This is all well and good... but just not what I want. The nodes of the tree I want to display ha...

Strange error with CreateCompatibleDC

Maybe this is a foolish question, I can't see why I can not get a DC created in the following code : HBITMAP COcrDlg::LoadClippedBitmap(LPCTSTR pathName,UINT maxWidth,UINT maxHeight) { HBITMAP hBmp = (HBITMAP)::LoadImage(NULL, pathName, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE | LR_CREATEDIBSECTION); ...

C# threads - Posting messages between threads

Hi All, I am working on a project which involves reusing as well as migrating some of the existing MFC code to C#. The current code in MFC, creates some threads and uses ::PostthreadeMessage() and ON_THREAD_MESSAGE(msg,func) for inter thread asynchronous communication through messages. ::PostthreadeMessage() -> sends a message to a pa...

QWinWidget's position is always 0 (zero)

I hosted a QWinWidget in a CView and want it to stay at a designated position when resizing. But QWinWidget always moves to (0, 0), i.e. left-top corner of the CView. I tried to debug in this way: QWinWidget* pWidget = new QWinWidget(pCView); pWidget->move(50, 50); QPoint pos = pWidget->pos(); Note that: the pos is always (0, 0). Wh...