Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Modules / DAO / VBA / March 2008

Tip: Looking for answers? Try searching our database.

Send the "Scroll Lock: command using access VB

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Mark - 20 Mar 2008 16:14 GMT
Hello all,

I need my program to send a double push of the Scroll lock button to the PC.
Is there a way to send this command, and if so, what function do I use?

Thanks for any guidance on where to start.

Mark
Klatuu - 20 Mar 2008 18:11 GMT
What do you mean by "to the PC"?

You might be able to use the SendKeys method.  Look in VBA Help and see if
it will do what you want.
Signature

Dave Hargis, Microsoft Access MVP

> Hello all,
>
[quoted text clipped - 4 lines]
>
> Mark
Mark - 20 Mar 2008 18:48 GMT
I'm trying to send the command to a KVM switch.  If you double press "Scroll
Lock" it changes you to another computer screen.  I'm trying to do this from
with in a program.  The sendkeys is what I need, but I'm still looking for
the code the Scroll Lock button produces.

> What do you mean by "to the PC"?
>
[quoted text clipped - 9 lines]
> >
> > Mark
Klatuu - 20 Mar 2008 19:07 GMT
I don't believe it returns an ascii code you can capture.
I would suggest finding out what value the switch expects and see if you can
duplicate that.

Signature

Dave Hargis, Microsoft Access MVP

> I'm trying to send the command to a KVM switch.  If you double press "Scroll
> Lock" it changes you to another computer screen.  I'm trying to do this from
[quoted text clipped - 14 lines]
> > >
> > > Mark
Douglas J. Steele - 20 Mar 2008 19:18 GMT
Does http://www.mvps.org/access/api/api0046.htm work in this case?

Signature

Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)

>I don't believe it returns an ascii code you can capture.
> I would suggest finding out what value the switch expects and see if you
[quoted text clipped - 25 lines]
>> > >
>> > > Mark
Stuart McCall - 20 Mar 2008 19:37 GMT
> I'm trying to send the command to a KVM switch.  If you double press
> "Scroll
[quoted text clipped - 19 lines]
>> >
>> > Mark

1. Create a form and place a command button on it, called Command0
2. Paste the following code into the form's class module
3. Open the form and click the button
4. If it works (ie you switch ok) then fine. If not, play with the sleep
command till it works <g>

''' BEGIN CODE '''
Private Declare Sub keybd_event Lib "user32.dll" _
 (ByVal bVk As Byte, ByVal bScan As Byte, _
 ByVal dwFlags As Long, ByVal dwExtraInfo As Long)

Private Declare Sub Sleep Lib "kernel32" _
 (ByVal dwMilliseconds As Long)

Const VK_SCROLL = &H91
Const KEYEVENTF_KEYUP = &H2

Private Sub Command0_Click()
   keybd_event VK_SCROLL, 0, 0, 0               'Press Scroll Lock
   keybd_event VK_SCROLL, 0, KEYEVENTF_KEYUP, 0 'Release Scroll Lock
   Sleep 100                                    'Wait a bit
   keybd_event VK_SCROLL, 0, 0, 0               'Press Scroll Lock
   keybd_event VK_SCROLL, 0, KEYEVENTF_KEYUP, 0 'Release Scroll Lock
End Sub
''' END CODE '''
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.