If the function succeeds, the return value is a handle to the event object. If the named event object existed before the function call, the function returns a handle to the existing object and GetLastError returns ERROR_ALREADY_EXISTS. If the function fails, the return value is NULL. 所有的函数都有执行失败的可能。特别是涉及到LPSECURITY_ATTRIBUTES lpEventAttributes, 有可能因权限的问题引起失败。
If the named event object existed before the function call, the function returns a handle to the existing object and GetLastError returns ERROR_ALREADY_EXISTS.
If the function fails, the return value is NULL. 所有的函数都有执行失败的可能。特别是涉及到LPSECURITY_ATTRIBUTES lpEventAttributes,
有可能因权限的问题引起失败。
这样就不存在使用过程中申请的问题
程序所需要的就是保证错误处理,进行友好提示等。如果你要不出错,可以参考前面几位说的,所有资源预先准备好。否则我的程序就不跑了。