ExamineKeayboard() and compiler...
ExamineKeayboard() and compiler...
Hi folks,
I have a strange problem : When I run the debugger I get the message :
"OpenScreen() or OpenWindowedScreen must be called before use the keyboardcommands."
I have the same kind of message when I try the command 'ExamineMouse'.
I am using the command "OpenWindow()" and the program runs fine (the keyboard is manage), it only happened when debugging.
Any idea ????
Thks,
WW
I have a strange problem : When I run the debugger I get the message :
"OpenScreen() or OpenWindowedScreen must be called before use the keyboardcommands."
I have the same kind of message when I try the command 'ExamineMouse'.
I am using the command "OpenWindow()" and the program runs fine (the keyboard is manage), it only happened when debugging.
Any idea ????
Thks,
WW
Beware of the man who has the solution before he understands the problem...
- netmaestro
- PureBasic Bullfrog
- Posts: 8451
- Joined: Wed Jul 06, 2005 5:42 am
- Location: Fort Nelson, BC, Canada
Those are screen commands. In PureBasic you can open a screen with OpenScreen, or a windowed screen with OpenWindowedScreen, or simpy open a window with OpenWindow. In the first two cases InitSprite() must be called first to initialize a directx7 environment, which is the environment required for the keyboard and mouse libraries. You don't need these at all for a standard GUI application, they're more suited to games.
BERESHEIT
I use ExamineKeyboards() without a screen too. for that reason I disabled the debugger at the keyboard commands.Skipsy wrote:Well... It sounds "logic" but in this case I don't understand why the
keyboeards and mouse commands work perfectly... Until I use the debugger (?)
Still strange
It makes possible to catch keyboard events from all window application without the use of API which comes very handy and works fine on all tested plattforms.
Tranquil
Hi,
Here is a code that works fine but debugging is not possible :
WW
Here is a code that works fine but debugging is not possible :
Code: Select all
OpenWindow(1, 100, 100, 600, 600, "Test", #PB_Window_SystemMenu|#PB_Window_TitleBar)
If InitMouse() = 0 Or InitKeyboard() = 0
MessageRequester("Erreur", "Prob DirectX", 0)
End
EndIf
Repeat
ExamineKeyboard()
Until KeyboardReleased(#PB_Key_Escape)
beep_ (1000,50)
CloseWindow (1)
End
Beware of the man who has the solution before he understands the problem...
- netmaestro
- PureBasic Bullfrog
- Posts: 8451
- Joined: Wed Jul 06, 2005 5:42 am
- Location: Fort Nelson, BC, Canada
If I run your program with debugger on then it stops at the examinekeyboard command with the error like you say, if I run without the debugger on then the program freezes and has to be stopped by windows.
I guess something isn't working right and thats why the debugger won't let it run.
I'm using XP home with sp2 on an amd64 3000+
I guess something isn't working right and thats why the debugger won't let it run.
I'm using XP home with sp2 on an amd64 3000+
Seems like Tranquil has a reasonable work-around for the debugger in his post above?
Edit: For eg, stick some macros/procedures into the code and replace all keyboardCommand type statements with myKeyboardCommands (or whatever)
Edit: For eg, stick some macros/procedures into the code and replace all keyboardCommand type statements with myKeyboardCommands (or whatever)
Code: Select all
Macro myExamineKeyboard()
DisableDebugger
ExamineKeyboard()
EnableDebugger
EndMacro
Procedure myKeyboardReleased(ky)
DisableDebugger
r=KeyboardReleased(ky)
EnableDebugger
ProcedureReturn r
EndProcedure
OpenWindow(1, 100, 100, 600, 600, "Test", #PB_Window_SystemMenu|#PB_Window_TitleBar)
If InitMouse() = 0 Or InitKeyboard() = 0
MessageRequester("Erreur", "Prob DirectX", 0)
End
EndIf
Repeat
myExamineKeyboard()
Until myKeyboardReleased(#PB_Key_Escape)
Beep_ (1000,50)
CloseWindow (1)
End
Dare2 cut down to size
I am using the keyboard to stop the program at a specific point... (I know I
can also use the degugger for this).
I was just wondering why the debugger doesn't like this command with
OpenWindow().
Iam going to use GetAsyncKeyState_() and GetKeyState_().
Thks for your replies.
WW
can also use the degugger for this).
I was just wondering why the debugger doesn't like this command with
OpenWindow().
Iam going to use GetAsyncKeyState_() and GetKeyState_().
Thks for your replies.
WW
Beware of the man who has the solution before he understands the problem...