Click here to Skip to main content
15,914,370 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Plz chck this code!! Pin
SuperTank2-May-05 5:27
SuperTank2-May-05 5:27 
GeneralConvert Words to Numbers Pin
Member 6339521-May-05 22:12
Member 6339521-May-05 22:12 
GeneralRe: Convert Words to Numbers Pin
Rahim Rattani2-May-05 1:19
Rahim Rattani2-May-05 1:19 
GeneralCDialog::EndDialog crashes application Pin
leatrop1-May-05 20:59
leatrop1-May-05 20:59 
GeneralRe: CDialog::EndDialog crashes application Pin
khan++2-May-05 0:37
khan++2-May-05 0:37 
GeneralRe: CDialog::EndDialog crashes application Pin
leatrop2-May-05 12:29
leatrop2-May-05 12:29 
GeneralRe: CDialog::EndDialog crashes application Pin
Rahim Rattani2-May-05 2:02
Rahim Rattani2-May-05 2:02 
GeneralRe: CDialog::EndDialog crashes application Pin
leatrop2-May-05 12:52
leatrop2-May-05 12:52 
Hmm.., ((ProgressDialog *)lparam)->PostMessage(WM_COMMAND,IDOK) fixes the problem, but what was wrong with EndDialog?!

Stack trace:

USER32! 77d562cf()
CDialog::EndDialog(int)
ReadDeviceThread(void *)
_threadstart(void *)
KERNEL32!7c80b50b()

----------------------------
ProgressDialog.cpp
----------------------------

// ProgressDialog.cpp : implementation file
//

#include "stdafx.h"
#include "monitor.h"
#include "ProgressDialog.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// ProgressDialog dialog


ProgressDialog::ProgressDialog(CWnd* pParent /*=NULL*/)
: CDialog(ProgressDialog::IDD, pParent)
{
//{{AFX_DATA_INIT(ProgressDialog)
m_text = _T("");
//}}AFX_DATA_INIT
}


void ProgressDialog::OnFinalRelease()
{
// When the last reference for an automation object is released
// OnFinalRelease is called. The base class will automatically
// deletes the object. Add additional cleanup required for your
// object before calling the base class.

CDialog::OnFinalRelease();
}

void ProgressDialog::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(ProgressDialog)
DDX_Control(pDX, IDC_MPROGRESS, m_bar);
DDX_Text(pDX, IDC_MPROGTEXT, m_text);
//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(ProgressDialog, CDialog)
//{{AFX_MSG_MAP(ProgressDialog)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// ProgressDialog message handlers

int ProgressDialog::DoModal(char *txt)
{
m_text = txt;
//m_bar.SetRange(0,100);
//m_bar.SetPos(0);

return CDialog::DoModal();
}

void ProgressDialog::SetText(char *txt)
{
m_text = txt;

UpdateData(FALSE);
}

void ProgressDialog::SetPos(int pos)
{
m_bar.SetPos(pos);
}


void ProgressDialog::OnCancel()
{
// TODO: Add extra cleanup here

StopAcc = 0;
CancelProgressModal = 1;
Sleep(4); // a little delay to stop a collision
CDialog::OnCancel();
}

void ProgressDialog::SetRange(int min, int max)
{
m_bar.SetRange(min, max);
}

----------------------------
ProgressDialog.h
----------------------------

#if !defined(AFX_PROGRESSDIALOG_H__13AB40A1_4F1A_11D2_932F_F4950FC10000__INCLUDED_)
#define AFX_PROGRESSDIALOG_H__13AB40A1_4F1A_11D2_932F_F4950FC10000__INCLUDED_

#include "stdafx.h"
#include "resource.h"

#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
// ProgressDialog.h : header file
//

/////////////////////////////////////////////////////////////////////////////
// ProgressDialog dialog

class ProgressDialog : public CDialog
{
// Construction
public:
void SetRange(int min, int max);
ProgressDialog(CWnd* pParent = NULL); // standard constructor

void SetText(char *txt);
void SetPos(int pos);

// Dialog Data
//{{AFX_DATA(ProgressDialog)
enum { IDD = IDD_PROGRESS };
CProgressCtrl m_bar;
CString m_text;
//}}AFX_DATA


// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(ProgressDialog)
public:
virtual void OnFinalRelease();
virtual int DoModal(char *txt);
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL

// Implementation
protected:

// Generated message map functions
//{{AFX_MSG(ProgressDialog)
virtual void OnCancel();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};

//{{AFX_INSERT_LOCATION}}
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_PROGRESSDIALOG_H__13AB40A1_4F1A_11D2_932F_F4950FC10000__INCLUDED_)

GeneralMicrosoft word and MFC Pin
Aqueel1-May-05 20:13
Aqueel1-May-05 20:13 
Generalbuttons not seen on dialog box Pin
Anonymous1-May-05 19:47
Anonymous1-May-05 19:47 
GeneralRe: buttons not seen on dialog box Pin
namaskaaram1-May-05 20:07
namaskaaram1-May-05 20:07 
GeneralRe: buttons not seen on dialog box Pin
Anonymous1-May-05 20:14
Anonymous1-May-05 20:14 
GeneralRe: buttons not seen on dialog box Pin
khan++1-May-05 20:22
khan++1-May-05 20:22 
GeneralRe: buttons not seen on dialog box Pin
John R. Shaw2-May-05 7:24
John R. Shaw2-May-05 7:24 
GeneralRe: buttons not seen on dialog box Pin
Anonymous2-May-05 19:47
Anonymous2-May-05 19:47 
GeneralInterpret Javascript in VC++ Pin
Priyank Bolia1-May-05 19:18
Priyank Bolia1-May-05 19:18 
GeneralRe: Interpret Javascript in VC++ Pin
ThomasABBE2-May-05 12:20
ThomasABBE2-May-05 12:20 
GeneralRe: Interpret Javascript in VC++ Pin
Priyank Bolia2-May-05 19:05
Priyank Bolia2-May-05 19:05 
GeneralISAPI Filter access database Pin
leeherng821-May-05 17:46
leeherng821-May-05 17:46 
GeneralRe: ISAPI Filter access database Pin
Christian Graus1-May-05 17:51
protectorChristian Graus1-May-05 17:51 
GeneralHelp using openthread Pin
Anonymous1-May-05 17:35
Anonymous1-May-05 17:35 
GeneralRe: Help using openthread Pin
mark novak2-May-05 2:42
mark novak2-May-05 2:42 
GeneralRe: Help using openthread Pin
Anonymous2-May-05 8:51
Anonymous2-May-05 8:51 
Questionhow to change my dialog? Pin
steven_wong1-May-05 17:29
steven_wong1-May-05 17:29 
AnswerRe: how to change my dialog? Pin
Christian Graus1-May-05 17:50
protectorChristian Graus1-May-05 17:50 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.