kaotkbliss Posted January 22, 2010 Share Posted January 22, 2010 I'm pretty sure this is a dll error because I just added a snippit from the winapi UDF. The reason I only added part of it is because it conflicts with the ChangeScreenResEx (of which I only removed from that UDF what I needed as I had to make changes to find the primary monitor) change screen res snippit expandcollapse popup$dll=DllOpen("user32.dll") Global Const $tagDISPLAY_DEVICE = "dword Size;wchar Name[32];wchar String[128];dword Flags;wchar ID[128];wchar Key[128]" Global Const $__WINAPICONSTANT_DISPLAY_DEVICE_PRIMARY_DEVICE = 0x00000004 Func _WinAPI_EnumDisplayDevices($sDevice, $iDevNum) Local $pName = 0, $iFlags = 0, $aDevice[5] If $sDevice <> "" Then Local $tName = DllStructCreate("wchar Text[" & Stringlen($sDevice) + 1 & "]") $pName = DllStructGetPtr($tName) DllStructSetData($tName, "Text", $sDevice) EndIf Local $tDevice = DllStructCreate($tagDISPLAY_DEVICE) Local $pDevice = DllStructGetPtr($tDevice) Local $iDevice = DllStructGetSize($tDevice) DllStructSetData($tDevice, "Size", $iDevice) DllCall($dll, "bool", "EnumDisplayDevicesW", "ptr", $pName, "dword", $iDevNum, "ptr", $pDevice, "dword", 1) If @error Then Return SetError(@error, @extended, 0) Local $iN = DllStructGetData($tDevice, "Flags") If BitAND($iN, $__WINAPICONSTANT_DISPLAY_DEVICE_PRIMARY_DEVICE) <> 0 Then $iFlags = BitOR($iFlags, 2) $aDevice[0] = True $aDevice[1] = DllStructGetData($tDevice, "Name") $aDevice[2] = DllStructGetData($tDevice, "String") $aDevice[3] = $iFlags $aDevice[4] = DllStructGetData($tDevice, "ID") Return $aDevice EndFunc ;==>_WinAPI_EnumDisplayDevices While 1 $num+=1 $display=_WinAPI_EnumDisplayDevices("", $num) If $display[3]=2 Then $display2=StringTrimLeft($display[1],11) ExitLoop EndIf WEnd _ChangeScreenResEx($display2,1024,768,-1,-1) which works great! but then I wanted to add mouse wheel feature to my code and can't use the winapi udf so I pulled out what I needed Global $mw Global Const $WH_MOUSE_LL = 14 $hM_Module = DllCall ( "kernel32.dll" , "hwnd" , "GetModuleHandle" , "ptr" , 0 ) $hM_Hook = DllCall ( $dll , "hwnd" , "SetWindowsHookEx" , "int" , $WH_MOUSE_LL , "ptr" , DllCallbackGetPtr ( DllCallbackRegister ( "_Mouse_Proc" , "int" , "int;ptr;ptr" ) )) Func _Mouse_Proc ( $nCode , $wParam , $lParam ) $mouseData = DllStructGetData ( DllStructCreate ( $tagPOINT & ";dword mouseData" , $lParam ) , 3 ) If $wParam = 0x020A Then $mw = _WinAPI_HiWord ( $mouseData ) EndFunc Func _WinAPI_HiWord($iLong) Return BitShift($iLong, 16) EndFunc ;==>_WinAPI_HiWord Func _WinAPI_LoWord($iLong) Return BitAND($iLong, 0xFFFF) EndFunc ;==>_WinAPI_LoWord and now I get a windows send error report when I try to run the complete program. So, I think there is something wrong with a dll call somewhere in there and I don't know enough about it to find it 010101000110100001101001011100110010000001101001011100110010000 001101101011110010010000001110011011010010110011100100001 My Android cat and mouse gamehttps://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek We're gonna need another Timmy! Link to comment Share on other sites More sharing options...
bogQ Posted January 22, 2010 Share Posted January 22, 2010 (edited) Global $mouseEvent $hM_Module = DllCall ( "kernel32.dll" , "hwnd" , "GetModuleHandle" , "ptr" , 0 ) $hM_Hook = DllCall ( "user32.dll" , "hwnd" , "SetWindowsHookEx" , "int" , 14 , "ptr" , DllCallbackGetPtr ( DllCallbackRegister ( "_Mouse_Proc" , "int" , "int;ptr;ptr" ) ) , "hwnd" , $hM_Module[0] , "dword" , 0 ) While 1 If $mouseEvent = 120 Then MsgBox(0,"Mouse Weel Down",$mouseEvent ) $mouseEvent = 0 ElseIf $mouseEvent = -120 Then MsgBox(0,"Mouse Weel Up",$mouseEvent ) $mouseEvent = 0 EndIf WEnd Func _Mouse_Proc ( $nCode , $wParam , $lParam ) $mouseData = DllStructGetData ( DllStructCreate ( "int X;int Y" & ";dword mouseData" , $lParam ) , 3 ) If $wParam = 0x020A Then $mouseEvent = BitShift($mouseData, 16) EndFunc Edited January 22, 2010 by bogQ TCP server and client - Learning about TCP servers and clients connectionAu3 oIrrlicht - Irrlicht projectAu3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related) There are those that believe that the perfect heist lies in the preparation.Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost. Link to comment Share on other sites More sharing options...
kaotkbliss Posted January 22, 2010 Author Share Posted January 22, 2010 Thanks, that got the error to stop! now I just need to mess with the options to get it to do exactly what I want 010101000110100001101001011100110010000001101001011100110010000 001101101011110010010000001110011011010010110011100100001 My Android cat and mouse gamehttps://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek We're gonna need another Timmy! Link to comment Share on other sites More sharing options...
ProgAndy Posted January 22, 2010 Share Posted January 22, 2010 You can still use the WinAPI.au3-library. The only thing you have to do is rename _WinAPI_EnumDisplayDevices, you could name it _MY_WinAPI_EnumDisplayDevices If you have changed Global Const, give them a new name, too. Otherwise, just comment it out in your script and use the constant provided by WinAPI.au3. *GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now