|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
How to switch the monitor off through vb6 code?I need to switch the monitor off through visual basic 6.
I got the following code after surfing but has no effect on my monitor (IBM ThinkVision LCD). SendMessage HWND_BROADCAST, WM_SYSCOMMAND, SC_MONITORPOWER, 2& Can anyone help me out? <b.vijayabhara***@gmail.com> escribió en el mensaje de noticias
news:762fc726-e983-496d-bf74-48c959891c83@o6g2000pre.googlegroups.com... Option 1:>I need to switch the monitor off through visual basic 6. > I got the following code after surfing but has no effect on my monitor > (IBM ThinkVision LCD). > > SendMessage HWND_BROADCAST, WM_SYSCOMMAND, SC_MONITORPOWER, 2& > > Can anyone help me out? you must pass 'lParam' ByVal if you have declared it "ByRef As Any". SendMessage HWND_BROADCAST, WM_SYSCOMMAND, SC_MONITORPOWER, ByVal 2& Option 2 (I suggest you this one): use a safe delaration, 'lParam' ByVal and "As Long", and call it as you are doing now: Private Declare Function SendMessageLong Lib "user32.dll" _ Alias "SendMessageA" (ByVal hwnd As Long, _ ByVal wMsg As Long, _ ByVal wParam As Long, _ ByVal lParam As Long) As Long '... SendMessageLong HWND_BROADCAST, WM_SYSCOMMAND, SC_MONITORPOWER, 2& '... -- Regards - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ( ! ) http://groups.google.com/group/microsoft.public.vb.general.discussion ( i ) http://www.microsoft.com/communities/conduct/default.mspx - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Show quote
Hide quote
On Feb 14, 11:58 am, "Vinchenzo vinç" <Vinç@newsgroup.nospam> wrote: I tried everything.> <b.vijayabhara***@gmail.com> escribió en el mensaje de noticiasnews:762fc726-e983-496d-bf74-48c959891***@o6g2000pre.googlegroups.com... > > >I need to switch the monitor off through visual basic 6. > > I got the following code after surfing but has no effect on my monitor > > (IBM ThinkVision LCD). > > > SendMessage HWND_BROADCAST, WM_SYSCOMMAND, SC_MONITORPOWER, 2& > > > Can anyone help me out? > > Option 1: > you must pass 'lParam' ByVal if you have declared it "ByRef As Any". > > SendMessage HWND_BROADCAST, WM_SYSCOMMAND, SC_MONITORPOWER, ByVal 2& > > Option 2 (I suggest you this one): > use a safe delaration, 'lParam' ByVal and "As Long", and call it as you > are doing now: > > Private Declare Function SendMessageLong Lib "user32.dll" _ > Alias "SendMessageA" (ByVal hwnd As Long, _ > ByVal wMsg As Long, _ > ByVal wParam As Long, _ > ByVal lParam As Long) As Long > > '... > SendMessageLong HWND_BROADCAST, WM_SYSCOMMAND, SC_MONITORPOWER, 2& > '... > > -- > Regards > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > ( ! )http://groups.google.com/group/microsoft.public.vb.general.discussion > ( i )http://www.microsoft.com/communities/conduct/default.mspx > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Even tried the exact code you've given. But still I get no response. Is there anything I am missing? <b.vijayabhara***@gmail.com> escribió en el mensaje de noticias
news:57cc524d-2c2d-48d1-a1bc-c81fcb6e2ad4@w39g2000prb.googlegroups.com... I tried everything.On Feb 14, 11:58 am, "Vinchenzo vinç" <Vinç@newsgroup.nospam> wrote: > <b.vijayabhara***@gmail.com> escribió en el mensaje de > noticiasnews:762fc726-e983-496d-bf74-48c959891***@o6g2000pre.googlegroups.com... > > >I need to switch the monitor off through visual basic 6. > > I got the following code after surfing but has no effect on my monitor > > (IBM ThinkVision LCD). > Even tried the exact code you've given. But still I get no response. Is there anything I am missing? ----------------------------------- Have you tried to send a LowPower (1&) instead?. Take into account that two monitors of the same model installed in different computers with different OS can have different behaviour, for instance, I have one monitor on a Windows XP with XP's specific drivers that both notifications are executed as it should be. I have another monitor of the same model in a Vista system with its Vista specific drivers, the LowPower notification doesn't work, and the call returns always True and no dll error is generated. So it doesn't matter the monitor's model, if you are calling the function correctly and nothing happens, then I am sorry but I have no idea where the problem is. -- Regards - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ( ! ) http://groups.google.com/group/microsoft.public.vb.general.discussion ( i ) http://www.microsoft.com/communities/conduct/default.mspx - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - On Thu, 19 Feb 2009 19:38:54 +0100, "Vinchenzo vinç"
<Vinç@newsgroup.nospam> wrote: Have you tried it this way, http://www.Planet-Source-Code.com/vb/scripts/ShowCode.asp?txtCodeId=56393&lngWId=1 I just use the MonitorPowerDown function under XP, never tried the other functions or under Vista. Cheers, Ed
how to reposition desktop icons
WTF happened to my typelibs? lifecyle? how to check an ADO recordset status? How to Link ADO control to DATAGRID? More Regional Setting Woes Common Dialog Font - Color Choices Visual Basic 6 ActivexDLLs are not registering under Windows Vista Adding a right-click function to a control Run Unix command from Visual Basic |
|||||||||||||||||||||||