问题
I have a small powershell script which allows me to quickly set an alarm for myself. It basically just waits a specified number of minutes and then calls
msg * alarm!
This works well - a message box pops up. The only problem is it disappears after a while - so if I'm not at my desk, I'll miss the message box.
According to the documentation, found here, this is the behaviour when I don't specify a time value.
/time: seconds : Specifies the amount of time the message you sent is displayed on the user's screen. Once the time limit is reached, the message disappears. If no time limit is set, the message remains on the user's screen until the user sees the message and clicks OK.
However this isn't the case and it does disappear. Right now, I have to specify an arbitarily high number for it to stay.
msg * /time:999999 alarm!
回答1:
Tracing the call's with cdb
shows following function of interest when starting msg.exe
and passing it the maximum timeout value of 999999
:
command: msg * /time:999999 alarm
The timeout value of f423f
(999999)
gets passed to ShowMessageBox
through the rax
register.
WINSTA!WinStationSendMessageW+0x353:
000007fe`fbf1ec93 e874deffff
call WINSTA!CSmartSession::ShowMessageBox (000007fe`fbf1cb0c)
rax=00000000000f423f rbx=0000000000000000 rcx=0000000000000010
Starting msg.exe
without any timeout value shows 3c
(60)
being passed to the ShowMessageBox
function.
command: msg * alarm
WINSTA!WinStationSendMessageW+0x353:
000007fe`fbf1ec93 e874deffff
call WINSTA!CSmartSession::ShowMessageBox (000007fe`fbf1cb0c)
rax=000000000000003c rbx=0000000000000000 rcx=0000000000000010
My guess is that the documentation is not up-to-date (if it ever was)
来源:https://stackoverflow.com/questions/40456245/why-does-msg-alarm-disappear-after-a-while