tags:

views:

22

answers:

1

Hi,guys! I am calling "PrintDlg" Win32 API via P/Invoke. Strange enough, if I use Visual Studio debug mode (press F5) to run my application, the last error is 122, which means "The data area passed to a system call is too small" , but if i ran it with Ctrl+F5, the last error is 0 and the message is "The operation completed successfully". How could this be possible? Many thanks...

A: 

a) Don't check for an error unless the function returns false.

b) Don't use GetLastError, use CommDlgExtendedError as the docs suggest.

c) Start accepting answers on your questions. :)

Curt Nichols
thanks Curt. sorry for the delayed marking action. thanks for reminding. :D
smwikipedia