Jump to content
  1. argumentum


  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By InunoTaishou
      Struggling a bit to get this GDI+ function converted to AutoIt.
      #include <GDIPlus.au3> _GDIPlus_Startup() Global $hImage = _GDIPlus_ImageLoadFromFile("F:\DCIM\Camera\20170515_111804.jpg") Global $tBufferSize = DllStructCreate("uint") Global $tProperties = DllStructCreate("uint") _GDIPlus_GetPropertySize($hImage, $tBufferSize, $tProperties) Global $tAllItems = DllStructCreate("struct;char[" & DllStructGetData($tBufferSize, 1) & "];endstruct") _GDIPlus_GetAllPropertyItems($hImage, $tBufferSize, $tProperties, $tPropertyItem) _GDIPlus_ImageDispose($hImage) _GDIPlus_Shutdown() Func _GDIPlus_GetAllPropertyItems(ByRef $hImage, Const $tTotalBufferSize, Const $tNumProperties, ByRef $tAllItems) If (Not IsDllStruct($tPropertyItem)) Then Return SetError(-1, 0, "") Local $aResult = DllCall($__g_hGDIPDll, "int", "GdipGetAllPropertyItems", "hwnd", $hImage, "unit", DllStructGetData($tTotalBufferSize, 1), "uint", DllStructGetData($tNumProperties, 1), "ptr", DllStructGetPtr($tAllItems)) If (@error) Then Return SetError(@error, @extended, ConsoleWrite("@Error = " & @error & @LF)) If ($aResult[0]) Then Return SetError($aResult[0], @extended, "") Return $aResult[0] EndFunc ;==>_GDIPlus_GetAllPropertyItems Func _GDIPlus_GetPropertySize(Const ByRef $hImage, ByRef $tTotalBufferSize, ByRef $tNumProperties) If (Not IsDllStruct($tTotalBufferSize)) Then Return SetError(-1, 0, "") If (Not IsDllStruct($tNumProperties)) Then Return SetError(-2, 0, "") Local $aResult = DllCall($__g_hGDIPDll, "uint", "GdipGetPropertySize", "hwnd", $hImage, "uint_ptr", DllStructGetPtr($tTotalBufferSize), "uint_ptr", DllStructGetPtr($tNumProperties)) If (@error) Then Return SetError(@error, @extended, "") If ($aResult[0]) Then Return SetError($aResult[0], 0, "") Return $aResult[0] EndFunc ;==>_GDIPlus_GetPropertySize Got the GetPropertySize function to work, gives me the correct buffer size and the property count, but I cannot figure out how to get the struct for the all items.
      Function on MSDN:
      Struct needed:
      PropertyItem class:
      Found other topics about this function in other languages where they used a blank string as the buffer, so I tried using a char array, which doesn't work. Just cannot figure out how to create the struct buffer to hold the data.
    • By Skysnake
      bool SMSAPI_sendsms( const LPSMSAPI_NETWORKCONFIGURATION lpNetConfig, const LPSMSAPI_ACCOUNTINFO lpAccInfo, const LPSMSAPI_MESSAGEINFO lpMsgInfo, LPSMSAPI_RESPONSEINFO lpResponseInfo); How does one call this in an AutoIt DllCall() - I do not see "const" conversions and how does one insert the pointers?
    • By Skysnake
      I can not program.  What I am trying to do is make a little AutoIt Desktop SMS sender that uses BulkSMS upstream.  BulkSMS provides services in the UK, USA, Europe and South Africa.  BulkSMS provides several options (a) create string and plug it into browser and send via HTTP, ugly but it works; (b) a DLL called smstxt32.dll which supports a few functions to do this in a typical Windows Desktop application.  They provide examples in C, PHP, Python etc.  I do not understand any of those.  I attach several files.
      The BulkSMS home page is located here: www.BulkSMS.com
      You can create a free account which allows five free credits to experiment with. So you can try to send the SMSes for free initially.
      The file "BulkSMS Win32 API ver 1006a.zip" contains a .doc help file and the smstxt32.dll file.
       BulkSMS Win32 API ver 1006a.zip
      The file BulkSMS.au3 is my attempt.
      My BulkSMS.au3 attempts to create the required structs for use with the DLL.  I think I do manage, but do not understand anything about pointers.  Then I attempt to actually send the SMS using the following DLLCALL
      Local $res = DllCall($__g_hDll_BulkSMS, _ ; name of DLL "BOOL", _ ; return type "SMSAPI_sendsms", _ ; function "LONG", _ ; type1 $gSMSAPI_NETWORKCONFIGURATION, _ ; param1 "LONG", _ ; type2 $gSMSAPI_ACCOUNTINFO, _ ; param2 "LONG", _ ; type3 $gSMSAPI_MESSAGEINFO, _ ; param3 "LONG", _ ; type4 $gSMSAPI_RESPONSEINFO _ ; param4 )This is based on the following example from the included help file, 
      bool SMSAPI_sendsms( const LPSMSAPI_NETWORKCONFIGURATION lpNetConfig, const LPSMSAPI_ACCOUNTINFO lpAccInfo, const LPSMSAPI_MESSAGEINFO lpMsgInfo, LPSMSAPI_RESPONSEINFO lpResponseInfo);According to the AutoIt Helpfile, there are conversions to comparable data types.  However, I do not see a "const" so I do not know what do with that.  Also, the C example shows the use of "long pointers." What would this be in AutoIt?
      Thank you
      BulkSMS Win32 API ver 1006a.zip
    • By swieru
      I am trying to write very basic script to use COM object. It is a specific object allowed to communication with software on the industrial controller.
      I can create reference to a COM object by function ObjCreate. Thanks to ObjectName function I can read all information about object. Problem is that, I can trigger (only) one method of this object, named Disconnect().
      When I want to use the other method instead of Disconnect(), for example, ReadValueN I have problem with arguments for this method. I tryed many variants, combinations, without positive result. My error monitoring function (for COM errors) reports: "Bad variable types" or "Type mismath".
      I studied many examples, many documentations but I have no idea how it should be.
      Below is description for method, data etc based on OLE/ COM Object Viewer.
      long ReadValueN( [in] long TARGET_id, [in] PARAM_DEF* pParamDef, [out] BUFFER* pResBuffer);typedef struct tagPARAM_DEF{ unsigned char Param1; unsigned char Param2; unsigned char Param3; unsigned char ParamT[8]; short Number; unsigned char ValueF; unsigned char ValueD; } PARAM_DEF; typedef struct tagBUFFER{ unsigned char BuffA1; unsigned char BuffA2; unsigned char BuffA3; unsigned char BuffTable[256]; } BUFFER;$structParamDef = DllStructCreate("byte; byte; byte; byte[8]; short; byte; byte") $structBuffer = DllStructCreate("byte; byte; byte; byte[256]") $response = $myObject.ReadValueN(0, DllStructGetPtr($structParamDef), DllStructGetPtr($structBuffer)) ;$response = $myObject.Disconnect() ; is workingCould someone write me what is wrong and how it should be? And especially - why?
      thanks in advanced
    • By UEZ
      I'm trying to understand following code which I want to convert to Autoit:


      VOID Example_RedEyeSetParameters(HDC hdc) { Graphics graphics(hdc); Image myImage(L"RedEyePhoto.jpg"); REAL srcWidth = (REAL)myImage.GetWidth(); REAL srcHeight = (REAL)myImage.GetHeight(); RectF srcRect(0.0f, 0.0f, srcWidth, srcHeight); Matrix myMatrix(1.0f, 0.0f, 0.0f, 1.0f, 300.0f, 20.0f); RECT redAreas[2] = {40, 10, 55, 30, 110, 20, 125, 40}; RedEyeCorrectionParams myRedEyeCorParams; myRedEyeCorParams.numberOfAreas = 2; myRedEyeCorParams.areas = redAreas; RedEyeCorrection myRedEyeCor; myRedEyeCor.SetParameters(&myRedEyeCorParams); // Draw the image with no change. graphics.DrawImage(&myImage, 20.0, 20.0, srcWidth, srcHeight); // Draw the image with the red eye correction. graphics.DrawImage(&myImage, &srcRect, &myMatrix, &myRedEyeCor, NULL, UnitPixel); }
      I made something like this here

      Global $tRECT1 = DllStructCreate("long left;long top;long right;long buttom") DllStructSetData($tRECT1, "left", 55) DllStructSetData($tRECT1, "top", 69) DllStructSetData($tRECT1, "right", 68) DllStructSetData($tRECT1, "buttom", 81) Global $pRECT1 = DllStructGetPtr($tRECT1) Global $tRECT2 = DllStructCreate("long left;long top;long right;long buttom") DllStructSetData($tRECT2, "left", 159) DllStructSetData($tRECT2, "top", 68) DllStructSetData($tRECT2, "right", 172) DllStructSetData($tRECT2, "buttom", 81) Global $pRECT2 = DllStructGetPtr($tRECT2) Global Const $tagREDEYECORRECTIONPARAMS = "uint numberOfAreas;int areas[2]" Global $tRedEye = DllStructCreate($tagREDEYECORRECTIONPARAMS) Global Const $pRedEye = DllStructGetPtr($tRedEye) DllStructSetData($tRedEye, "numberOfAreas", 2) DllStructSetData($tRedEye, "areas", $tRECT1, 1) DllStructSetData($tRedEye, "areas", $tRECT2, 2) $hEffect = _GDIPlus_EffectCreate($GDIP_REDEYECORRECTIONEFFECT) ConsoleWrite(_GDIPlus_EffectsSetParameters($hEffect, $pRedEye) & " / " & @error & @LF)
      but it is not working - return code 8, error code 2.

      I'm an absolute C++ noob and I hope somebody can help here.

  • Create New...