tomis Posted March 26, 2010 Share Posted March 26, 2010 Hi, Im trying call method of object which requires pointer to Variant variable. How to get pointer?Im tried ptr() and create DllStruct $intTip. But cant get it working.$oPLCSIM = ObjCreate("S7wspsmx.S7ProSim") if $oPLCSIM =0 Then MsgBox(0,"Error","Object create error") if $oPLCSIM.Connect() Then MsgBox(0,"Connect","Cant connect") local $intTip = DllStructCreate("USHORT") if @error Then MsgBox(0,"","Error in DllStructCreate " & @error); exit endif $a=$oPLCSIM.ReadOutputPoint(97,0,3,DllStructGetPtr($intTip)) $b=DllStructGetData($intTip, 1) MsgBox(0,"Output",$<img src='http://www.autoitscript.com/forum/public/style_emoticons/<#EMO_DIR#>/cool.png' class='bbc_emoticon' alt='B)' />[u]ReadOutputPoint[/u] STDMETHOD(CS7ProSim::ReadOutputPoint)( long ByteIndex, long BitIndex, PointDataTypeConstants DataType, VARIANT* pData) Description Reads a particular bit (Boolean), a byte (Byte), a two-byte word (Integer) or a four-byte word (Long) from the peripheral output image (PQ memory area). Parameters ByteIndex Represents the starting byte position in the peripheral image buffer to read. Valid values for ByteIndex are dependent on the CPU. BitIndex Represents the Bit position (in bytes) in the peripheral image buffer to read. Valid values are 0 to 7. DataType One of the PointDataTypeConstants (3-WORD) pData Pointer to the data to read. Valid values for data are dependent on the data type. Link to comment Share on other sites More sharing options...
trancexx Posted March 26, 2010 Share Posted March 26, 2010 AutoIt can't handle pointers that way (it's a bug). You need to do Number(DllStructGetPtr($intTip) ) Another thing is you should look for ObjEvent() function. It can catch errors for you. And learn what Variant is. ♡♡♡ . eMyvnE 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