Page 1 of 1

Microsoft Word Issue?

Posted: 06 Mar 2023, 12:38
by RDC
Can anyone enlighten me as to why the below script doesn't seem to work with Microsoft Office products?
This is just a simple windows position lock, that so far has worked with everything except those products.

Code: Select all

#Persistent
#SingleInstance, Force

^L::  							 ; Ctrl+L = Lock window
winLock(hWnd := WinExist("A")) 	 ; Last active window.
SoundBeep 1500
Return

^U::  							 ; Ctrl+U = Unlock window
winRevert(hWnd)
SoundBeep 1000
Return

winLock(hWnd) {
nCnt := DllCall("GetMenuItemCount", "Int", sysMenu := hSysMenu(hWnd, False))
DllCall("RemoveMenu", "Int", sysMenu, "UInt", nCnt - 6, "UInt", 0x400), DllCall("DrawMenuBar", "Int", hWnd)
}

hSysMenu(hWnd, revert) {
Return DllCall("GetSystemMenu", "UInt", hWnd, "UInt", revert)
}

winRevert(hWnd) {
DllCall("DrawMenuBar", "UInt", hSysMenu(hWnd, True))
}

^Esc::ExitApp