到达代码行时,MFC在运行时崩溃SetDlgItemText(,)

时间:2017-03-27 06:48:39

标签: mfc

调试输出说:

First-chance exception at 0x00007FF96B451DB3 (ntdll.dll) in myapp.exe: 0xC0000005: Access violation writing location 0x00000053B3330FC8.
Unhandled exception at 0x00007FF96B451DB3 (ntdll.dll) in myapp.exe: 0xC0000005: Access violation writing location 0x00000053B3330FC8.

此问题发生在服务器计算机上,而在本地计算机上运行正常。请帮忙。提前谢谢!

1 个答案:

答案 0 :(得分:0)

尝试做这样的事情:

if(NULL != GetSafeHwnd())
    SetDlgItemText(IDC_EDIT, _T("Tra la la"));

if(NULL != GetDlgItem(IDC_EDIT)->GetsafeHwnd())
    GetDlgItem(IDC_EDIT)->SetWindowText(_T("Tra la la"));