Champak Posted July 11, 2016 Share Posted July 11, 2016 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. Link to comment Share on other sites More sharing options...
SadBunny Posted July 12, 2016 Share Posted July 12, 2016 (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 July 12, 2016 by SadBunny Roses are FF0000, violets are 0000FF... All my base are belong to you. Link to comment Share on other sites More sharing options...
Champak Posted July 12, 2016 Author Share Posted July 12, 2016 Yes that works for me, thank you. Link to comment Share on other sites More sharing options...
SadBunny Posted July 12, 2016 Share Posted July 12, 2016 No problem Roses are FF0000, violets are 0000FF... All my base are belong to you. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now