input in windows
input in windows
Is there any kind of input or inkey command that I can use in windows gui
mode. Keydown or getkey or something to to get keyboard input to program. If not is their a windows API I could Use?
mode. Keydown or getkey or something to to get keyboard input to program. If not is their a windows API I could Use?
It took 73 years to make me this stupid!
____________________________________
Athalon XP2200, Soltek Sln75 Mobo 512 DDR
____________________________________
Athalon XP2200, Soltek Sln75 Mobo 512 DDR
Re: input in windows
You can use the InputRequester() command, or try these:
viewtopic.php?t=2412
viewtopic.php?t=3758
Hope they help!
viewtopic.php?t=2412
viewtopic.php?t=3758
Hope they help!
New Input Request & GetKey
I finally got copies of those files PB made but they won't run. Apparently they can't find a function called getasynckeystate_. It said it mite not be in demo. Could anyone tell me if its not in demo and if its a function someone has made up how can I get a copy of it?
It took 73 years to make me this stupid!
____________________________________
Athalon XP2200, Soltek Sln75 Mobo 512 DDR
____________________________________
Athalon XP2200, Soltek Sln75 Mobo 512 DDR
Re: New Input Request & GetKey
> It said it mite not be in demo.
It's a Win32 API command; these are not supported in the PureBasic demo.
You didn't mention you were using the demo, so how were we to know?
It's a Win32 API command; these are not supported in the PureBasic demo.
You didn't mention you were using the demo, so how were we to know?
Windows input
That is extremely depressing! I've purchased 3 different Basic dialects and each one has come up with some dam thing I can't figure out how to make
it do? I'm not going to buy another with out being able to thoroughly check it out. Paul, I found that Addkeybdshortcut command in the Docs and I went through everyone of the examples and it was only used in 1. I'll be darned if I can figure out from that example how I could use it. I was looking at KeyboardPushed command. I mite be able to use it to replace that GetKey Function of PB's. Does any one know how I could find a way to separate caps from lower case? I'm getting a world class headache.
it do? I'm not going to buy another with out being able to thoroughly check it out. Paul, I found that Addkeybdshortcut command in the Docs and I went through everyone of the examples and it was only used in 1. I'll be darned if I can figure out from that example how I could use it. I was looking at KeyboardPushed command. I mite be able to use it to replace that GetKey Function of PB's. Does any one know how I could find a way to separate caps from lower case? I'm getting a world class headache.
It took 73 years to make me this stupid!
____________________________________
Athalon XP2200, Soltek Sln75 Mobo 512 DDR
____________________________________
Athalon XP2200, Soltek Sln75 Mobo 512 DDR
-
TerryHough
- Enthusiast

