[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 681
  • 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

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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