Champak

_WinAPI_SetWinowPos access denied

4 posts in this topic

Any idea why _WinAPI_SetWindowPos() fails with access denied when trying to use it with windows osk?

 

#include <WinAPI.au3>
#include <Constants.au3>

Sleep(2000)

$OSK = "On-Screen Keyboard"
$OSK_Handle = WinGetHandle($OSK)
$OSK_State = WinGetState($OSK)


;$Help_Handle = WinGetHandle("AutoIt Help")

;If BitAND($OSK_State, 16) Then
    _WinAPI_SetWindowPos ( $OSK_Handle,  $HWND_TOPMOST, 100, 60, 300, 100, $SWP_HIDEWINDOW )
    MsgBox(0,_WinAPI_GetLastErrorMessage(), _WinAPI_GetLastError())
;EndIf

Is the only work around to use WinSetState() and WinMove()?

Thanks.

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

I tried your code but the MsgBox gave an error 5 access denied. Then I tried adding the #RequireAdmin keyword and it works fine. Apparently you need to be working from the admin userspace (not entirely sure if that's the right term though) to access that API call for the OSK.

/edit: I'm working on a fresh Windows 10 Home with all the security settings pertaining to user permissions and such on default.

Edited by SadBunny

Roses are FF0000, violets are 0000FF... All my base are belong to you.

Share this post


Link to post
Share on other sites

Yes that works for me, thank you.

Share this post


Link to post
Share on other sites

No problem :cheer:


Roses are FF0000, violets are 0000FF... All my base are belong to you.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now