I have VBA code to make sure the numlocks are on, but we I try to compile it it tells me it needs to be in 64bit. - Private Declare Sub keybd_event Lib "user32" ( _
-
ByVal bVk As Byte, _
-
ByVal bScan As Byte, _
-
ByVal dwFlags As Long, _
-
ByVal dwExtraInfo As Long)
-
Private Const VK_NUMLOCK = &H90
-
Private Const KEYEVENTF_KEYUP = &H2
-
Declare Function GetKeyState Lib "user32.dll" ( _
-
ByVal nVirtKey As Long) As Integer
-
-
Sub numon()
-
'NUM_Off
-
NUM_On
-
End Sub
-
-
Sub NUM_TOGGLE()
-
'Toggle NUM-Lock key state
-
keybd_event VK_NUMLOCK, 1, 0, 0
-
keybd_event VK_NUMLOCK, 1, KEYEVENTF_KEYUP, 0
-
End Sub
-
-
Sub NUM_On() 'Turn NUM-Lock on
-
If Not (GetKeyState(vbKeyNumlock) = 1) Then
-
keybd_event VK_NUMLOCK, 1, 0, 0
-
keybd_event VK_NUMLOCK, 1, KEYEVENTF_KEYUP, 0
-
End If
-
End Sub
-
-
Sub NUM_Off() 'Turn NUM-Lock off
-
If (GetKeyState(vbKeyNumlock) = 1) Then
-
keybd_event VK_NUMLOCK, 1, 0, 0
-
keybd_event VK_NUMLOCK, 1, KEYEVENTF_KEYUP, 0
-
End If
-
-
End Sub
I do have 64bit, and I want to add this to all my database as we use the numpad a lot. We are so use to the numlocks being on all the time, but since we upgraded all our PC's to Win 10, the numlock always turns off.
Thanks a million for all your help.
11 3790 twinnyfo 3,653
Recognized Expert Moderator Specialist
DJ,
Actually, what you really want to do is change the num lock in the system settings. This is not a Win 10 thing, it is a Network System Administrator thing, in which, for some absolutely unknown reason, they are changing the system registry to default the system to Num Lock Off. - Press Win + R and type in Regedit
- Navigate to registry key HKEY_USERS\.Def ault\Control Panel\Keyboard
- Right-click on the “InitialKeyboar dIndicators”, select Modify and change Value data to 2.
- Exit and Save the Registry.
This may (probably) need to be done by an administrator.
There are ways to "trick" the Num Lock to switch, but my experiences with it have have been and miss. But, I admit I haven't tried it with Win 10, so that may be more stable--but again, the above does not answer your specific question about a 64-bit key for that value.
Concerning converting it to 64-bit, an initial guess would be add two leading zeroes to your value? But that is purely speculation.
Our system is locked out by our company IT. If I do it through VBA, it will fix it for everyone that uses one of my Databases. I only have user rights in my company(unfortu nately), so makes it very difficult do fix issues when they arise....
But thanks for your reply. I even did research on what you put and I guess the solution you put forth isn't a 100% fix for Win10.
When will microsoft get things right???
twinnyfo 3,653
Recognized Expert Moderator Specialist
So, when you compile your DB, it hangs on Line 6 above?
We've got 64-bit at work, too, and I've had no issues with compiling--and I use your same function for some other things I do. I am having no issues with toggling the Num Lock.
- Private Declare Sub keybd_event Lib "user32" ( _
Line 1 is where it hangs up when trying to compile.
Here is the error that pops up
Compile Error:
The code in this project must be updated for use on64-bit systems. Please review and update Declare statements and then mark them with PtrSafe attribute.
twinnyfo 3,653
Recognized Expert Moderator Specialist - Private Declare PtrSafe Sub keybd_event Lib "user32"
That did it, need it in 2 spots, but got it to compile. Now to test the code to make sure it works. I put this into a Module, I'm not 100% sure if this was the right place to put it.
Compiled Code: - Option Compare Database
-
Option Explicit
-
-
Private Declare PtrSafe Sub keybd_event Lib "user32" ( _
-
ByVal bVk As Byte, _
-
ByVal bScan As Byte, _
-
ByVal dwFlags As Long, _
-
ByVal dwExtraInfo As Long)
-
Private Const VK_NUMLOCK = &H90
-
Private Const KEYEVENTF_KEYUP = &H2
-
Declare PtrSafe Function GetKeyState Lib "user32.dll" ( _
-
ByVal nVirtKey As Long) As Integer
-
-
Sub numon()
-
'NUM_Off
-
NUM_On
-
End Sub
-
-
Sub NUM_TOGGLE()
-
'Toggle NUM-Lock key state
-
keybd_event VK_NUMLOCK, 1, 0, 0
-
keybd_event VK_NUMLOCK, 1, KEYEVENTF_KEYUP, 0
-
End Sub
-
-
Sub NUM_On() 'Turn NUM-Lock on
-
If Not (GetKeyState(vbKeyNumlock) = 1) Then
-
keybd_event VK_NUMLOCK, 1, 0, 0
-
keybd_event VK_NUMLOCK, 1, KEYEVENTF_KEYUP, 0
-
End If
-
End Sub
-
-
'Sub NUM_Off() 'Turn NUM-Lock off
-
' If (GetKeyState(vbKeyNumlock) = 1) Then
-
' keybd_event VK_NUMLOCK, 1, 0, 0
-
' keybd_event VK_NUMLOCK, 1, KEYEVENTF_KEYUP, 0
-
' End If
-
'
-
'End Sub
-
Trying to run this code, but cannot get it to trigger through an Autoexec macro(I know bad)
Would I put this in "On Open" event of the form? Would I need to put this onto every form as to make sure it runs for every form? Is there a way to run this a different way? Should I just use one of the subs and if so how would I call this out in my database?
Sorry for the multiple questions, but this is new territory for me.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Christian McArdle |
last post by:
REQUEST FOR DISCUSSION (RFD)
unmoderated group comp.os.ms-windows.programmer.64bit
This is a formal Request For Discussion (RFD) to create
comp.os.ms-windows.programmer.64bit as an unmoderated world-wide Usenet
newsgroup dedicated to the discussion of Microsoft Windows 64-bit
programming. This is not a Call for Votes (CFV); you cannot vote at
this time. Procedural details appear below. All followup discussion
should be crossposted to...
|
by: George |
last post by:
Every time I used the Sendkeys command in my application the "Numlock"
turned off and I couldn't use the keypad to hit numbers......
The old code was:
Private Sub Command1_Click()
SendKeys "{DOWN}"
SendKeys "^{END}"
SendKeys "{TAB}"
End Sub
|
by: James Kirkup |
last post by:
Hello,
Does anyone know in code how to turn the NumLock key on in C#?
with regards
James
*** Sent via Developersdex http://www.developersdex.com ***
|
by: Chris |
last post by:
can anyone out there tell me how do u check the state of
these keys in vb.net? or is there any components in
the .NET Framework that supports doing so? any help is
appreciated.
Thanks.
|
by: Woody Splawn |
last post by:
Could someone tell me what code I run to determine if the user's numlock is
on?
Is there code I can run to set the numlock to on?
| |
by: Stan Sainte-Rose |
last post by:
Hi
I saw a post about numlock but I can't not read it.
I would like to check the state of the numlock key
and if it's not active, set its status on active.
How can I accomplish that in vb ?
Stan
|
by: lgbjr |
last post by:
Hi All,
In VB.Net how do I determine if CapsLock is on/off (same for NumLock) and
whether the input mode is set to Insert or Overwrite (Insert Key). I just
added a status bar to my app, and I want to reflect the state of these three
items (similar to Word, Excel, etc.) I've found the key enumerator value for
each key, but I don't know how to tell if the state is on/off, etc.
TIA
Lee
|
by: legrape |
last post by:
I am porting a piece of C code to 64bit on Linux. I am using 64bit
integers. It is a floating point intensive code and when I compile
(gcc) on 64 bit machine, I don't see any runtime improvement when
optimizing -O3. If I construct a small program I can get significant
(>4x) speed improvement using -O3 versus -g. If I compile on a 32 bit
machine, it runs 5x faster on the 64 bit machine than does the 64bit
compiled code.
It seems like...
|
by: Z.K. |
last post by:
I am trying to detect if the Numlock is pressed. I can do it okay with
the CapsLock or the ScrLk, but not with NumLock. The code for all three
checks is exactly the same, but for some reason numlock always thinks it
is on.
Z.K.
code:
|
by: twinnyfo |
last post by:
OK Race fans, here's a whacky one:
In a separate module, I have these declarations:
Option Compare Database
Option Explicit
Public Declare Function GetTickCount Lib "kernel32" () As Long
Public Declare Function GetLastInputInfo Lib "user32" (pLII As Any) As Long
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |