mfc

How to use CMenu in an MFC application?

Hi! I made an MFC application, and now i want to turn off the window's close button during i do my copy operations. I did it successfull with this code: BOOL bEnable = FALSE; // To disable UINT menuf = bEnable ? (MF_BYCOMMAND) : (MF_BYCOMMAND | MF_GRAYED | MF_DISABLED); CMenu* pSM = GetSystemMenu( , FALSE ); if ( pSM ) { pSM->E...

How can i check that button is clicked in no modal dialog

I created main dialog and call no modal dialog, how can i check in main dialog that button is clicked in no modal? For example if i call modal i can check like this: Dialog Dlg; int DlgResult = static_cast<int>(Dlg.DoModal()); if (DlgResult== IDOK) { //do smth. } ...

How to show OpenGL in PictureBox in Visual C++

Hi, I want to show OpenGL processes in Windows Form PictureBox. I am using Visual C++. I'm taking user values on Windows Form Interface and I must draw chart for this values. Do you know any document or sample? ...

How to find Button ID in button callback handler

Hi, I am planning to keep a common event handler for 2 buttons, say ButtonA and ButtonB. When any of these buttons get clicked the same handler should be invoked. My question, is there any way to find the Button ID in the handler so that I can find out which one actually got clicked ? Thanks ...

Problem in displaying the message and the progress at the same time,threading in MFC?

Hello friends, I am working on threading in MFC..I am not sure how to use threading.. I cant attain what i excepted!What I actually tried, is to read the directory and display the file names and at the same time,the progress control should show the progress..I created a dynamic static to display the file names and progress ...

MFC Crash on repeated SetWindowText() when a background color for the dialog is specified

The following code works fine: for(int i=0; i<500; i++) { for(int j=0; j<100; j++) { m_title.SetWindowText(_T("lol")); } } But when I set a background color for the dialog: HBRUSH CTaggingDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) { return CreateSolidBrush(RGB(0,0,0));//BLACK } The loop above cause...

Please post any example for threading in MFC?

guys please post me an example for threading in MFC....it should show the progress and at the same time it should display the text,,if u anyone know some examples, please post me... ...

One control returns contents as single-byte, another as double-byte?!

I have 2 CRichEditCtrls. One is part of a dialog template, created automatically. When I call GetSelText on it, the bytes returned are one byte per char, i.e I'll get back char *str={'a','n','d'}. The 2nd control is created dynamically using the Create method, and the data returned calling GetSelText is returned in 2-byte characters: cha...

MFC docking windows and where they dock

Hi, I have created (generated) a MDI project with tabbed documents with VS2008 Pro. Visual Studio generates an application with the File/Class view window, properties window, output window and the first MDI document/ view. I want to control the sides on which the windows dock. I thought this was done in BOOL CMainFrame::CreateDo...

software update

Hi. i want general idea about how to write the software update for an application? which technology is simple like VC++ or .Net?.. i just need the idea in brief. ...

An unhandled win32 exception occurred in MyApp.exe

WinXP used. When I click the default cross icon to close my application. The win form of my application disappeared, but MyApp process still alive in the processes list when I open the task manager window. About 5 seconds later, throw out the unhandled win32 exception error. Where can I set the break point? I don't know how to debug it...

How can we capture a mouse event when it's already out of the client area?

Hi All, I have an application that has a list of buttons and has customized tooltips. Whenever the mouse hovers through the buttons, the tooltips come out and is working fine. However, I want to hide the tooltips when the mouse cursor is outside the client area. How can I tell my application that the mouse is already out of the client ...

How can I center an MFC MDI application at startup?

I am working with a legacy MFC (VC 6) application that needs to be modified to be centered vertically and horizontally on the screen at startup. I have tried using the call to CenterWindow in the main frame OnCreate call, but that doesn't appear to do anything. Any help would be greatly appreciated. ...

How to change the icon in a CTreePropSheet dialog

There is given a SetPageIcon method but it does nothing only the first sets allows ...

MFC Virtual List Control using Database

Hi, Does anyone know of a good MFC example of how to create and use a virtual list control with a database that has 100K records? I don't want to load in all the records at once because it takes too much time. I want all updates to the list control to be fast based on user interaction. Thanks, Mike ...

How to Communicate between dialogs?

hello friends, I am working on a small MFC application..since am new to MFC I am not familiar with all the user controls and classes...anyways my question is "how to communicate between 2 dialog windows"..Normally in C# there will be a panel so we can hide and hold the data's in the forms respectively,but I am not sure,how w...

Not able to communicate between dialogs by passing their object as Reference!

I want to communicate between two or more dialog windows,when i say communicate It means that I want to use the variables and functions in all dialog boxes with values updated.. So what I did is created three main Dialog boxes,Considering 1 dialog window as main window where it can have variables and functions and I created a pointer var...

How to disable that an MFC application exits on pressing ESC or ALTF+F4?

Hi! I have an MFC application, which i don't want to be closed during the running. I have disabled the "X" icon in the right upper corner, but now if i press the ESC key, or ALT+F4 it still closes. How can i disable this, so it won't close, if someone press those keys? After the program has finished running i want to reenable them. T...

drag and drop problem

Hi I have an Application and want to drop a file in it. I used the COleDropTarget class and derived from it. In my CMainFrame class in the methode OnCreate I register it. This return true. When OnDrop gets called pDataObject->GetFileData(CF_TEXT); or even pDataObject->IsDataAvailable(CF_TEXT) returns 0. Can someone tell me why? Thanks...

How can I display a bitmap/icon on an XP style button

I have a small (6x9) graphic that I want to draw on a CButton. I have managed to get this to work using ::LoadImage and CButton::SetBitmap. The problem is that when I put the bitmap on the button it is no-longer drawn as an 'XP style' button. I.e. it does not have rounded corners. How can I draw a bitmap (or an icon) on a button without...