c++ - MFC - UpdateData(False) + Thread + Debug assertion failed -


im using visual studio 2010, work mfc 2008/2010. have problem thread , updatedata(false) init function

bool cbkav_btap2_appdlg::oninitdialog(){      ....      afxbeginthread (mythreadproc,(lpvoid)getsafehwnd());      return true;  // return true  unless set focus control  } 

this thread

uint __cdecl mythreadproc( lpvoid pparam ) {     dword totalphys;     dword availablephys;     dword memoload;     cbt2class* pobject = (cbt2class*)pparam;     pobject->getramandcpuinfo(totalphys,availablephys,memoload  );     cbkav_btap2_appdlg dlgobject;     dlgobject.ec_totalphys = totalphys;      dlgobject.updatedata(false);<--- can not update data     return 0;    } 

cbt2class class in dll file created before. ec_totalphys edit_control. when run, return "debud assertion failed". dont know why. please me. thankss. p/s: think need use sendmessage update data dialog search every still can't work.

you passing hwnd thread parameter. not pointer , should not cast anything. can use hwnd post custom message dialog. custom message can include data in wparam , lparam. message handler in dialog runs in main thread , can updatedata call. see example here posting custom message dialog: http://vcfaq.mvps.org/mfc/12.htm


Comments

Popular posts from this blog

c++ - OpenCV Error: Assertion failed <scn == 3 ::scn == 4> in unknown function, -

php - render data via PDO::FETCH_FUNC vs loop -

The canvas has been tainted by cross-origin data in chrome only -