- Posts: 781
- Joined: Fri Apr 25, 2003 6:51 pm
- Location: NC, USA
- Contact:
@RedRebel
Sounds like you may be just coming to Windows programming from a
text based system.
You will find Windows (or GUI) isn't nearly as easy to gather input in
some ways and easier in others. You just have to climb the learning
curve.
Go review the PB Help file for the StringGadget and the related
GetGadgetText and SetGadgetText.
Just remember that Windows doesn't recognize the "Return" or "Enter"
key as the end of a text input like a DOS does. Sure, you can make it
do that. PB and Paul have both posted code that will help you there.
But, PB's code requires the use of the WinAPI. The PB Demo does
not support the use of the WinAPI. I was very frustrated myself by
that, but then decided to spend the money and buy PB.
Now, I am very happily creating programs and learning more every
day about using PB with Windows 98SE. In fact I am ecstatic. I rewrote
one 2.3Mb program in PB and duplicated every single function of that
program. The result was a 40Kb exe which can be compressed to as
little as 17Kb if I need to. I sure couldn't have done that without
PureBasic.
So, hang in there. Read this forum for great ideas and examples. The
people here are very generous of their time and in providing answers and
example code.
Regards,
Terry
Sounds like you may be just coming to Windows programming from a
text based system.
You will find Windows (or GUI) isn't nearly as easy to gather input in
some ways and easier in others. You just have to climb the learning
curve.
Go review the PB Help file for the StringGadget and the related
GetGadgetText and SetGadgetText.
Just remember that Windows doesn't recognize the "Return" or "Enter"
key as the end of a text input like a DOS does. Sure, you can make it
do that. PB and Paul have both posted code that will help you there.
But, PB's code requires the use of the WinAPI. The PB Demo does
not support the use of the WinAPI. I was very frustrated myself by
that, but then decided to spend the money and buy PB.
Now, I am very happily creating programs and learning more every
day about using PB with Windows 98SE. In fact I am ecstatic. I rewrote
one 2.3Mb program in PB and duplicated every single function of that
program. The result was a 40Kb exe which can be compressed to as
little as 17Kb if I need to. I sure couldn't have done that without
PureBasic.
So, hang in there. Read this forum for great ideas and examples. The
people here are very generous of their time and in providing answers and
example code.
Regards,
Terry
RedRebel,
What is it exactly you are trying to achieve. It may be there is a method for doing it that will not need an API call.
Are you writing a game that requires keyboard input? Are you trying to add a shortcut to a dialog? Perhaps you are trying to filter out certain key presses?
If you tell us what, conceptually, you are tyring to do perhaps we could provide you with a demo. If it does require something not accessible in the Demo then I'd be happy to supply you with both soure and executable to demonstrate that it can be done.
What is it exactly you are trying to achieve. It may be there is a method for doing it that will not need an API call.
Are you writing a game that requires keyboard input? Are you trying to add a shortcut to a dialog? Perhaps you are trying to filter out certain key presses?
If you tell us what, conceptually, you are tyring to do perhaps we could provide you with a demo. If it does require something not accessible in the Demo then I'd be happy to supply you with both soure and executable to demonstrate that it can be done.
Red Rebel,
I was able to write a simple program that shows how to get the keyboard input for a window that works in the demo version.
Obviously this is easier with the registered version.
It works by capturing the WM_KeyDown and WM_KeyUp events. This is exactly the same as the OnKeyUp and OnKeyDown events in VisualBasic.
Is this the type of thing you were looking to do?
I'm new to PureBasic, but I'm now confident enough to say it can do anything you want. How did the other dialects let you down?
I was able to write a simple program that shows how to get the keyboard input for a window that works in the demo version.
Obviously this is easier with the registered version.
It works by capturing the WM_KeyDown and WM_KeyUp events. This is exactly the same as the OnKeyUp and OnKeyDown events in VisualBasic.
Is this the type of thing you were looking to do?
I'm new to PureBasic, but I'm now confident enough to say it can do anything you want. How did the other dialects let you down?
Code: Select all
#MainWindow = 0
#Key = 0
#WM_KEYDOWN = $100
#WM_KEYUP = $101
#WM_SYSKEYDOWN =$104
#WM_SYSKEYUP = $105
#CtrlKeyCode = 17
#ShiftKeyCode = 16
#aKeyCode = 65
#zKeyCode = 90
CtrlModifier$ = ""
ShirtModifier$ = ""
If OpenWindow(0, 0, 0, 200, 20, #PB_Window_SystemMenu | #PB_Window_TitleBar, "Keyboard Input") = 0
MessageRequester("Fatal Error", "Error Opening Window", #PB_MessageRequester_OK)
End
EndIf
If CreateGadgetList(WindowID(0)) = 0
MessageRequester("Fatal Error", "Error Creating Gadget List", #PB_MessageRequester_OK)
End
EndIf
TextGadget(#Key, 0, 0, 200, 20, "")
Event = 0
Repeat
Event = WaitWindowEvent()
wParam = EventwParam()
Select event
Case #WM_KEYDOWN
Select wParam
Case #CtrlKeyCode
CtrlModifier$ = "CTRL-"
Case #ShiftKeyCode
ShiftModifier$ = "SHIFT-"
Default
If wParam >= #aKeyCode And wParam <= #zKeyCode
SetGadgetText(#Key, CtrlModifier$ + ShiftModifier$ + Chr(wParam + 1 - aKeyCode))
EndIf
EndSelect
Case #WM_KEYUP
Select wParam
Case #CtrlKeyCode
CtrlModifier$ = ""
Case #ShiftKeyCode
ShiftModifier$ = ""
EndSelect
EndSelect
Until Event = #PB_Event_CloseWindow
I am re-writing a check register program I wrote in Basic PDS 7.11 !!
It requires a lot of keyboard input. I probably could write it as a console program but it wouldn't end up as nice looking. It looks exactly like your check book. There isn't a list box in site. You can use a mouse but I prefer selecting stuff with the keyboard. I've got carpal tunnel syndrome from using the little rats! ! I will digest both of your advices and tryout this program you posted. It could have possibilities. Thanx for all your help.
It requires a lot of keyboard input. I probably could write it as a console program but it wouldn't end up as nice looking. It looks exactly like your check book. There isn't a list box in site. You can use a mouse but I prefer selecting stuff with the keyboard. I've got carpal tunnel syndrome from using the little rats! ! I will digest both of your advices and tryout this program you posted. It could have possibilities. Thanx for all your help.
It took 73 years to make me this stupid!
____________________________________
Athalon XP2200, Soltek Sln75 Mobo 512 DDR
____________________________________
Athalon XP2200, Soltek Sln75 Mobo 512 DDR


