Ask Question Forum:
Model Library:2025-02-08 Updated:A.I. model is online for auto reply question page
C
O
M
P
U
T
E
R
2
8
Show
#
ASK
RECENT
←
- Underline
- Bold
- Italic
- Indent
- Step
- Bullet
- Quote
- Cut
- Copy
- Paste
- Table
- Spelling
- Find & Replace
- Undo
- Redo
- Link
- Attach
- Clear
- Code
Below area will not be traslated by Google,you can input code or other languages
Hint:If find spelling error, You need to correct it,1 by 1 or ignore it (code area won't be checked).
X-position of the mouse cursor
Y-position of the mouse cursor
Y-position of the mouse cursor
Testcursor
caretPos
Attachment:===
Asked by duncanb7
at 2024-10-11 06:38:21
Point:0 Replies:6 POST_ID:828529USER_ID:11059
Topic:
Visual Basic Programming;;Windows XP Operating System
I would like to program code in EXcel2003 VBA to turn on or off my monitor in my window XP
computer and I tried the code in the link, http://www.expertsexchange.com/Programming/Misc/Q_20840222.html
and set lparm in sendmessage API function from 1 or 2, But it doesn't have any response on
my monitor, Why ? lparm=2 is setting to turn off and 1 is setting for turn-on
Is it hwnd handle that can be any window's handle in attached VBA code ? or other setting I need
to set for hwnd input in oder to turn on or off monitor ?
ANd it doesn't work , is it because my montherboard not supporting the function ?
Please advise
Duncan
computer and I tried the code in the link, http://www.expertsexchange.com/Programming/Misc/Q_20840222.html
and set lparm in sendmessage API function from 1 or 2, But it doesn't have any response on
my monitor, Why ? lparm=2 is setting to turn off and 1 is setting for turn-on
Is it hwnd handle that can be any window's handle in attached VBA code ? or other setting I need
to set for hwnd input in oder to turn on or off monitor ?
ANd it doesn't work , is it because my montherboard not supporting the function ?
Please advise
Duncan
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long Private Const WM_SYSCOMMAND = &H112 Private Const SC_MONITORPOWER = &HF170Sub Monitor()Dim hwnd As Longhwnd = GetForegroundWindow()Call SendMessage(hwnd, WM_SYSCOMMAND, SC_MONITORPOWER, 2)End Sub 1:2:3:4:5:6:7:8:
Author: duncanb7 replied at 2024-10-13 06:55:12
please don't use Net User Administrator /active:no if it is only one account in xp such as only Administrator
and otherwise you will be locked and could not login into computer again besides you need
to reboot the comptuer into safe mode.
THe final solution is
1- type command at command line or run with "control userpassword2s , check the box the
password require during login and then select your account in the account name menu right below
the box that action is for putting your account in first priority or as deafult login name and password
for auto login process , and then uncheck the password require for login box in order to
enable auto login process with your default your login name and password, so next time
you will be automatically logging into Xp without typing your login and password from hiberation mode
2-use rt = SetThreadExecutionState(ES_DISPLAY_REQUIRED) in the VBA code and put the code
into xls's workbook_open() sub in Thisworkbook module and set the xls file as one schedule task to wake up the computer from sleep or hiberation mode and the monitor will be wake up by the setThreadExecutionState()
3-go to start menu/control-panel/power management option/advance tab/ and uncheck the box for password require when computer is wkae up from hiberation mode
Now I can wake my xp computer and also wake up monitor for any other schedule task or program work which must need monitor is on. (Of course most of schedule task program or update is no need monitor on)
and otherwise you will be locked and could not login into computer again besides you need
to reboot the comptuer into safe mode.
THe final solution is
1- type command at command line or run with "control userpassword2s , check the box the
password require during login and then select your account in the account name menu right below
the box that action is for putting your account in first priority or as deafult login name and password
for auto login process , and then uncheck the password require for login box in order to
enable auto login process with your default your login name and password, so next time
you will be automatically logging into Xp without typing your login and password from hiberation mode
2-use rt = SetThreadExecutionState(ES_DISPLAY_REQUIRED) in the VBA code and put the code
into xls's workbook_open() sub in Thisworkbook module and set the xls file as one schedule task to wake up the computer from sleep or hiberation mode and the monitor will be wake up by the setThreadExecutionState()
3-go to start menu/control-panel/power management option/advance tab/ and uncheck the box for password require when computer is wkae up from hiberation mode
Now I can wake my xp computer and also wake up monitor for any other schedule task or program work which must need monitor is on. (Of course most of schedule task program or update is no need monitor on)
Accepted Solution
Author: duncanb7 replied at 2024-10-13 06:54:35
please don't use Net User Administrator /active:no if it is only one account in xp such as only Administrator
and otherwise you will be locked and could not login into computer again besides you need
to reboot the comptuer into safe mode.
THe final solution is
1- type command at command line or run with "control userpassword2s , check the box the
password require during login and then select your account in the account name menu right below
the box that action is for putting your account in first priority or as deafult login name and password
for auto login process , and then uncheck the password require for login box in order to
enable auto login process with your default your login name and password, so next time
you will be automatically logging into Xp without typing your login and password from hiberation mode
2-use rt = SetThreadExecutionState(ES_DISPLAY_REQUIRED) in the VBA code and put the code
into xls's workbook_open() sub in Thisworkbook module and set the xls file as one schedule task to wake up the computer from sleep or hiberation mode and the monitor will be wake up by the setThreadExecutionState()
3-go to start menu/control-panel/power management option/advance tab/ and uncheck the box for password require when computer is wkae up from hiberation mode
Now I can wake my xp computer and also wake up monitor for any other schedule task or program work which must need monitor is on. (Of course most of schedule task program or update is no need monitor on)
and otherwise you will be locked and could not login into computer again besides you need
to reboot the comptuer into safe mode.
THe final solution is
1- type command at command line or run with "control userpassword2s , check the box the
password require during login and then select your account in the account name menu right below
the box that action is for putting your account in first priority or as deafult login name and password
for auto login process , and then uncheck the password require for login box in order to
enable auto login process with your default your login name and password, so next time
you will be automatically logging into Xp without typing your login and password from hiberation mode
2-use rt = SetThreadExecutionState(ES_DISPLAY_REQUIRED) in the VBA code and put the code
into xls's workbook_open() sub in Thisworkbook module and set the xls file as one schedule task to wake up the computer from sleep or hiberation mode and the monitor will be wake up by the setThreadExecutionState()
3-go to start menu/control-panel/power management option/advance tab/ and uncheck the box for password require when computer is wkae up from hiberation mode
Now I can wake my xp computer and also wake up monitor for any other schedule task or program work which must need monitor is on. (Of course most of schedule task program or update is no need monitor on)
Expert: dlmille replied at 2024-10-12 08:34:15
You had asked why the Administrator cannot be disabled. Perhaps I misunderstood. I just gave you the command to deactivate Admin login.
Your question is how to autologin as Administrator?
Dave
Your question is how to autologin as Administrator?
Dave
Author: duncanb7 replied at 2024-10-12 04:16:10
What you mean if I type command at C:> Net User Administrator /active:no
but, Administrator will be disallowed login as well ?
I am only the user on my computer with window xp, and you
mean "but, Administrator will be disallowed login as well"
that I can not login my comptuer if type Net User Administrator /active:no
at command line.
Just want to auto login to my desktop screen without going through any login box
Please advise
Duncan
but, Administrator will be disallowed login as well ?
I am only the user on my computer with window xp, and you
mean "but, Administrator will be disallowed login as well"
that I can not login my comptuer if type Net User Administrator /active:no
at command line.
Just want to auto login to my desktop screen without going through any login box
Please advise
Duncan
Expert: dlmille replied at 2024-10-11 19:12:32
You can disable Administrator logon with the command prompt:
Net User Administrator /active:no
You should not get an Administrator login option after that - but, Administrator will be disallowed login as well.
Net User Administrator /active:no
You should not get an Administrator login option after that - but, Administrator will be disallowed login as well.
Author: duncanb7 replied at 2024-10-11 12:02:42
The problem is solved if using SetThreadExecutionState(ES_DISPLAY_REQUIRED)
and monitor is on once computer is startup from sleep mode, and
logon welcome page can be disabled by controluser account and uncheck welcome page option
but it is still existing Adminstrator logn box even welcome page is gone.
So the final issue is Adminstrator logon box can not be disabled , Why ?
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Private Declare Function SetThreadExecutionState Lib "kernel32" (ByVal esFlags As Long) As Long
Private Const ES_DISPLAY_REQUIRED = &H2
Private Sub workbook_open()
'Sleep 80000
Dim rt As Long
rt = SetThreadExecutionState(ES_DISPLAY_REQUIRED)
'for delete welcom login page on xp, just tye at command line, "control userpasswords2"
' for delete adminstrator login message box , read at http://www.ehow.com/how_5959387_stop-logon-startup-win-xp.html
Set WsShell = CreateObject("WScript.Shell")
'Sleep (1000)
'WsShell.Run ("TaskMgr.exe")
'Sleep (5000)
'WsShell.SendKeys ("sea")
'WsShell.SendKeys ("{enter}")
'this.Caption = Hex(rt)
End Sub
and monitor is on once computer is startup from sleep mode, and
logon welcome page can be disabled by controluser account and uncheck welcome page option
but it is still existing Adminstrator logn box even welcome page is gone.
So the final issue is Adminstrator logon box can not be disabled , Why ?
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Private Declare Function SetThreadExecutionState Lib "kernel32" (ByVal esFlags As Long) As Long
Private Const ES_DISPLAY_REQUIRED = &H2
Private Sub workbook_open()
'Sleep 80000
Dim rt As Long
rt = SetThreadExecutionState(ES_DISPLAY_REQUIRED)
'for delete welcom login page on xp, just tye at command line, "control userpasswords2"
' for delete adminstrator login message box , read at http://www.ehow.com/how_5959387_stop-logon-startup-win-xp.html
Set WsShell = CreateObject("WScript.Shell")
'Sleep (1000)
'WsShell.Run ("TaskMgr.exe")
'Sleep (5000)
'WsShell.SendKeys ("sea")
'WsShell.SendKeys ("{enter}")
'this.Caption = Hex(rt)
End Sub