Jump to content

Dll function and structure is correct ?


anib
 Share

Recommended Posts

hy,

DragDetect function is correctly ?

The DragDetect function captures the mouse and tracks its movement until the user releases the left button, presses the ESC key, or moves the mouse outside the drag rectangle around the specified point. The width and height of the drag rectangle are specified by the SM_CXDRAG and SM_CYDRAG values returned by the GetSystemMetrics function.

Remarks = The system metrics for the drag rectangle are configurable, allowing for larger or smaller drag rectangles.

Func DragDetect($hwnd,$x,$y)
$x = GetSystemMetrics($SM_CXDRAG)
$y = GetSystemMetrics($SM_CYDRAG)
$aResultat = DllCall("user32.dll","int","DragDetect","hwnd",$hwnd,"int",$y,"int",$y)
Return $aResultat[0]
EndFunc

Func GetSystemMetrics($nIndex)
    Local $aResultat = DllCall("user32","int","GetSystemMetrics","int",$nIndex)
        Return $aResultat[0]
EndFunc

Result GetSystemMetrics($SM_CXDRAG) & GetSystemMetrics($SM_CYDRAG) = value 4

is possible drag rectangle are configurable ?

other problem;

exemple C

bool fresult;
int aMouseInfo[3]

      // Get the mouse speed and the threshold values. 
 
      fResult = SystemParametersInfo(
         SPI_GETMOUSE,  // get mouse information 
         0,          // not used 
         &aMouseInfo,   // holds mouse information 
         0);            // not used 

      if( fResult )
      { 
         printf("Speed: %d\n", aMouseInfo[2]); 
         printf("Threshold (x,y): %d,%d\n", 
            aMouseInfo[0], aMouseInfo[1]); 
      }

thanx& excuse me for my langage :§

Is correctly ? return value is zero :)

Global Const $SPI_GETMOUSE = 3
$aMouseinfo =DllStructCreate("int threshold1;int threshold2;int MouseSpeed")
$fResult = SystemParametersInfo($SPI_GETMOUSE,0,DllStructGetPtr($aMouseInfo),0)

$threshold1= DllStructGetData($aMouseinfo,"threshold1")
$threshold2 = DllStructGetData($aMouseinfo,"threshold2")
$MouseSpeed = DllStructGetData($aMouseinfo,"MouseSpeed")

$aMouseInfo = 0

if $fResult Then
    ConsoleWrite("Speed = " & $MouseSpeed)
    ConsoleWrite("X & Y = " & $threshold1 & $threshold2)
EndIf

Func SystemParametersInfo($uAction,$uParam=0,$lpvParam="", $fuWinIni=0)
    local $aresultat = dllcall("user32.dll","int","SystemParametersInfoA","int",$uAction,"int",$uParam, "str", $lpvParam,"int", $fuWinIni)
    return $aresultat[0]
endfunc
Edited by anib

Me frappe pas !! je débute dans le monde du code :)Un novice avertit en vaut dix sans ennuie ;)AuToiT-FR

Link to comment
Share on other sites

  • 2 weeks later...

ist possible to add a function for device context

hdc CreateDC

{

LPCTSTR lpszDriver, // driver name

LPCTSTR lpszDevice, // device name

LPCTSTR lpszOutput, // not used; should be NULL

CONST DEVMODE* lpInitData // optional printer data

}

I'm not spécialiste :)

My conversion is not correct :)

Func CreateDC($lpszDriver,$lpszDevice,$lpszOutput,$lpInitData)

local $return = DllCall("gdi32.dll","int","CreateDCA","str",$lpszDriver,"str",$lpszDevice,"str",$lpszOutput,"ptr",$lpInitData)

Return $return[0]

EndFunc

thanks

Edited by anib

Me frappe pas !! je débute dans le monde du code :)Un novice avertit en vaut dix sans ennuie ;)AuToiT-FR

Link to comment
Share on other sites

  • 2 weeks later...
  • 2 weeks later...

hi, i'm test to modification, but even moving mouse, the value remains the same.

I also checked the fonction of Paul(ia) , indicate "int" not "ptr".

Func _WinAPI_SystemParametersInfo($iAction, $iParam = 0, $vParam = 0, $iWinIni = 0)
    Local $aResult

    $aResult = DllCall("user32.dll", "int", "SystemParametersInfo", "int", $iAction, "int", $iParam, "int", $vParam, "int", $iWinIni)
    Return $aResult[0] <> 0
EndFunc ;==>_WinAPI_SystemParametersInfo

For loadicon function, it seems to me that this is the same as loadcursor, but even indicating here, j'obtiend no results: (

Func _LoadIcon($iIconName)

local $result

$result = DllCall("user32.dll","int","LoadIcon","hwnd",0,"int",$iIconName)

return $result

EndFunc

:D

thank to help me

Edited by anib

Me frappe pas !! je débute dans le monde du code :)Un novice avertit en vaut dix sans ennuie ;)AuToiT-FR

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...