Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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 rights make no difference.

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

What's causing this?

like image 314
georgiosd Avatar asked Aug 26 '10 16:08

georgiosd


1 Answers

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

like image 93
Chris Taylor Avatar answered Oct 19 '22 12:10

Chris Taylor