Jump to content

Flash-matic


trancexx
 Share

Recommended Posts

How can I set $ivTableIndex in call of _AutoItObject_WrapperAddMethod for $oImage?

Is it true $ivTableIndex = 3 (IUnknown)+3(IDispatch)+1(Open method index) = 7?

Where is an error?

Yes something like that. Only maybe 2+4+index (it's zero based).

But if you are going to use more methods then it's easier to construct dtag or ltag of that interface and pass it to object creation function(s). Then you have full object at disposal.

Very cool this Map thing, btw. You should make UDF.

edit: I'll add help file translation, thanks.

Edited by trancexx

♡♡♡

.

eMyvnE

Link to comment
Share on other sites

Then you have full object at disposal.

This will be a long and lugubrious story.

For example:

function SelectShapes(const BoundBox: IExtents; Tolerance: Double; SelectMode: SelectMode; var result: OleVariant): WordBool; safecall;

from IShapefile.

It returns SafeArray variable (I know!) result. AutoIt hasn't many SafeArray funcs to get elements of this array.

There are also some functions with two results:

procedure ProjToPixel(projX, projY: Double; var pixelX, pixelY: Double);

procedure PixelToProj(pixelX, pixelY: Double; var projX, projY: Double);

MapWrap.dll is resolving these slip-ups and I can see the error in source of MapWindowGis.ocx.

There are very many bugs in various places, I think. Swimming-in-Arctic-Sea.

:unsure:

What is about your Events handlers?

The point of world view

Link to comment
Share on other sites

This will be a long and lugubrious story.

For example:

function SelectShapes(const BoundBox: IExtents; Tolerance: Double; SelectMode: SelectMode; var result: OleVariant): WordBool; safecall;

from IShapefile.

It returns SafeArray variable (I know!) result. AutoIt hasn't many SafeArray funcs to get elements of this array.

There are also some functions with two results:

procedure ProjToPixel(projX, projY: Double; var pixelX, pixelY: Double);

procedure PixelToProj(pixelX, pixelY: Double; var projX, projY: Double);

MapWrap.dll is resolving these slip-ups and I can see the error in source of MapWindowGis.ocx.

There are very many bugs in various places, I think. Swimming-in-Arctic-Sea.

:unsure:

What is about your Events handlers?

AutoItObject have almost all functions you need. For example to read safearray to "normal" array you can use __Au3Obj_ReadSafeArrayVariant() function.

As for methods with two results, that's even lesser problem if you have will to write your own Invoke of _DMap wrapper. I would do that, but if you are handier with some other language then custom dll is just fine.

What about event handlers?

Edited by trancexx

♡♡♡

.

eMyvnE

Link to comment
Share on other sites

As for methods with two results, that's even lesser problem if you have will to write your own Invoke of _DMap wrapper.

You are right. MapWrap.dll has already that problems resolved.

What about event handlers?

Nothing apart from they can't handle anything.

Line:

ObjEvent($oMap, "_Map_Events_", "_DMapEvents")

is wrong. SciEd writes:

COM Error, ScriptLine(71) : Number 0x80040200 -

Your sample is here:

#AutoIt3Wrapper_UseX64=n
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include "AutoitObject.au3"

Global $oMap, $Preview, $oNil
Global $Sh_Count = 0, $Layer_count = 0
Global $ZoomIn, $ZoomOut, $Pan, $Selection, $None
Global $cmZoomIn = 0, $cmZoomOut = 1, $cmPan = 2, $cmSelection = 3, $cmNone = 4

Global $ShapeDir = "C:\Program Files\MapWindow\Sample Projects\United States\Shapefiles"

; Error monitoring
Global $oError = ObjEvent("AutoIt.Error", "_ErrFunc")
Func _ErrFunc()
    ConsoleWrite("COM Error, ScriptLine(" & $oError.scriptline & ") : Number 0x" & Hex($oError.number, 8) & " - " & $oError.windescription & @CRLF)
EndFunc   ;==>_ErrFunc

CreateMap()

Global $hGUI = GUICreate("_Map Test", 640, 580, -1, -1, $WS_OVERLAPPEDWINDOW)

$AddLayer = GUICtrlCreateButton("Add Layer", 10, 10, 60, 25)
$Clear = GUICtrlCreateButton("Clear", 80, 10, 60, 25)
$None = GUICtrlCreatePic(@ScriptDir & "\Cursor_.bmp", 150, 10, 20, 20)
$ZoomIn = GUICtrlCreatePic(@ScriptDir & "\Plus_.bmp", 170, 10, 20, 20)
$ZoomOut = GUICtrlCreatePic(@ScriptDir & "\Minus_.bmp", 190, 10, 20, 20)
$Pan = GUICtrlCreatePic(@ScriptDir & "\Move_.bmp", 210, 10, 20, 20)
$Select = GUICtrlCreatePic(@ScriptDir & "\Select_.bmp", 230, 10, 20, 20)
$Preview = GUICtrlCreateObj($oMap, 10, 50, 620, 420)

GUISetState()
 
While 1
 Switch GUIGetMsg()
 Case $GUI_EVENT_CLOSE
  ExitLoop
 Case $AddLayer
  LoadShapefile()
 Case $Clear
  ClearMap()
 Case $ZoomIn
  $oMap.CursorMode = 0
  msgbox(0,"","CursorMode")
 Case $ZoomOut
  $oMap.CursorMode = 1
 Case $Pan
  $oMap.CursorMode = 2
 Case $Select
  $oMap.CursorMode = 3
 Case $None
  $oMap.CursorMode = 4
 EndSwitch
WEnd

$oMap = 0
Exit

;==============================
Func CreateMap()
 _AutoItObject_Startup()
$oMap = _AutoItObject_ObjCreate("MAPWINGIS.Map.1")
If Not IsObj($oMap) Then 
  ConsoleWrite('Create Map object by _AutoItObject_ObjCreateEx!' & @CrLF)
  $oMap = _AutoItObject_ObjCreateEx(@ScriptDir & "\MapWinGIS.ocx", "{54F4C2F7-ED40-43B7-9D6F-E45965DF7F95}") ; , "{1D077739-E866-46A0-B256-8AECC04F2312}")
 endif
 $oMap.BackColor = 0xAAFFFF
 $oMap.Redraw()
 $oMap.SendSelectBoxFinal = True
 $oMap.SendMouseUp = True
 ObjEvent($oMap, "_Map_Events_", "_DMapEvents")
 $oNil = _AutoItObject_PtrToIDispatch(0)
