From: linyanmi on 14 Nov 2008 09:50 Hi, My application tries to call function PostMessage(...) to the windows message queue, but it fails. GetLastError() return error code 183. According to the system code table 183 means: ERROR_ALREADY_EXISTS (0xB7): Cannot create a file when that file already exists. What can cause such kind of failure? Thanks in advance for any suggestion...
From: Igor Tandetnik on 14 Nov 2008 15:11 linyanmi(a)gmail.com wrote: > My application tries to call function PostMessage(...) to the windows > message queue, but it fails. GetLastError() return error code 183. How do you know it fails? Do you check its return value, or do you call GetLastError right away? Most API functions set last error on failure, but _don't_ reset it on success. The result of GetLastError is only meaningful if the most recent call has indeed failed (usually indicated by its return value). You can't rely on GetLastError returning NOERROR after a successful call. -- With best wishes, Igor Tandetnik With sufficient thrust, pigs fly just fine. However, this is not necessarily a good idea. It is hard to be sure where they are going to land, and it could be dangerous sitting under them as they fly overhead. -- RFC 1925
From: linyanmi on 17 Nov 2008 12:55 Hi Igor Tandetnik, Thanks for your reply. The failure actually occurred when it called SendMessageTimeout function: if (!SendMessageTimeout(hwndSubscibed, ulSubscribedMsg, ulNotification,lQueueElement, SMTO_ABORTIFHUNG, 10, &dwResult)) { Trace("PostNotifications( ) : OP_FAIL:PostMessage:[%d]", GetLastError()); } GetLastError() is called right away, the trace shows error code 183
|
Pages: 1 Prev: Printing from Console Application Next: pugXML parser - dumping to XML |