|
-
Dec 6th, 2004, 10:48 AM
#1
Thread Starter
Lively Member
-
Dec 6th, 2004, 11:21 AM
#2
Hyperactive Member
Re: show if caps is on ?
I think you can do it, would be an API call to find out if caps are on or off!
Then just display in a textbox. Never tried
Mudfish AKA Bowfin
I can spell "If" all day right, just a coder!
"Always do sober what you said you'd do drunk. That will teach you to keep your mouth shut." -- Ernest Hemingway
Member of the ECCC

-
Dec 6th, 2004, 11:24 AM
#3
Thread Starter
Lively Member
Re: show if caps is on in text box ?
isnt there a way without a api..?
got some code i could work from ?
I declare myself n00B
i got kicked out of barnes and noble once for moving all the bibles into the fiction section"--FD
Of course I'm a real doctor! I'll draw up my own diploma some time to prove it!-Dr Dis
-
Dec 6th, 2004, 11:32 AM
#4
Lively Member
Re: show if caps is on in text box ?
Here is an explanation of how to do it. I dont think you can without an API.
http://www.mentalis.org/apilist/GetKeyState.shtml
-
Dec 6th, 2004, 11:33 AM
#5
PowerPoster
Re: show if caps is on in text box ?
You could use the keypress event and check if the ascii value is in the "caps" range.
 Originally Posted by Neo-dark
isnt there a way without a api..?
got some code i could work from  ?
I declare myself n00B
-
Dec 6th, 2004, 11:33 AM
#6
Hyperactive Member
Re: show if caps is on in text box ?
Look on your machine for a program called APIloader.exe (Think I spelled it right).
I think you would have to use the API!
I have lots of API code but nothing like this.
Mudfish AKA Bowfin
I can spell "If" all day right, just a coder!
"Always do sober what you said you'd do drunk. That will teach you to keep your mouth shut." -- Ernest Hemingway
Member of the ECCC

-
Dec 6th, 2004, 12:07 PM
#7
Hyperactive Member
Re: show if caps is on in text box ?
It is APILOAD.exe
Mudfish AKA Bowfin
I can spell "If" all day right, just a coder!
"Always do sober what you said you'd do drunk. That will teach you to keep your mouth shut." -- Ernest Hemingway
Member of the ECCC

-
Dec 6th, 2004, 12:09 PM
#8
Thread Starter
Lively Member
-
Dec 6th, 2004, 12:11 PM
#9
Thread Starter
Lively Member
Re: show if caps is on in text box ?
i tried typing in'capital' and CAPS but found nothing on both :'( it would be the same effect for scrl lock and such right ? imma look for it again on the search
i got kicked out of barnes and noble once for moving all the bibles into the fiction section"--FD
Of course I'm a real doctor! I'll draw up my own diploma some time to prove it!-Dr Dis
-
Dec 6th, 2004, 12:14 PM
#10
Hyperactive Member
Re: show if caps is on in text box ?
To load it you must first click File then load text.
Then pick win32api.txt
Mudfish AKA Bowfin
I can spell "If" all day right, just a coder!
"Always do sober what you said you'd do drunk. That will teach you to keep your mouth shut." -- Ernest Hemingway
Member of the ECCC

-
Dec 6th, 2004, 12:18 PM
#11
Thread Starter
Lively Member
Re: show if caps is on in text box ?
i did that :P it dint find anything bout caps,like i said before im looking for code now i found some but where should i place this..?
Code:
Private Declare Function GetKeyboardState Lib "user32" (pbKeyState As Byte) As Long
Private Declare Function SetKeyboardState Lib "user32" (lppbKeyState As Byte) As Long
Private Const VK_CAPITAL = &H14
Private Const VK_NUMLOCK = &H90
Private Const VK_SCROLL = &H91
ReDim KeyboardBuffer(256) As Byte
GetKeyboardState KeyboardBuffer(0)
'This example show you how to press the Caps Lock button. if you want
'to press the Num Lock button, Replace all the following 3 'VK_CAPITAL'
'with 'VK_NUMLOCK' or VK_SCROLL as desired.
If KeyboardBuffer(VK_CAPITAL) And 1 Then
KeyboardBuffer(VK_CAPITAL) = 0
Else
KeyboardBuffer(VK_CAPITAL) = 1
End If
SetKeyboardState KeyboardBuffer(0)
Private Declare Function GetKeyState Lib "user32" (ByVal nVirtKey As Long) As Integer
'To check if Num Lock is on Replace the 'vbKeyCapital' below with 'vbKeyNumlock'
Dim lngWhatState As Long
lngWhatState = GetKeyState(vbKeyCapital)
If lngWhatState = 1 Then
MsgBox "The Caps Lock Is On"
Else
MsgBox "The Caps Lock Is Off"
End If
i got kicked out of barnes and noble once for moving all the bibles into the fiction section"--FD
Of course I'm a real doctor! I'll draw up my own diploma some time to prove it!-Dr Dis
-
Dec 6th, 2004, 12:19 PM
#12
Hyperactive Member
Re: show if caps is on in text box ?
Declare Function GetKeyboardState Lib "user32" Alias "GetKeyboardState" (pbKeyState As Byte) As Long
That what I found all so! Do not know how it work google "GetKeyboardState"
and see what you find
Mudfish AKA Bowfin
I can spell "If" all day right, just a coder!
"Always do sober what you said you'd do drunk. That will teach you to keep your mouth shut." -- Ernest Hemingway
Member of the ECCC

