Search Results

Search found 584 results on 24 pages for 'mfc'.

Page 4/24 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • VS2008 C++ MFC Access Violation ONLY when stepping through debug mode

    - by HotOil
    Hi. This is crazy. It started happening in my main project, so I created a tiny sample brand-new project to reproduce it in and sure enough.. It does NOT happen in a sample project I created that is only a Win32 console app. I'm running this on Win7x64, if that matters. VS2008 SP1. Here goes. I create a small dialog app with a button. Put a breakpoint in the handler function for that button. The button handler function looks like this: void CTestProjectDlg::OnBnClickedButton1() { int i=2; m_csHello.Format(_T("Hello World!")); << breakpoint here UpdateData(FALSE); } Click the button, hit the breakpoint. F10 to step, and boom: "First-chance exception at 0x0398f77b in TestProject.exe: 0xC0000005: Access violation." It gives me the option to Break or Continue. If I Continue, it just hits it again, only not "First Chance". Yes I have that exception checked in the Debug-Exceptions dlg. If I Break, the call stack just shows me the line where the breakpoint is. If I F10 again.. I get the exception again, only now the callstack shows me in the _AfxDispatchCmdMsg() function, and my original OnBnClickedButton1() is not in the callstack anymore. It doesn't matter where I put the breakpoint. If, instead of F10, I just continue with F5, it works normally. Now.. if I build a Release version and run in debugging mode: I hit the breakpoint, and all the pointers, variable values look normal. F10, and these turn to garbage. The this pointer is now zero. The m_csHello is now However, in Release mode, an exception is not caught, and it all runs fine. The "hello World string gets displayed in the dialog box as it should. I have put in an inquiry to see if some patch was installed on my box by the IT dept in the last day or two. This wasn't happening 2 days ago. What do you think? Is VS2008 corrupted? Thanks.

    Read the article

  • Accessing a dialog from Another dialog MFC

    - by Isuru
    Hi, I want to open a separate dialog box when I cllick on a button on my main dialog. I used separateDialog.DoModal() to do it. It open successfully but when I try to add data to a edit control (text box) in that seperate dialog, a debug assertion failure occurs. What is the matter and how can I overcome it? Thank You!!

    Read the article

  • How to create a drop down menu in MFC for WINCE

    - by ame
    I have tried the following code in a win32 app that shows a drop down menu on clicking a button. However, this does not work in WinCE as MENUINFO is not defined. Is there any way I can get around this? I need to view a drop down menu on clicking a button, and the name appearing on the button changes depending on the option on the menu. void CTestDlg::OnBnClickedBtnMenu() { if( NULL == m_PopUpMenu.m_hMenu ) { m_PopUpMenu.SetMenuDimension( 120 ); m_PopUpMenu.CreatePopupMenu(); m_PopUpMenu.AppendMenu( MF_STRING | MF_ENABLED | MF_OWNERDRAW, 697, _T("A") ); m_PopUpMenu.AppendMenu( MF_STRING | MF_ENABLED | MF_OWNERDRAW, 697, _T("B") ); m_PopUpMenu.AppendMenu( MF_STRING | MF_ENABLED | MF_OWNERDRAW, 697, _T("C") ); m_PopUpMenu.AppendMenu( MF_STRING | MF_ENABLED | MF_OWNERDRAW, 697, _T("D") ); MENUINFO MenuInfo; memset( &MenuInfo, 0, sizeof(MENUINFO) ); MenuInfo.cbSize = sizeof(MENUINFO); MenuInfo.fMask = MIM_STYLE; MenuInfo.dwStyle = MNS_NOTIFYBYPOS; m_PopUpMenu.SetMenuInfo( &MenuInfo ); }

    Read the article

  • Move application to second monitor in MFC

    - by Anu
    Hi, I m developing applcaiton in VS2008 VC++.net I want to move the application to secondary monitor.Not by clicking and dragging using mouse. Is there any function like MoveToMonitor by pressing the button or any shortcut keys. Then it should move to secondary monitor.

    Read the article

  • What are useful functions for drawing text (MFC)?

    - by kobac
    I'm creating a line chart control, and I need to write (or better say draw) the axis names and axis values. I found DrawText and TextOut functions, but the text they show is flickering and don't know how to set the font and text orientation (I will need vertical text orientation as well as horizontal). Are there any other functions you could recoommend or how to use these stated above and get the results I need? Thanks in advance. Cheers.

    Read the article

  • How to correctly pop a modeless dialog from console using MFC

    - by Vertilka
    I need to create a console application that has a main() function and pop a modeless dialog, so the console can still work in parallel to the modeless dialog (do other work, like communicating with the modeless dialog). Whatever i tried, i could only pop a modal dialog. (where the console is in hold till the modal dialog close itself). When switching to modeless dialog using Create() and ShowWindow() the dialog is displayed without its controls and it freeze / block (you can see the hourglass cursor). 1) i tried to pop the modeless dialog from the main() function 2) i tried to pop the modeless dialog from the InitInstance() of a CWinApp derived class In all cases the modeless dialog freeze / block. I believe this is a one line solution. TNX,Vertilka

    Read the article

  • [MFC] Combining 2 memory DCs ?

    - by OverTheEdge
    I'm writing a control where there's a lot of custom drawing going through. Because of this I need to trim down the amount of "screen writes" that go about. Currently there is only one memory DC that is used to write to screen so as to avoid flicker when the control is redrawn. I want to know if it is a possiblity to use 2 or more memory DCs to write updates independently and then bitblt them to screen. This way the need to render non-changed parts of the screen is minimized. thanx in advacne, the_Saint

    Read the article

  • MFC CDialog not showing

    - by Jesus_21
    here is my problem : In my Solution, I have 2 projects, one is a lib in which I created a ressource file (mylib.rc) and a dialog template in it. Then I made a class which inherits CDialog and uses this template. But when I instantiate it and call DoModal(), nothing appends... here the code of my class, is something wrong with it ? MyDialog.h /*MyDialog.h*/ #pragma once #include "../../../resource.h" class MyDialog : public CDialog { enum {IDD=IDD_DLGTEMPLATE}; public: MyDialog(CWnd* pParent = NULL); virtual ~MyDialog(); protected: virtual BOOL OnInitDialog(); DECLARE_MESSAGE_MAP() private: afx_msg void OnBnClickedOk(); afx_msg void OnBnClickedCancel(); }; MyDialog.cpp /*MyDialog.cpp*/ #include "stdafx.h" #include "MyDialog.h" MyDialog::MyDialog(CWnd* pParent /*=NULL*/) : CDialog(IDD_DLGTEMPLATE, pParent) {} MyDialog::~MyDialog() {} BOOL MyDialog::OnInitDialog() { return TRUE; } BEGIN_MESSAGE_MAP(MyDialog, CDialog) ON_BN_CLICKED(IDOK, &MyDialog::OnBnClickedOk) ON_BN_CLICKED(IDCANCEL, &MyDialog::OnBnClickedCancel) END_MESSAGE_MAP() void MyDialog::OnBnClickedOk() { OnOK(); } void MyDialog::OnBnClickedCancel() { OnCancel(); }

    Read the article

  • problem in showing and hiding dialog boxes in MFC

    - by Rakesh
    Hello all, I am trying to create a wizard like structure using dialog boxes...So I replaced the code in CDialog1App as below CDialog1Dlg* dlg = new CDialog1Dlg; m_pMainWnd = dlg; dlg->Create(IDD_DIALOG1); dlg->ShowWindow(SW_SHOW); the above worked fine...its displying the dialog box.but I have added another dialog box... So in the first dialog box if the user clicks Next it has to hide the first dialog box and display the second dialog.. //CDialog1 class void CDialog1Dlg::OnBnClickedNext() { // TODO: Add your control notification handler code here CDialog2* dialog2 = new CDialog2(); dialog2->Create(IDD_DIALOG2); dialog2->ShowWindow(SW_SHOW); this->ShowWindow(SW_HIDE); } in the above code am creating an object for the Dialog2 class and trying to show that.... Now the problem is,when I click next its hiding both the windows..What can I do..I tried several types but its still its not workin..Please dont suggest me to do with PropertySheet..It will work with that, i know ...but I want this using Dialog Box for some reason

    Read the article

  • What is the best way to make a schedule in MFC

    - by Vanwaril
    I have a list of items that are each associated with a start and end time and date. What I want to do is, given a time and date range, display only the items that fall within that window, even partially. What I'm doing is creating a CListCtrl with all the items in it and the CListCtrl is sorted by start time by default. But given a time range, I don't know how to search for the first item that is within the range. Another problem with the list control is it displays as a list, whereas it would be nice if there was a control that could also show things that are concurrent side by side. I'm doing this within a dialog application.

    Read the article

  • MFC (C++) CDialog DoModal() not working as expected

    - by krebstar
    Hi, I have a plugin that is loaded by this application.. This plugin calls some dialog boxes with DoModal(). I'm expecting these dialog boxes to function like this: If I click on the application window behind the dialog box, the dialog box flashes and does not allow the application to be in focus. However, in one of the other dialog boxes, called with DoModal(), if I click on the application window, it doesn't do the flashing thing, and after a while the application's close/minimize buttons become active (well, just the color). They're not really active and the window turns somewhat white and the title bar says (Not Responding)... What could possibly be wrong and how do I fix it? I've tried setting the dialog box's properties to System Modal: True, and Set Foreground: True but it doesn't seem to work.. :( Thanks.. EDIT: I'd like to note that the in the Windows taskbar, there is only one entry for the application for the correct behavior, but when the dialog box with the incorrect behavior is launched, another "window" is launched.. So it looks like (Application)(Dialog box title).. The effect I'm trying to achieve is just (Application)..

    Read the article

  • win7 + vc7.1 + mfc = stackoverflow

    - by fogbit
    Hello! I've moved my vc7.1 project from WInXP to Win7. After rebuilding i got stackoverflow error in function _malloc_dbg when i start the program. "Unhandled exception at 0x0051bf0f in XXX.exe: 0xC00000FD: Stack overflow." Call stack: msvcr71d.dll!_malloc_dbg(unsigned int nSize=140, int nBlockUse=2, const char * szFileName=0x10267784, int nLine=163) msvcr71d.dll!_calloc_dbg(unsigned int nNum=1, unsigned int nSize=140, int nBlockUse=2, const char * szFileName=0x10267784, int nLine=163) msvcr71d.dll!_mtinit() msvcr71d.dll!_CRTDLL_INIT(void * hDllHandle=0x10200000, unsigned long dwReason=1, void * lpreserved=0x0018fd24) I tried to set up different stacksizes in project options (from 10 to 100 mbytes), in all cases i got this error. How can i fix this?

    Read the article

  • Mix and match class in C++/MFC

    - by Coder
    I'm trying to re-factor a code base, and there is some common functionality among unrelated classes that I'd love to unite. I would like to add that functionality in common base class, but I'm not sure if it's clean and good approach. Say I have CMyWnd class and CMyDialogEx class, both different, so they cannot inherit from one base class. I want to add a button to both classes and add the message handlers to both classes as well. So I'd like to do something like this: CMyWnd : public CWnd, public COnOkBtnFunctionality, public COnCancelBtnFunctionality CMyDialogEx: public CWnd, public COnOkBtnFunctionality Where COnOkBtnFunctionality would define CButton m_buttonOk, and all the afx_msg functions it should have. And so on. Is this approach doable/good? Or are there better patterns I should resort to?

    Read the article

  • Alternate for MoveTo and LineTo in win32, MFC

    - by mukesh
    Hi i am working on some high resolution display features in which have to draw the vertical line , i am using Moveto() and lineTO() , but it is much time taking... can anyone suggest me , what we can use instead of it ...to optimize the performance... see the scene is , in order to draw 100 Vertical lines it is taking 84ms time, we need to reduce it to 5 ms something.. please refer me any alternate fot that. Thanks, Mukesh

    Read the article

  • multi-threading in MFC

    - by kiddo
    Hello all,in my application there is a small part of function,in which it will read files to get some information,the number of filecount would be utleast 50,So I thought of implementing threading.Say if the user is giving 50 files,I wanted to separate it as 5 *10, 5 thread should be created,so that each thread can handle 10 files which can speed up the process.And also from the below code you can see that some variables are common.I read some articles about threading and I am aware that only one thread should access a variable/contorl at a me(CCriticalStiuation can be used for that).For me as a beginner,I am finding hard to imlplement what I have learned about threading.Somebody please give me some idea with code shown below..thanks in advance file read function:// void CMyClass::GetWorkFilesInfo(CStringArray& dataFilesArray,CString* dataFilesB, int* check,DWORD noOfFiles,LPWSTR path) { CString cFilePath; int cIndex =0; int exceptionInd = 0; wchar_t** filesForWork = new wchar_t*[noOfFiles]; int tempCheck; int localIndex =0; for(int index = 0;index < noOfFiles; index++) { tempCheck = *(check + index); if(tempCheck == NOCHECKBOX) { *(filesForWork+cIndex) = new TCHAR[MAX_PATH]; wcscpy(*(filesForWork+cIndex),*(dataFilesB +index)); cIndex++; } else//CHECKED or UNCHECKED { dataFilesArray.Add(*(dataFilesB+index)); *(check + localIndex) = *(check + index); localIndex++; } } WorkFiles(&cFilePath,dataFilesArray,filesForWork, path, cIndex); dataFilesArray.Add(cFilePath); *(check + localIndex) = CHECKED; }

    Read the article

  • [Win32/MFC] Making group-boxes contain things

    - by John
    As I understand it, a group-box is just another control. Controls inside it are not owned by it, so unlike in Winforms, if you move a group-box the contained controls stay put. What would be the nicest way to address this? Just create your own data-structure mapping controls to 'container' group-boxes so that when the container is moved the children are automatically moved?

    Read the article

  • MFC: 'Gluing' two windows/dialogs together

    - by John
    I'm trying to set something up so my main dialog has one or more child dialogs, and these are glued/docked to the outside of the main dialog - when the main dialog is minimised, the children are too, when main dialog moves, children move with it. I'd tried setting child dialogs as having main dialog CWnd as parent, with CHILD style. But then they get clipped by the parent's boundary. If I set them as POPUP, they can be outside but then don't move with the parent. I'm looking at putting an OnMove handler on the parent dialog, but is there something built-in? And, should child dialogs still be children of the main dialog... I assume they should? This is VS2005 (I think VS2008 has some related functionality so I mention this).

    Read the article

  • How to stop a MFC/win32 control re-painting

    - by John
    I have a CRichEditCtrl, and an algorithm works on its contents in-place, iterating through the contents and making changes. This seems to cause it to re-paaint every time, which causes flickering and a noticeable time to complete the operation, especially if the control starts scrolling. I wondered if there's a neat way for me to stop it repainting for a period. It's actually a custom subclass of CRichEditCtrl in use so I was thinking something like: void MyCustomEditCtrl::DoAlgorithm() { enableRepaint(false); ... //to the actual work ... enableRepaint(true); } What's the neatest approach? A custom on-paint handler which does nothing when an operation is in progress? Or can repainting actually be disabled?

    Read the article

  • How to use CriticalSection - MFC?

    - by mapples
    I' am working on a small example and am a bit of curious using criticalsection in my example. What I'am doing is,I have a CStringArray(which has 10 elements added to it).I want to copy these 10 elements(string) to another CStringArray(am doing this to understand threading and Critical section),I have created 2 threads,Thread1 will copy the first 5 element to another CStringArray and Thread2 will copy the rest.Here two CStringArray are being used,I know only 1 thread can access it at a time.I wanted to know how this can be solved by using criticalsection or any other method. void CThreadingEx4Dlg::OnBnClickedOk() { // TODO: Add your control notification handler code here thread1 = AfxBeginThread((AFX_THREADPROC)MyThreadFunction1,this); thread2 = AfxBeginThread((AFX_THREADPROC)MyThreadFunction2,this); } UINT MyThreadFunction1(LPARAM lparam) { CThreadingEx4Dlg* pthis = (CThreadingEx4Dlg*)lparam; pthis->MyFunction(0,5); return 0; } UINT MyThreadFunction2(LPARAM lparam) { CThreadingEx4Dlg* pthis = (CThreadingEx4Dlg*)lparam; pthis->MyFunction(6,10); return 0; } void CThreadingEx4Dlg::MyFunction(int minCount,int maxCount) { for(int i=minCount;i<=maxCount;i++) { CString temp; temp = myArray.GetAt(i); myShiftArray.Add(temp); } }

    Read the article

  • How to convert char to LPCTSTR (MFC)?

    - by Shark
    Is there any way to do this? This is what I am trying to do: char s[] = { 'a', 'b' }; label.SetWindowTextW(s[1]); label is CStatic typed, _UNICODE is defined. Any help would be appreciated. UPD: Tried to use CString(s[1]), it works for ASCII characters but others won't work. E. g. for the ? it returns |.

    Read the article

  • How to dock CPaneDialog to MainFrm and.. ?

    - by JongAm Park
    Hello, I have problem with CPaneDialog. I tested with SetPaneSize MFC feature pack sample projects. What is weird is that CPaneDialog can't be docked to MainFrm while CDockablePane can be. The CPaneDialog is also a child class of the CDockablePane, but it can't be. Only DockToWindow( &other_CPaneDialog_instance... ) is possible. If I call DockToPane(), the content of the CPaneDialog is not drawn or refreshed correctly. How can a CPaneDialog be docked to MainFrm window? Another problem is about drawing. If remove codes for tree control in the SetPaneSize sample, the content of the view1 ( an instance of CDockablePane) is not redrawn properly. After doing some experiment, I decided that something should be done in its OnSize and OnPaint method. (OnSize is more critical. ) Is this expected behaviour?

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >