• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 706
  • Last Modified:

MFC App call to Windows API LockSetForegroundWindow geives error access denied, Why?

When calling LockSetForegroundWindow I get an error in realse mode
"access denied"

I also set the time out to 30 seconds

BOOL setForeGroundLockTimeOut = SystemParametersInfo(SPI_SETFOREGROUNDLOCKTIMEOUT, 0, (LPVOID)30000, SPIF_SENDWININICHANGE | SPIF_UPDATEINIFILE);

setForeGroundLockTimeOut  == 1 --> it succeeded

but when I get it, it is 0     timeout == 0

BOOL getForeGroundLockTimeOut = SystemParametersInfo(SPI_GETFOREGROUNDLOCKTIMEOUT, 0, (LPVOID)&timeout, 0);

Any help or demo code on how to use these functions
0
jrainey
Asked:
jrainey
1 Solution
 
jkrCommented:
That should be

DWORD dwTimeout = 30000;
BOOL setForeGroundLockTimeOut = SystemParametersInfo(SPI_SETFOREGROUNDLOCKTIMEOUT, 0, (LPVOID)&dwTimeout, SPIF_SENDWININICHANGE | SPIF_UPDATEINIFILE);
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now