Jump to content

DllCall...


layer
 Share

Recommended Posts

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
Link to comment
Share on other sites

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
Link to comment
Share on other sites

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
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...