Click here to Skip to main content
15,884,099 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Multiple text lines and ellipsis? Pin
Moak15-Mar-08 10:08
Moak15-Mar-08 10:08 
GeneralHRESULT function confusion Pin
rowdy_vc++14-Mar-08 3:07
rowdy_vc++14-Mar-08 3:07 
GeneralRe: HRESULT function confusion Pin
CPallini14-Mar-08 3:47
mveCPallini14-Mar-08 3:47 
GeneralRe: HRESULT function confusion Pin
Rajesh R Subramanian14-Mar-08 8:13
professionalRajesh R Subramanian14-Mar-08 8:13 
GeneralExporting entry points in a dll with classes Pin
Klive814-Mar-08 2:58
Klive814-Mar-08 2:58 
GeneralRe: Exporting entry points in a dll with classes Pin
David Crow14-Mar-08 3:02
David Crow14-Mar-08 3:02 
Generalpath via property sheet Pin
john563214-Mar-08 2:46
john563214-Mar-08 2:46 
QuestionChrash at UpdateData(FALSE) Pin
merh14-Mar-08 2:45
merh14-Mar-08 2:45 
Hi, Im a MFC bigginer and neeed help to understand the crash which is caused by my program. I have created a Dialog i MFC and in the method OnInitDialog, I create a class which it creates a function in a thread and there is a loop in the method which sends the values to dialog via a interface. When I try to update the dialog by UpdateData(FALSE)the application crashes.

Please help me out of this problem
Thanks in advance.
M.H

BOOL CThreadDlg::OnInitDialog()
{
CDialog::OnInitDialog();

// Add "About..." menu item to system menu.

// IDM_ABOUTBOX must be in the system command range.
ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
ASSERT(IDM_ABOUTBOX < 0xF000);

CMenu* pSysMenu = GetSystemMenu(FALSE);
if (pSysMenu != NULL)
{
CString strAboutMenu;
strAboutMenu.LoadString(IDS_ABOUTBOX);
if (!strAboutMenu.IsEmpty())
{
pSysMenu->AppendMenu(MF_SEPARATOR);
pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
}
}

// Set the icon for this dialog. The framework does this automatically
// when the application's main window is not a dialog
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon

// TODO: Add extra initialization here
Thread1 *pThread = new Thread1(this);


return TRUE; // return TRUE unless you set the focus to a control
}

void CThreadDlg::setValueAlt1(int inValue1, int invalue2)
{
m_Value1.Format("%.3d", inValue1);
UpdateData(FALSE);
}



DWORD WINAPI ThreadFunc( LPVOID lpParam )
{
ISetValue * pISetValue = (ISetValue *)lpParam;
int a=44;
int b = 45;
for (int i=40; i<100; i++)
{
pISetValue->setValueAlt1(i, b );
Sleep(10);
}
return 0;

}



Thread1::Thread1(ISetValue *pISetValue)
{


DWORD dwThreadId;
HANDLE hThread;

LPVOID param = pISetValue;

m_pISetValue = pISetValue;

//pISetValue->setValueAlt1(44, 99);
//return;

hThread = CreateThread(
NULL, // no security attributes
0, // use default stack size
ThreadFunc, // thread function
param, // argument to thread function
0, // use default creation flags
&dwThreadId); // returns the thread identifier

}
GeneralRe: Chrash at UpdateData(FALSE) Pin
Cedric Moonen14-Mar-08 3:03
Cedric Moonen14-Mar-08 3:03 
QuestionRe: Chrash at UpdateData(FALSE) Pin
merh14-Mar-08 3:14
merh14-Mar-08 3:14 
GeneralRe: Chrash at UpdateData(FALSE) Pin
jhwurmbach14-Mar-08 3:51
jhwurmbach14-Mar-08 3:51 
AnswerRe: Chrash at UpdateData(FALSE) Pin
bert_r14-Mar-08 3:20
bert_r14-Mar-08 3:20 
QuestionRe: Chrash at UpdateData(FALSE) Pin
merh14-Mar-08 4:15
merh14-Mar-08 4:15 
AnswerRe: Chrash at UpdateData(FALSE) Pin
bert_r14-Mar-08 4:54
bert_r14-Mar-08 4:54 
GeneralRe: Chrash at UpdateData(FALSE) Pin
merh14-Mar-08 5:03
merh14-Mar-08 5:03 
GeneralRe: Crash at UpdateData(FALSE) Pin
bert_r14-Mar-08 5:19
bert_r14-Mar-08 5:19 
GeneralRe: Crash at UpdateData(FALSE) Pin
merh14-Mar-08 5:40
merh14-Mar-08 5:40 
GeneralRe: Chrash at UpdateData(FALSE) Pin
David Crow14-Mar-08 5:41
David Crow14-Mar-08 5:41 
GeneralRe: Chrash at UpdateData(FALSE) Pin
merh14-Mar-08 5:51
merh14-Mar-08 5:51 
GeneralRe: Chrash at UpdateData(FALSE) Pin
merh14-Mar-08 6:15
merh14-Mar-08 6:15 
GeneralRe: Chrash at UpdateData(FALSE) Pin
David Crow14-Mar-08 6:16
David Crow14-Mar-08 6:16 
Questioncan anybody tell me how i can call a vb activex dll from c++ Pin
philiptabraham14-Mar-08 1:29
philiptabraham14-Mar-08 1:29 
AnswerRe: can anybody tell me how i can call a vb activex dll from c++ Pin
ritz123414-Mar-08 1:39
ritz123414-Mar-08 1:39 
AnswerRe: can anybody tell me how i can call a vb activex dll from c++ Pin
Nathan Holt at EMOM14-Mar-08 6:22
Nathan Holt at EMOM14-Mar-08 6:22 
AnswerRe: can anybody tell me how i can call a vb activex dll from c++ Pin
CPallini14-Mar-08 11:02
mveCPallini14-Mar-08 11:02 

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.