|
-
Aug 8th, 2002, 09:58 AM
#1
Thread Starter
Frenzied Member
Something VB will not do...
I can't believe it... I think I've actually found something that VB just will not do...
I can not, for the life of me, find a way to make vb trap keypresses without a control or form having to be in focus...
Does ANYBODY know how to do this???? Is it possible???
thanks,
Squirrelly1
Now happily married and still crankin' away at the keyboard.  Life is grand for a coder, no?
-
Aug 8th, 2002, 09:59 AM
#2
Frenzied Member
Set the form's keypreview property to True.
-
Aug 8th, 2002, 10:00 AM
#3
I wonder how many charact
That doesn't solve the chance if the user is working with another app.... I answered your question in your other thread Squirelly, and its called a keyhook. It can be done, but it should be done only if absolutely necessary.
-
Aug 8th, 2002, 10:07 AM
#4
I wonder how many charact
You might want to try this sample project from William Storage
http://bstorage.com/Downloadable/KeyHook.ZIP
-
Aug 8th, 2002, 10:13 AM
#5
Hyperactive Member
Something VB can't do, haha? How about multithread, run reliably as a service app(without a wrapper), etc. . There are plenty of them, but VB is still useful none the less.
Joe
-
Aug 8th, 2002, 10:26 AM
#6
joey.. you forgot interitence...
but most of that stuff VB "can't" do can be done in .NET
-
Aug 8th, 2002, 10:59 AM
#7
Hyperactive Member
Yes it can be done in .NET... to think all you have to do is sacrifice the convinient syntax conventions and learn an almost entirely new language .
-
Aug 8th, 2002, 11:02 AM
#8
yeah well it happens.... if new langauges didn't come around i would still be coding in COBOL
-
Aug 8th, 2002, 11:06 AM
#9
Hyperactive Member
At the risk of starting a .NET debate, I will make one point. VB exists for a few simple reason: ease to learn, ease to use, and RAD(rapid application development). When VB loses all of that you mine as well be using c++.
-
Aug 8th, 2002, 11:09 AM
#10
ok we won't have a debate... because honestly if we all love it or hate it... it is going to take over VB6 and nothing can stop it...
but I believe it still does have RAD without a doubt... it is still forms that you drag controls onto... all that is really different is it exposes more of the code behind what it is doing where as VB6 did not.. but it auto generates all that code for you.. so you can mess with it if you want.. or leave it alone..
all in all once we get in the groove of it... i am sure we will all like it... cander has been using it for a while i believe and he likes it a lot
-
Aug 8th, 2002, 11:09 AM
#11
VB .NET is still just as easy and fast to write to write. You just got more power options. It isnt any harder to learn than VB6 was.
-
Aug 8th, 2002, 11:10 AM
#12
Originally posted by kleinma
all in all once we get in the groove of it... i am sure we will all like it... cander has been using it for a while i believe and he likes it a lot
-
Aug 8th, 2002, 11:12 AM
#13
-
Aug 8th, 2002, 11:13 AM
#14
If the thread says .NET, Im there! 
I need to my sig to say 'Master of the D'uh .NET!'
-
Aug 8th, 2002, 11:14 AM
#15
Hyperactive Member
The transition between VB 5 to VB 6 was simple. For that matter so was VB 4 to VB 5. VB.NET is unlike any other BASIC language. If I want power, I will go to c++. If I want RAD, I will stick with VB 6, and if they become very insistent about .NET then I will switch to Delphi. It has some advantages already over VB, but came with a learning curve because I don't know PASCAL. PASCAL seems easier to learn than to begin memorizing the various changes to the BASIC language in .NET. But enough of this.
-
Aug 8th, 2002, 11:20 AM
#16
"then I will switch to Delphi"
Now that is what gets me. Alot of devs have said that they are going to switch to Delphi becuase they dont want to learn changes to .NET.
Can you not see the hypocrisy here? You dont want to learn the changes to .NET but you will learn a WHOLE brand new language?
-
Aug 8th, 2002, 12:02 PM
#17
What gets me is that the "changes" to VB that people are complaining about are the [B]things developers have been asking for for years![B] GASP! MS finally gave us what we've been asking for, inheritance, truer OOP, more power, various shorthand notations... etc. And yet these are the verythings that people are now complaining about. I say it's about time VB grew up. The only thing basic about it is its name. While it's fairly easy to learn, it has eveloved into a complex language. Having worked w/ MANY languages, incl Pascal (pre-Delphi), MSBASIC (When the BASIC part was really an acronym, not a description), C, ASM, Ada and others, I've come to one conclusion: When you boil it all down, most are pretty much the same (excepting COBOL, because, well, it's COBOL), syntax may vary, but an "if" statement is an "if" statement. It works the the same. If some condition is true, execute statement X otherwise execute statement Y. For loops, are the same way. You have a start assignment, an exit condition, a counter modifier, and statements to execute.
.NET is no different. It's just not what we are use to. I remember moving from InterDev 1 to InterDev 6 -- it was different, but I got use to it and learned its power.
Familiarty breeds complacentcy (sp?). I heard the same type of griping when Win95 came out, and again when XP came out. The interfaces changed dramaticaly and people weren't use to it.
Times change, things evolve. VB is finally starting to come into it's own.
-
Aug 8th, 2002, 12:27 PM
#18
I wonder how many charact
I love the fact that VB has evolved into vb.net, i think most people are just griping because the .NET framework has yet to be established on most consumer's computers. This obviously will not be the case a year from now, by then, I would imagine most people will have had the framework downloaded.. or there after purchasing a new computer. (And well, win95 consumers would be left in the cold, by i think they represent a small minority now, as my current website stats show)
And if MS could get the framework on UNIX machines... we would all be in programming heaven...
-
Aug 8th, 2002, 12:30 PM
#19
MS wont do anything official for *nix, but they did put out Rotor which is an unsupported .NET for FreeBSD and Ximian has an Open source .NET running on Linux. They just need to finish all the class libraries.
-
Aug 8th, 2002, 12:35 PM
#20
PowerPoster
Re: Something VB will not do...
Originally posted by squirrelly1
I can't believe it... I think I've actually found something that VB just will not do...
I can not, for the life of me, find a way to make vb trap keypresses without a control or form having to be in focus...
Does ANYBODY know how to do this???? Is it possible???
thanks,
Squirrelly1
Why not just use GetAsyncKeyState in a timer? That is how I do all my capturing of keys when the program is not in focus. The only draw back is you have to be expecting the key, you can't just log all keys that get pressed, not very easily anyway.
-
Aug 8th, 2002, 12:39 PM
#21
Thread Starter
Frenzied Member
been tryin'
I've been trying something like that, but I can't seem to get it right...
Could you post some code for me???
thnx,
Squirrelly1
Now happily married and still crankin' away at the keyboard.  Life is grand for a coder, no?
-
Aug 8th, 2002, 12:43 PM
#22
PowerPoster
VB Code:
Private Declare Function GetAsyncKeyState Lib "user32.dll" (ByVal vKey As Long) As Integer
Private Const VK_A = &H41 'just take one of the keycodes from the txt file attached.
'set the timer interval to 1
Private Sub Timer1_Timer()
If GetAsyncKeyState(VK_A) <> 0 Then
MsgBox "The A key was pressed."
End If
End Sub
Attached is a list of virtual keycodes you can use in place of the A
-
Aug 8th, 2002, 12:44 PM
#23
-
Aug 8th, 2002, 12:54 PM
#24
Hyperactive Member
The Question:
That method is horribly resource intensive. You are much better off using a keyboard hook.
VB.NET:
It is not hypocrisy. I acknowledged that it would entail learning a new language, but as was stated most languages are pretty similar. If I am going to invest time into a new learning curve, I will invest it in a product I feel is superior. Delphi has proven its stability and portability thus far. VB.NET is new. It's experimental, and it strays from the fundamental ease that was associated with programming with VB. C++ has always been superior to VB in terms of power so if I desire power, I will stick with that, but as for ease of use I still much much much prefer VB 6.0 to .NET.
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
|