endfunc

;==============================
Func ClearMap()
 $oMap.RemoveAllLayers()
 $oMap.Redraw()
endfunc

;==============================
Func LoadShapefile()
local $Filter = "Shape Files (*.shp)"
local $oSf, $sFile

 $sFile = FileOpenDialog("Open Image", $ShapeDir, $Filter, 1)
 if @Error then return
 $oSf = ObjCreate("MAPWINGIS.Shapefile")
 $Res = $oSf.Open($sFile, $oNil)
 $LayerHandle = $oMap.AddLayer($oSf, True)
 $Layer_count += 1
 $CurrentLayer = $LayerHandle
 $oMap.ShapeLayerLineColor($LayerHandle) = 0x000000
 $oMap.ShapeLayerFillColor($LayerHandle) = Random(0, 0x00FFFF, 1)
 $oMap.ShapeLayerFillStipple($LayerHandle) = 0
; $ShapeLayerLineWidth = $oMap.ShapeLayerLineWidth($LayerHandle)
; $ShapeLayerStippleTransparent = $oMap.ShapeLayerStippleTransparent($CurrentLayer)
 $oMap.ShapeLayerStippleTransparent($CurrentLayer) = True
; $ShapeLayerFillTransparency = $oMap.ShapeLayerFillTransparency($CurrentLayer)
 $oMap.ShapeLayerFillTransparency($CurrentLayer) = 0.5
 $oSf = 0
EndFunc   ;==>LoadShapefile

Func _Map_Events_FileDropped($sFile)
  ConsoleWrite("> _Map_Events_FileDropped = " & $sFile & @CRLF)
EndFunc   ;==>_Map_Events_FileDropped

Func _Map_Events_DblClick()
  ConsoleWrite("! _Map_Events_DblClick fired" & @CRLF)
EndFunc   ;==>_Map_Events_DblClick
Edited by ValeryVal

The point of world view

Link to comment
Share on other sites

ObjEvent works fine with me (win 7 x64). I can't help with that.

Yes, you can't do it. I've got the strange thing (Win_XP).

The line ObjEvent($oMap, "_Map_Events_") instead of ObjEvent($oMap, "_Map_Events_", "_DMapEvents") can resolve problem with DMapEvents.

From AutoIt Doc:

If the second parameter is omitted, it will return the name of the current Error handler function, if present.

You can see that this current Error handler is absent since name of it is empty.

Now there is only error after closing script. Try start it from Explorer and click on Windows (X) button.

Is it an AutoItObject trace?

The point of world view

Link to comment
Share on other sites

  • 4 months later...

Hello trancexx

I am trying to figure out that how can i set the "FlashVars" for inline SWFs? i mean if i use the traditional methods, it works fine but if i try that methods for inline SWFs it just don't work.

here is an example code for inline swf:

Global $fH = FileOpen("player.swf",16)
Global $vVar = FileRead($fH)
FileClose($fH)
_FlashLoadMemory($oShockwaveFlash1, $vVar, $iSizeData, $iPos)
$oShockwaveFlash1.FlashVars = 'fileVideo=video.mp4'

here is code for old method:

$oShockwaveFlash.FlashVars = 'fileVideo=video.mp4'
$oShockwaveFlash.Movie = @ScriptDir&"\player.swf"

the old method works fine but not with the inline version. you have any idea about this problem?

73 108 111 118 101 65 117 116 111 105 116

Link to comment
Share on other sites

  • 8 months later...

the old method works fine but not with the inline version. you have any idea about this problem?

don't use .Movie .. call _FlashLoadMemory before, it works fine with me.

_FlashLoadMemory($oFlash, $vVar, $iSizeData, $iPos)
    With $oFlash
        .bgcolor = "#aaaaaa"
        .ScaleMode = 0
        .wmode = "transparent"
        .wmode = "opaque"
        .zoom(50)
        .Menu = False
        .AlignMode = 0
    EndWith

but how to encode the file before decoding it with __Au3Obj_Mem_Base64Decode($sData), i have a file with size 9 MB O_0', i need to reduce it's size.

Link to comment
Share on other sites

  • 1 year later...

@trancexx

Does the youtube example still work for you? I have a blank area in place of the player.

I would like to know where you got the binary data (contained in $vVar), in where you change the video id; maybe it needs to be updated (I used to change the swf file url in the data but it does not work anymore).

Br, FireFox.

Edited by FireFox
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...