-
Dec 6th, 2004, 12:27 PM
#13
Thread Starter
Lively Member
Re: show if caps is on in text box ?
coulnd find nothing big im trying it ou on a form i hope it works...
i got kicked out of barnes and noble once for moving all the bibles into the fiction section"--FD
Of course I'm a real doctor! I'll draw up my own diploma some time to prove it!-Dr Dis
-
Dec 6th, 2004, 12:36 PM
#14
Thread Starter
Lively Member
Re: show if caps is on in text box ?
nope wont function i tried putting it in a module,class,ect but it works in nothing..? i dunno where to place itttt :'(
i am such a n00b
i got kicked out of barnes and noble once for moving all the bibles into the fiction section"--FD
Of course I'm a real doctor! I'll draw up my own diploma some time to prove it!-Dr Dis
-
Dec 6th, 2004, 12:40 PM
#15
Hyperactive Member
Re: show if caps is on in text box ?
You must declare it like this
Code:
Option Explicit
Private Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA" _
(ByVal lpBuffer As String, nSize As Long) As Long
This at the top of a form.
Mudfish AKA Bowfin
I can spell "If" all day right, just a coder!
"Always do sober what you said you'd do drunk. That will teach you to keep your mouth shut." -- Ernest Hemingway
Member of the ECCC

-
Dec 6th, 2004, 12:42 PM
#16
Hyperactive Member
Re: show if caps is on in text box ?
Then in form load I call it.
Code:
If GetUserName(strUserName_Form_Load, Len(strUserName_Form_Load)) = 0 Then
MsgBox "Unable to get user ID. Program terminating", , "PBDT120 - ERROR"
Unload Me
Else
strUserID_Form_Load = Left$(strUserName_Form_Load, InStr(strUserName_Form_Load, Chr$(0)) - 1)
End If
Mudfish AKA Bowfin
I can spell "If" all day right, just a coder!
"Always do sober what you said you'd do drunk. That will teach you to keep your mouth shut." -- Ernest Hemingway
Member of the ECCC

