开发者

GlobalAddAtom() returns 0 and GetLastError = 0x5 on Win7, works on XP

开发者 https://www.devze.com 2023-01-13 00:37 出处:网络
Simple code: ATOM atom = GlobalAddAtom(L\"TestCpp1\"); It returns 0 and GetLastError returns 0x5 (Access Denied). Nothing on MSDN about it.

Simple code:

ATOM atom = GlobalAddAtom(L"TestCpp1"); 

It returns 0 and GetLastError returns 0x5 (Access Denied). Nothing on MSDN about it. This is on Win7. Admin righ开发者_如何学Gots make no difference.

Same code works on XP. AddAtom (local) works on Win7.

What's causing this?


Is this a GUI or Console application? One thing you might try is to explicity call LoadLibrary("User32") before calling GlobalAddAtom.

Here is a reference to someone that had a similar problem, on XP maybe this is relevant? http://www.tech-archive.net/Archive/Development/microsoft.public.win32.programmer.kernel/2004-03/0851.html

0

精彩评论

暂无评论...
验证码 换一张
取 消