Jump to content

Recommended Posts

Posted

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.

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.

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...