Go4Expert

Go4Expert (http://www.go4expert.com/)
-   MFC (http://www.go4expert.com/forums/mfc/)
-   -   error in use edit control and EndDialog() !!! (http://www.go4expert.com/forums/error-edit-control-enddialog-t19626/)

hadikazemi 30Sep2009 12:02

error in use edit control and EndDialog() !!!
 
hi
i use one edit Control in my Dialog.
when i use below code for read content of it :

Code:

GetWindowTextA(hEdit,editStr,10);
if content of Edit control is more than one Character my program give error in :

Code:

EndDialog( hDlg, FALSE );
error:

First-chance exception at 0x7e424f4a in CreateDevice.exe: 0xC0000005: Access violation reading location 0x00003355.
Unhandled exception at 0x7e424f4a in CreateDevice.exe: 0xC0000005: Access violation reading location 0x00003355.


if i enter one Character in Edit control error dont accure.

why ?

shabbir 30Sep2009 12:36

Re: error in use edit control and EndDialog() !!!
 
Looks like you have not allocated editStr correctly and so when the content of the box is being copied it gives an error.

hadikazemi 30Sep2009 12:51

Re: error in use edit control and EndDialog() !!!
 
editStr is LPSTR and i debug it. my program get string correctly and store it on editStr but only cant do EndDialog() if string be more than one Character!


All times are GMT +5.5. The time now is 22:19.