-
Dec 6th, 2004, 12:44 PM
#17
Thread Starter
Lively Member
Re: show if caps is on in text box ?
Its keeps giving me the line"compile error: invalid outside call procedure"
i got kicked out of barnes and noble once for moving all the bibles into the fiction section"--FD
Of course I'm a real doctor! I'll draw up my own diploma some time to prove it!-Dr Dis
-
Dec 6th, 2004, 12:45 PM
#18
Thread Starter
Lively Member
Re: show if caps is on in text box ?
really thanks allot for helping me find it out this is my code right now:
Code:
Option Explicit
Private Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA" _
(ByVal lpBuffer As String, nSize As Long) As Long
Private Declare Function GetKeyboardState Lib "user32" (pbKeyState As Byte) As Long
Private Declare Function SetKeyboardState Lib "user32" (lppbKeyState As Byte) As Long
Private Const VK_CAPITAL = &H14
Private Const VK_NUMLOCK = &H90
Private Const VK_SCROLL = &H91
ReDim KeyboardBuffer(256) As Byte
GetKeyboardState KeyboardBuffer(0)
'This example show you how to press the Caps Lock button. if you want
'to press the Num Lock button, Replace all the following 3 'VK_CAPITAL'
'with 'VK_NUMLOCK' or VK_SCROLL as desired.
If KeyboardBuffer(VK_CAPITAL) And 1 Then
KeyboardBuffer(VK_CAPITAL) = 0
Else
KeyboardBuffer(VK_CAPITAL) = 1
End If
SetKeyboardState KeyboardBuffer(0)
Private Declare Function GetKeyState Lib "user32" (ByVal nVirtKey As Long) As Integer
'To check if Num Lock is on Replace the 'vbKeyCapital' below with 'vbKeyNumlock'
Dim lngWhatState As Long
lngWhatState = GetKeyState(vbKeyCapital)
If lngWhatState = 1 Then
MsgBox "The Caps Lock Is On"
Else
MsgBox "The Caps Lock Is Off"
End If
Private Sub Form_Load()
If GetUserName(strUserName_Form_Load, Len(strUserName_Form_Load)) = 0 Then
MsgBox "Unable to get user ID. Program terminating", , "PBDT120 - ERROR"
Unload Me
Else
strUserID_Form_Load = Left$(strUserName_Form_Load, InStr(strUserName_Form_Load, Chr$(0)) - 1)
End If
End Sub
i got kicked out of barnes and noble once for moving all the bibles into the fiction section"--FD
Of course I'm a real doctor! I'll draw up my own diploma some time to prove it!-Dr Dis
-
Dec 6th, 2004, 12:53 PM
#19
Re: show if caps is on in text box ?
Try this.
Code:
Option Explicit
Private Type KeyboardBytes
kbByte(0 To 255) As Byte
End Type
Private Declare Function GetKeyboardState Lib "user32" (kbArray As KeyboardBytes) As Long
Private Const VK_CAPITAL = &H14
Private Const VK_NUMLOCK = &H90
Private Const VK_SCROLL = &H91
Private Sub Text1_GotFocus()
Dim KeyboardBuffer As KeyboardBytes
GetKeyboardState KeyboardBuffer
If KeyboardBuffer.kbByte(VK_CAPITAL) = 0 Then
MsgBox "Caps off"
Else
MsgBox "Caps on"
End If
End Sub
-
Dec 6th, 2004, 12:54 PM
#20
Hyperactive Member
Re: show if caps is on in text box ?
Option Explicit
Private Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA" _
(ByVal lpBuffer As String, nSize As Long) As Long
Private Declare Function GetKeyboardState Lib "user32" (pbKeyState As Byte) As Long
Private Declare Function SetKeyboardState Lib "user32" (lppbKeyState As Byte) As Long
Private Declare Function GetKeyState Lib "user32" (ByVal nVirtKey As Long) As Integer
Private Const VK_CAPITAL = &H14
Private Const VK_NUMLOCK = &H90
Private Const VK_SCROLL = &H91
ReDim KeyboardBuffer(256) As Byte
GetKeyboardState KeyboardBuffer(0)
'This example show you how to press the Caps Lock button. if you want
'to press the Num Lock button, Replace all the following 3 'VK_CAPITAL'
'with 'VK_NUMLOCK' or VK_SCROLL as desired.
If KeyboardBuffer(VK_CAPITAL) And 1 Then
KeyboardBuffer(VK_CAPITAL) = 0
Else
KeyboardBuffer(VK_CAPITAL) = 1
End If
SetKeyboardState KeyboardBuffer(0)
Private Declare Function GetKeyState Lib "user32" (ByVal nVirtKey As Long) As Integer
'To check if Num Lock is on Replace the 'vbKeyCapital' below with 'vbKeyNumlock'
Dim lngWhatState As Long
lngWhatState = GetKeyState(vbKeyCapital)
If lngWhatState = 1 Then
MsgBox "The Caps Lock Is On"
Else
MsgBox "The Caps Lock Is Off"
End If
Private Sub Form_Load()
Call lngWhatState
If GetUserName(strUserName_Form_Load, Len(strUserName_Form_Load)) = 0 Then
MsgBox "Unable to get user ID. Program terminating", , "PBDT120 - ERROR"
Unload Me
Else
strUserID_Form_Load = Left$(strUserName_Form_Load, InStr(strUserName_Form_Load, Chr$(0)) - 1)
End If
End Sub
This might work I moved " Private Declare Function GetKeyState Lib "user32" (ByVal nVirtKey As Long) As Integer" and call the funtion in form load
Mudfish AKA Bowfin
I can spell "If" all day right, just a coder!
"Always do sober what you said you'd do drunk. That will teach you to keep your mouth shut." -- Ernest Hemingway
Member of the ECCC

-
Dec 6th, 2004, 12:56 PM
#21
Hyperactive Member
Re: show if caps is on in text box ?
Marty, his code looks better
Mudfish AKA Bowfin
I can spell "If" all day right, just a coder!
"Always do sober what you said you'd do drunk. That will teach you to keep your mouth shut." -- Ernest Hemingway
Member of the ECCC

-
Dec 6th, 2004, 12:56 PM
#22
Thread Starter
Lively Member
Re: show if caps is on in text box ?
marti,mudfish,i have 2 new gods
[]bows[]it works now thanks allot :> im so happy now i cant thank you enough :>
i got kicked out of barnes and noble once for moving all the bibles into the fiction section"--FD
Of course I'm a real doctor! I'll draw up my own diploma some time to prove it!-Dr Dis
-
Dec 6th, 2004, 12:58 PM
#23
Re: show if caps is on in text box ?
 Originally Posted by Neo-dark
marti,mudfish,i have 2 new gods
[]bows[]it works now  thanks allot :> im so happy now  i cant thank you enough :>
Glad we could help. Now please help us by editing the first post and adding the green checkmark.
-
Dec 6th, 2004, 01:01 PM
#24
Thread Starter
Lively Member
Re: show if caps is on in text box ?
TADAAAA :P done it so much of my post are left un-awnsered..i guess i always ask hard questions ?:P
i got kicked out of barnes and noble once for moving all the bibles into the fiction section"--FD
Of course I'm a real doctor! I'll draw up my own diploma some time to prove it!-Dr Dis
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|