GetKeyState_(#VK_

Mac OSX specific forum
cajomi
User
User
Posts: 45
Joined: Thu Dec 04, 2008 9:53 am
Location: Essen

GetKeyState_(#VK_

Post by cajomi »

How would I do this?
Johannes
WilliamL
Addict
Addict
Posts: 1255
Joined: Mon Aug 04, 2008 10:56 pm
Location: Seattle, USA

Re: GetKeyState_(#VK_

Post by WilliamL »

I don't know what GetKeyState_(#VK_ does but maybe the commands used after ExamineKeyboard() would be helpful. Something like Key=KeyboardPushed(KeyID) in the manual?
MacBook Pro-M1 (2021), Tahoe 26.1, PB 6.30b2
cajomi
User
User
Posts: 45
Joined: Thu Dec 04, 2008 9:53 am
Location: Essen

Re: GetKeyState_(#VK_

Post by cajomi »

May be, I explain it a bit longer:

I have long program (77 000 lines). The use of API is reduced as far as possible, but complety not.

The of GetKeyState_(#VK_....) and GetAsyncKeyState_(#VK_....) is very important, I use it for the mouse.

Now I translate the program to the MAC version (MAC and Intel) and I have a problem:
how do I translate the API function?

Johannes
WilliamL
Addict
Addict
Posts: 1255
Joined: Mon Aug 04, 2008 10:56 pm
Location: Seattle, USA

Re: GetKeyState_(#VK_

Post by WilliamL »

MacBook Pro-M1 (2021), Tahoe 26.1, PB 6.30b2
User avatar
michel51
Enthusiast
Enthusiast
Posts: 290
Joined: Mon Nov 21, 2005 10:21 pm
Location: Germany

Re: GetKeyState_(#VK_

Post by michel51 »

WilliamL wrote:Maybe #6 in this thread? http://www.purebasic.fr/english/viewtop ... 19&t=43583
Yes, William is right.
Try the example in the Link, it works. I've tested
michel51

Mac OS X Snow Leopard (10.6.8 ) Intel
PureBasic V 5.21(x64), V 5.22beta
cajomi
User
User
Posts: 45
Joined: Thu Dec 04, 2008 9:53 am
Location: Essen

Re: GetKeyState_(#VK_

Post by cajomi »

By me, it doesnt work.
When I put the message

ImportC"/System/Library/Frameworks/Carbon.framework/Carbon"

it give an error next line:
Grundpfad.s=GetCurrentDirectory()

Requester says:
"Error is ...type mismatch"

I have test it a bit: Same error every line, I have put it in.

Any idea?
User avatar
michel51
Enthusiast
Enthusiast
Posts: 290
Joined: Mon Nov 21, 2005 10:21 pm
Location: Germany

Re: GetKeyState_(#VK_

Post by michel51 »

cajomi wrote:By me, it doesnt work.
When I put the message

ImportC"/System/Library/Frameworks/Carbon.framework/Carbon"

it give an error next line:
Grundpfad.s=GetCurrentDirectory()

Requester says:
"Error is ...type mismatch"

I have test it a bit: Same error every line, I have put it in.

Any idea?
Try

Code: Select all

ImportC "/System/Library/Frameworks/Carbon.framework/Carbon"
I think, there is missing a <space> after 'ImportC'.
michel51

Mac OS X Snow Leopard (10.6.8 ) Intel
PureBasic V 5.21(x64), V 5.22beta
cajomi
User
User
Posts: 45
Joined: Thu Dec 04, 2008 9:53 am
Location: Essen

Re: GetKeyState_(#VK_

Post by cajomi »

no, it is the same.

By the way:
I have only mac x 10.4

Johannes
Niffo
Enthusiast
Enthusiast
Posts: 504
Joined: Tue Jan 31, 2006 9:43 am
Location: France

Re: GetKeyState_(#VK_

Post by Niffo »

Copy/paste code from Safari to PB does not work. It works from FireFox.
Last edited by Niffo on Mon Oct 04, 2010 8:00 am, edited 1 time in total.
Niffo
WilliamL
Addict
Addict
Posts: 1255
Joined: Mon Aug 04, 2008 10:56 pm
Location: Seattle, USA

Re: GetKeyState_(#VK_

Post by WilliamL »

Copy text from Safari and paste it into TextEdit, then copy text from TextEdit then paste to PB and you won't have the errors.
MacBook Pro-M1 (2021), Tahoe 26.1, PB 6.30b2
cajomi
User
User
Posts: 45
Joined: Thu Dec 04, 2008 9:53 am
Location: Essen

Re: GetKeyState_(#VK_

Post by cajomi »

Endimport

were missing!!!!!

Johannes
Post Reply