Jump to content
Sign in to follow this  
layer

DllCall...

Recommended Posts

layer

hey guys... trying a dll call again... need a little help :"> im using CreatePen and what i have looks like this...

$pen= DllCall ("Gdi32.dll", "hwnd", "CreatePen", "int", "PS_SOLID")

Func _IsPressed($hexKey)
; $hexKey must be the value of one of the keys.
; _IsPressed will return 0 if the key is not pressed, 1 if it is.
; $hexKey should entered as a string, don't forget the quotes!
; (yeah, layer. This is for you)
  
  Local $aR, $bO
  
  $hexKey = '0x' & $hexKey
  $aR = DllCall("user32", "int", "GetAsyncKeyState", "int", $hexKey)
  If Not @error And BitAND($aR[0], 0x8000) = 0x8000 Then
     $bO = 1
  Else
     $bO = 0
  EndIf
  
  Return $bO
EndFunc ;==>_IsPressed

While 1
If _IsPressed('01') = 1 then
$pen= DllCall ("Gdi32.dll", "hwnd", "CreatePen", "hwnd", "PS_SOLID")
endif
wend

is there a gui i must create to allow such drawing? or is there something im doing wrong...

BTW: Ezzetabi i never realized the

; (yeah, layer. This is for you)

lol thanks :idiot:

FootbaG

Share this post


Link to post
Share on other sites
layer

here... i updated it, but now i think i will need to do selectobject right?

$pen= DllCall ("Gdi32.dll", "hwnd", "CreatePen", "int", "PS_SOLID")

Func _IsPressed($hexKey)
; $hexKey must be the value of one of the keys.
; _IsPressed will return 0 if the key is not pressed, 1 if it is.
; $hexKey should entered as a string, don't forget the quotes!
; (yeah, layer. This is for you)
  
  Local $aR, $bO
  
  $hexKey = '0x' & $hexKey
  $aR = DllCall("user32", "int", "GetAsyncKeyState", "int", $hexKey)
  If Not @error And BitAND($aR[0], 0x8000) = 0x8000 Then
     $bO = 1
  Else
     $bO = 0
  EndIf
  
  Return $bO
EndFunc ;==>_IsPressed

While 1
If _IsPressed('01') = 1 then
$pen= DllCall ("Gdi32.dll", "ptr", "CreatePen", "ptr", "PS_SOLID", "ptr", 2, "ptr", 0xff0000)
endif
wend

tell me if im right or wrong :/ is there a certain gui style that allows this kicd of input?


FootbaG

Share this post


Link to post
Share on other sites
ezzetabi

This sound strange...

[...] "int", "PS_SOLID")

You pass a string as an Int? If it is a constant probably Autoit does not know it.

Checked... The value of PS_Solid is 0, so it may work. But it better using

[...] "int", 0)

or

$PS_SOLID = 0

[...] "int", $PS_SOLID)

Edit:

Oh yes... I added

; (yeah, layer. This is for you)

because you had problem sending the value as a int...

:idiot:

Edited by ezzetabi

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.