Eigentlich ein cooles Feature!
Tja - Ich bin wohl doch schon etwas aus der Übung! ![]()
Eigentlich ein cooles Feature!
Tja - Ich bin wohl doch schon etwas aus der Übung! ![]()
Ahh! Danke!
Das hilft schonmal enorm zu wissen, dass es die STRG Taste ist.
Keine Katze - wahrscheinlich ein pöser Geist ![]()
thx
Hallo Allerseits!
Seit kurzem nervt mich folgendes Phänomen:
Hin und wieder hab ich plötzlich 2 Cursor in SciTE, welche gleichzeitig in unterschiedlichen Zeilen schreiben.
Egal, ob das nun ein nützliches Feature sei, oder seit Urzeiten schon so funktioniert - ich würde das gerne abstellen.
Vielleicht kann mir ja jemand sagen, wodurch dieses Feature getriggert wird u wie ich es deaktivieren kann.
Hier ein kurzes Video dazu: Untitled.7z
Vielen Dank!
Frames ohne Umweg über die Festplatte:
#include <GDIPlus.au3>
#include <Memory.au3>
#include <Array.au3>
#include <Date.au3>
_FFMPEG_Test("test.mp4", 3000, 5)
Func _FFMPEG_Test($sFile, $iOffset = 0, $iFrames = 1, $iW = -1, $iH = -1)
Local Const $tagBITMAPFILEHEADER = "struct;align 2;word bfType;dword bfSize;word bfReserved1;word bfReserved2;dword bfOffBits;endstruct;"
Local $tBMPHEADER = DllStructCreate($tagBITMAPFILEHEADER & $tagBITMAPINFO)
Local $tBMPHEADER_B = DllStructCreate("byte[" & DllStructGetSize($tBMPHEADER) & "];", DllStructGetPtr($tBMPHEADER))
Local $sCMD = 'ffmpeg -y'
If $iOffset Then
Local $_iH, $_iM, $_iS
_TicksToTime($iOffset, $_iH, $_iM, $_iS)
$iOffset = Mod($iOffset, 1000)
Local $sOffset = StringFormat("%02s:%02s:%02s.%03s", $_iH, $_iM, $_iS, $iOffset)
$sCMD &= ' -ss ' & $sOffset
EndIf
$sCMD &= ' -i "' & $sFile & '"'
If $iW > 1 Or $iH > 1 Then $sCMD &= ' -vf "scale=' & $iW & ':' & $iH & '"'
$sCMD &= ' -vframes ' & $iFrames & ' -update true -vcodec bmp -pix_fmt bgra -f image2 -'
ConsoleWrite("> CMD: " & $sCMD & @CRLF)
Local $aBMP[$iFrames + 1][3] = [[0]]
Local $bData, $bTmp, $sErr, $iLen
Local $hPID = Run($sCMD, @ScriptDir, @SW_HIDE, BitOR(0x2, 0x4))
While 1
$bTmp = StdoutRead($hPID, False, True)
If @error Then ExitLoop
If BinaryLen($bTmp) Then
$bData = Binary($bData & $bTmp)
While 1
DllStructSetData($tBMPHEADER_B, 1, $bData)
$iLen = BinaryLen($bData)
If $iLen < $tBMPHEADER.bfSize Then ExitLoop
$aBMP[0][0] += 1
If $aBMP[0][0] >= UBound($aBMP) Then ReDim $aBMP[$aBMP[0][0] + 1][3]
$aBMP[$aBMP[0][0]][0] = BinaryMid($bData, 1, $tBMPHEADER.bfSize)
$aBMP[$aBMP[0][0]][1] = $tBMPHEADER.biWidth
$aBMP[$aBMP[0][0]][2] = $tBMPHEADER.biHeight
$bData = BinaryMid($bData, $tBMPHEADER.bfSize + 1, $iLen)
WEnd
EndIf
$sErr = StderrRead($hPID)
If $sErr Then ConsoleWrite($sErr)
Sleep(10)
WEnd
_ArrayDisplay($aBMP)
_GDIPlus_Startup()
Local $iData, $hData, $pData, $tData, $pStream, $hImage
For $i = 1 To $aBMP[0][0]
$iData = BinaryLen($aBMP[$i][0])
$hData = _MemGlobalAlloc($iData, $GMEM_MOVEABLE)
$pData = _MemGlobalLock($hData)
$tData = DllStructCreate("byte[" & $iData & "]", $pData)
DllStructSetData($tData, 1, $aBMP[$i][0])
_MemGlobalUnlock($hData)
$pStream = _WinAPI_CreateStreamOnHGlobal($hData)
$hImage = _GDIPlus_ImageLoadFromStream($pStream)
_GDIPlus_ImageSaveToFile($hImage, @ScriptDir & "\_test_" & StringFormat("%02s", $i) & ".png")
_WinAPI_ReleaseStream($pStream)
_GDIPlus_ImageDispose($hImage)
Next
_GDIPlus_Shutdown()
EndFunc ;==>_FFMPEG_Test
Alles anzeigen
lgE
Vielen Dank!
Ich finde Gefallen an Hardlinks.
Z.B. hab ich ca 25 ffmpeg.exe verstreut und das sind in Summe 1.5GB
So kann ich mir jetzt etwas zusätzlichen Platz schaffen ![]()
Das is es!
Es sind Hardlinks!
Kannte ich bis jetzt nicht wirklich.
NTFSLinksView kann das anzeigen.
Desweiteren hab ich entdeckt, dass man mit "mklink" ganz einfach HardLinks erstellen kann.
Vielen Dank
Wow Danke für das Tool!
Sofort ins Auge fällt, dass hier 3 gleich aussehende, riesige Blöcke angezeigt werden.
Es handelt sich hier um die Cache-Speicher von 3 fast identischen Videoprojekten (nur die Reihenfolge der Clips sind unterschiedlich, der Cache ist immer gleich).
Heißt das nun, dass NTFS doppelte Dateien nur einmal speichert!?
Hallo Allerseits!
Ich hab folgendes, seltsames Phänomen.
Ich hab eine Partition NTFS formatiert, welche 807GB groß ist. Davon sind laut Eigenschaften 708GB belegt. So weit so gut!
Wenn ich nun im Explorer alle Dateien und Ordner markiere und mir die Eigenschaften anzeigen lasse, habe ich 954GB Daten gespeichert.
Also mehr gespeichert, als eigentlich Platz hat.
ChkDsk meldet keine Fehler.
Hier noch eine Anzeige in Linux:
Kann mir das bitte jemand erklären.
Vielen Dank!
Ich hab ein BUG gefunden: siehe 1 Post!
That´s cool!
I quick added a control window, to test the parameters
#include "FaceDetection.au3"
#include <GUIConstantsEx.au3>
;#include <Array.au3>
;HotKeySet("{ESC}", "_Exit")
Opt("GUIOnEventMode", 1)
Global $Width = 640, $Height = 480, $hGraphics
;--------------------------------------------------------------------------
; variables required for dshow escapi
Local $tagSimpleCapParams = "ptr mTargetBuf;" & "int mWidth;" & "int mHeight;"
Local $tSimpleCapParams = DllStructCreate($tagSimpleCapParams)
Local $tTargetBuf = DllStructCreate("BYTE[" & $Width*$Height*4 & "]")
Global $pTargetBuf = DllStructGetPtr($tTargetBuf)
DllStructSetData($tSimpleCapParams, 1, $pTargetBuf)
DllStructSetData($tSimpleCapParams, 2, $Width)
DllStructSetData($tSimpleCapParams, 3, $Height)
Local $pSimpleCapParams = DllStructGetPtr($tSimpleCapParams)
Local $device = 0 ;change this number to select dshow device
;---------------------------------------------------------------------------
;Escapi init
Global $hGui = GUICreate("WebCam FaceDetection", $Width, $Height)
GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit")
GUISetState(@SW_SHOW,$hGui)
Global $hGui_Ctrl = GUICreate("Ctrl", 320, 240, 10, 10, -1, -1, $hGui)
GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit")
Global $iMode = 1, $fScale = 1.2, $iNeighbor = 1, $iMinObjW = 20, $iMaxObjW = 0, $bDoLM = True
Global $cRB_Mode = GUICtrlCreateRadio("Mode 1", 10, 10, 60, 20)
GUICtrlSetOnEvent(-1, "_SetMode")
GUICtrlSetState(-1, $GUI_CHECKED)
GUICtrlCreateRadio("Mode 2", 80, 10, 60, 20)
GUICtrlSetOnEvent(-1, "_SetMode")
GUICtrlCreateRadio("Mode 3", 150, 10, 60, 20)
GUICtrlSetOnEvent(-1, "_SetMode")
GUICtrlCreateRadio("Mode 4", 230, 10, 60, 20)
GUICtrlSetOnEvent(-1, "_SetMode")
GUICtrlCreateLabel("Scale", 5, 40, 60, 20)
GUICtrlCreateSlider(70, 40, 180, 20)
GUICtrlSetLimit(-1, 50, 11)
GUICtrlSetData(-1, 12)
GUICtrlSetOnEvent(-1, "_SetScale")
Global $cIP_Scale = GUICtrlCreateInput("1.2", 260, 40, 50, 20, 0x0800)
GUICtrlCreateLabel("Min Neighb", 5, 70, 60, 20)
GUICtrlCreateSlider(70, 70, 180, 20)
GUICtrlSetOnEvent(-1, "_SetNeighbor")
GUICtrlSetLimit(-1, 20)
GUICtrlSetData(-1, 1)
Global $cIP_MinN = GUICtrlCreateInput("1", 260, 70, 50, 20, 0x0800)
GUICtrlCreateLabel("Min ObjW", 5, 100, 60, 20)
GUICtrlCreateSlider(70, 100, 180, 20)
GUICtrlSetOnEvent(-1, "_SetMinObjW")
GUICtrlSetLimit(-1, 400)
GUICtrlSetData(-1, 20)
Global $cIP_MinW = GUICtrlCreateInput("20", 260, 100, 50, 20, 0x0800)
GUICtrlCreateLabel("Max ObjW", 5, 130, 60, 20)
GUICtrlCreateSlider(70, 130, 180, 20)
GUICtrlSetOnEvent(-1, "_SetMaxObjW")
GUICtrlSetLimit(-1, 400)
Global $cIP_MaxW = GUICtrlCreateInput("0", 260, 130, 50, 20, 0x0800)
GUICtrlCreateCheckbox("Do LandMarks", 10, 160, 100, 20)
GUICtrlSetOnEvent(-1, "_SetLandMark")
GUICtrlSetState(-1, $GUI_CHECKED)
GUISetState()
local $_escapi_Dll = DllOpen("escapi.dll")
$return = DllCall($_escapi_Dll,"int","initCOM")
$return = DllCall($_escapi_Dll,"int","countCaptureDevices")
;Consolewrite("Number of devices = " & $return[0] & @CRLF)
$return = DllCall($_escapi_Dll,"int:cdecl","initCapture", "int", $device, "ptr", $pSimpleCapParams)
;---------------------------------------------------------------------------
_GDIPlus_Startup()
While 1
$hGfx = _GDIPlus_GraphicsCreateFromHWND($hGui)
;Get frame
DllCall($_escapi_Dll,"none:cdecl","doCapture", "int", $device)
Do
$return = DllCall($_escapi_Dll,"int:cdecl","isCaptureDone", "int", $device)
Until $return[0] = 1
$hBitmap = _WinAPI_CreateBitmap($Width, $Height , 1 , 32 , $pTargetBuf)
Local $hImage = _GDIPlus_BitmapCreateFromHBITMAP($hBitmap)
$hGraphics = _GDIPlus_ImageGetGraphicsContext($hImage)
Global $hPen = _GDIPlus_PenCreate(0xAAFF0000, 2)
Global $hPen2 = _GDIPlus_PenCreate(0xAA00FF00, 1)
Global $aFaces = _FD_Detect($hImage, $iMode, $fScale, $iNeighbor, $iMinObjW, $iMaxObjW, $bDoLM)
For $i = 1 To $aFaces[0][0]
_GDIPlus_GraphicsDrawRect($hGraphics, $aFaces[$i][0], $aFaces[$i][1], $aFaces[$i][2], $aFaces[$i][3], $hPen)
If $bDoLM And UBound($aFaces, 2) > 6 Then
For $j = 0 To 67
_GDIPlus_GraphicsDrawEllipse($hGraphics, $aFaces[$i][6 + $j * 2], $aFaces[$i][7 + $j * 2], 4, 4, $hPen2)
Next
EndIf
Next
_GDIPlus_GraphicsDrawImageRect($hGfx, $hImage, 0, 0, $Width, $Height)
Sleep(10) ; <---- needed or your webcam will run glowing hot.
_GDIPlus_BitmapDispose($hImage)
_WinAPI_DeleteObject($hBitmap)
_GDIPlus_GraphicsDispose($hGraphics)
_GDIPlus_ImageDispose($hImage)
_GDIPlus_PenDispose($hPen)
_GDIPlus_PenDispose($hPen2)
WEnd
Func _SetMode()
$iMode = @GUI_CtrlId - $cRB_Mode + 1
EndFunc
Func _SetScale()
$fScale = GUICtrlRead(@GUI_CtrlId) / 10
GUICtrlSetData($cIP_Scale, $fScale)
EndFunc
Func _SetNeighbor()
$iNeighbor = GUICtrlRead(@GUI_CtrlId)
GUICtrlSetData($cIP_MinN, $iNeighbor)
EndFunc
Func _SetMinObjW()
$iMinObjW = GUICtrlRead(@GUI_CtrlId)
GUICtrlSetData($cIP_MinW, $iMinObjW)
EndFunc
Func _SetMaxObjW()
$iMaxObjW = GUICtrlRead(@GUI_CtrlId)
GUICtrlSetData($cIP_MaxW, $iMaxObjW)
EndFunc
Func _SetLandMark()
$bDoLM = (GUICtrlRead(@GUI_CtrlId) = 1)
EndFunc
;--------------------------------------------------------------------------
Func _Exit()
_GDIPlus_PenDispose($hPen)
_GDIPlus_GraphicsDispose($hGfx)
_GDIPlus_ImageDispose($hImage)
_GDIPlus_Shutdown()
DllCall($_escapi_Dll,"none:cdecl","deinitCapture", "int", 0)
GUIDelete($hGui)
Exit
EndFunc
;-----------------------------------------------------------------
Alles anzeigen
Hallo Allerseits!
Auf der Suche nach einer Möglichkeit, Gesichter zu erkennen, bin ich über das hier gestolpert: https://github.com/ShiqiYu/libfacedetection
Und daraus ist vorerst mal eine kleine UDF entstanden.
Funktioniert mit 32 und 64Bit.
Ich hab selber noch nicht viel ausprobiert und kann daher auch nicht viel über die Parameter sagen - am besten mit großen und kleinen, vielen und wenigen usw... Gesichtern ausprobieren.
Trotzdem viel Spaß!
LandMarks:
EDIT: Bugs behoben!
Danke für euer Feedback!
Hallo liebe Freunde der brotlosen Kunst.
Selten, aber doch mach ich noch was mit AutoIt.
inspiriert von dem hier: https://gamedevelopment.tutsplus.com/tutorials/how-…s--gamedev-2681
hab ich versucht das nachzubasteln. Das Resultat ist zwar ein anderes, aber dennoch ergeben sich ganz hübsche Effekte.
Lightning1.pngLightning2.pngLightning3.pngLightning4.png
Download: Lightning.7z
Viel Spaß!
E
Sehr schönes Script!
deaktiviere mal die Drawfunktion der Erde und lass nur die Wolken anzeigen -> aus diesem Effekt kann man bestimmt nochwas machen.
evtl kannst du die Geschwindigkeit noch etwas erhöhen, wenn du die Scheiben folgendermassen zeichnest:
#include <GDIPlus.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
Opt("MustDeclareVars", 1)
Opt("GUIOnEventMode", 1)
Global $iWidth = 620
Global $iHeight = 620
Global $hGui = GUICreate("GDI+", $iWidth, $iHeight)
GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit")
_GDIPlus_Startup()
Global $hGraphics = _GDIPlus_GraphicsCreateFromHWND($hGui)
Global $hBmp_Buffer = _GDIPlus_BitmapCreateFromScan0($iWidth, $iHeight)
Global $hGfx_Buffer = _GDIPlus_ImageGetGraphicsContext($hBmp_Buffer)
_GDIPlus_GraphicsSetSmoothingMode($hGfx_Buffer, 2)
_GDIPlus_GraphicsClear($hGfx_Buffer, 0xFF000000)
GUIRegisterMsg($WM_PAINT, "WM_PAINT")
GUISetState()
_Draw()
While Sleep(10)
WEnd
Func _Draw($iSteps = 18)
_GDIPlus_GraphicsClear($hGfx_Buffer, 0xFF000000)
Local $hBrush = _GDIPlus_BrushCreateSolid(0x0500FF00)
Local $hBrush2 = _GDIPlus_BrushCreateSolid(0xFF00FF00)
Local $fPI2 = ATan(1) * 2
Local $fA, $fX
For $i = 0 To $iSteps - 1
$fA = $i / $iSteps * $fPI2
$fX = Cos($fA) * 300
_GDIPlus_GraphicsFillEllipse($hGfx_Buffer, 310 - $fX, 310 - $fX, $fX * 2, $fX * 2, $hBrush)
_GDIPlus_GraphicsFillEllipse($hGfx_Buffer, 310 + $fX, 310 + Sin($fA) * 300, 4, 4, $hBrush2)
Next
_GDIPlus_BrushDispose($hBrush)
_GDIPlus_BrushDispose($hBrush2)
_GDIPlus_GraphicsDrawImage($hGraphics, $hBmp_Buffer, 0, 0)
EndFunc ;==>_Draw
Func WM_PAINT($hWnd, $uMsgm, $wParam, $lParam)
_GDIPlus_GraphicsDrawImage($hGraphics, $hBmp_Buffer, 0, 0)
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_PAINT
Func _Exit()
_GDIPlus_GraphicsDispose($hGfx_Buffer)
_GDIPlus_BitmapDispose($hBmp_Buffer)
_GDIPlus_GraphicsDispose($hGraphics)
_GDIPlus_Shutdown()
Exit
EndFunc ;==>_Exit
Alles anzeigen
Zumindest stell ich mir vor, dass man mit weniger Zeichenoperationen ein ähnlich gutes Ergebnis bekommt...
(vielleicht lieg ich aber auch nur komplett daneben...)
lgE
Manche Soundkarten können das. Ich glaub, das hieß meistens "What you hear" oder "wavemix". Damit konnte man aufnehmen, was über die Lautsprecher rauskam.
Wenn nicht, dann braucht man einen virtuellen Audiotreiber der das dann übernimmt.
Ich arbeite tatsächlich grad an sowas - wird aber noch einige Zeit dauern bis das fertig ist.
Weiters beschränke ich die erste Version auf CD-Standard (44100Hz 16Bit Stereo)
Für den Fall, dass man nur mit AutoIt eine Wav-Datei virtuell abspielen und an ein anderes Programm weiterleiten will, wäre das Vorhaben sogar noch einfacher, weil der Treiber nur die "Eingangs-Seite" darstellen muss...
Dies werd ich zumindest als erstes mal umsetzen.
Mittlerweile würd ich das mit NamedPipes lösen:
If $CmdLine[0] = 0 And @Compiled Then
RegWrite("HKEY_CLASSES_ROOT\*\shell\TestContext\command", "", "REG_SZ", '"' & @AutoItExe & '" "%1"')
RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer", "MultipleInvokePromptMinimum", "REG_DWORD", 10000)
;RegDelete("HKEY_CLASSES_ROOT\*\shell\TestContext")
;RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer", "MultipleInvokePromptMinimum", "REG_DWORD", 15)
EndIf
#include <Misc.au3>
#include <WinAPI.au3>
#include <NamedPipes.au3>
If $CmdLine[0] <> 1 Then Exit
Global $sUniqueName = "testcontext"
Global $sPipeName = "\\.\pipe\" & $sUniqueName
Global $hMutex = _Singleton($sUniqueName, 1)
Switch $hMutex
Case 0
#NoTrayIcon
Global $tCmdLine = DllStructCreate("char[" & StringLen($CmdLine[1]) & "];")
DllStructSetData($tCmdLine, 1, $CmdLine[1])
Global $iWritten
Global $hPipe = _NamedPipes_CreateNamedPipe($sPipeName, 2, 2, 0, 1, 1, 0)
_NamedPipes_ConnectNamedPipe($hPipe)
_WinAPI_WriteFile($hPipe, $tCmdLine, DllStructGetSize($tCmdLine), $iWritten)
_NamedPipes_DisconnectNamedPipe($hPipe)
_WinAPI_CloseHandle($hPipe)
Exit
Case Else
Global $iErrorCnt, $iRead, $iCnt = 1
Global $sInput = "001 " & $CmdLine[1] & @CRLF
Global $tInput = DllStructCreate("char[10];")
Global $tOutPut = DllStructCreate("char[4096];")
While $iErrorCnt < 10
_NamedPipes_CallNamedPipe($sPipeName, $tInput, DllStructGetSize($tInput), $tOutPut, DllStructGetSize($tOutPut), $iRead)
If _WinAPI_GetLastError() Then
$iErrorCnt += 1
Sleep(10)
Else
$iCnt += 1
$sInput &= StringFormat("%03s", $iCnt) & " " & DllStructGetData($tOutPut, 1) & @CRLF
$iErrorCnt = 0
EndIf
WEnd
GUICreate("TextContext", 800, 640)
GUICtrlCreateLabel($sInput, 0, 0, 800, 640)
GUISetState()
While GUIGetMsg() <> -3
WEnd
EndSwitch
Alles anzeigen
Aus irgendeinem Grund funktioniert der TimeOut-Parameter bei _NamedPipes_CallNamedPipe nicht, deshalb der kleine Workaround mit ErrorCnt..
Es gibt aber noch eine weitere Möglichkeit:
Eine Verknüpfung in "Send To" erstellen. (Im Explorer "shell:sendto" eingeben)
Dann reicht ein ganz simples Script:
Dazu bräuchte ich auch das AutoIt-Script dazu...
Du kannst die FB-DLL mit Print debuggen, z.b.: Print "> " & c & " " & pPen[c] & " " & pfX[c - 1]
Das wird dann direkt in die Konsole von SciTE geschrieben
Entweder du packst alles in eine Struct "float X[" & iCntX * iCntY & "]; float Y[" & iCntX * iCntY & "];
oder du machst es auf diese Weise:
Global $hDll = DllOpen(@ScriptDir & "\Test.dll")
_Test()
Func _Test($iCnt = 10, $iCntY = 5)
Local $sTag = "struct; float X[" & $iCnt & "]; float Y[" & $iCnt & "]; float Z[" & $iCnt & "]; endstruct; "
Local $tStruct = DllStructCreate("ptr Struct[" & $iCntY & "];")
Local $aStruct[$iCntY + 1]
For $y = 1 To $iCntY
$aStruct[$y] = DllStructCreate($sTag)
DllStructSetData($tStruct, 1, DllStructGetPtr($aStruct[$y]), $y)
Next
DllCall($hDll, "none", "_Test", "struct*", $tStruct, "uint", $iCnt, "uint", $iCntY)
For $y = 1 To $iCntY
For $i = 1 To $iCnt
ConsoleWrite("> " & $y & "/" & $i & " = " & StringFormat("%.1f %.1f %.1f", $aStruct[$y].X(($i)), $aStruct[$y].Y(($i)), $aStruct[$y].Z(($i))) & @CRLF)
Next
Next
EndFunc ;==>_Test
Alles anzeigen
Extern "Windows-MS"
Sub _Test(pStruct As Any Ptr Ptr, iCnt As UInteger, iCntY As UInteger) Export
Dim As Single Ptr pX, pY, pZ
For y As UInteger = 0 To iCntY-1
pX = pStruct[y]
pY = pStruct[y] + (iCnt * SizeOf(Single))
pZ = pStruct[y] + (iCnt * 2 * SizeOf(Single))
For i As UInteger = 0 To iCnt-1
pX[i] = y * 10000 + i
pY[i] = y * 20000 + i
pZ[i] = y * 30000 + i
Next
Next
End Sub
End Extern
Alles anzeigen
Nein - du musst zunächst dein Script umbauen, dass statt Arrays nur Structs verwendet werden.
Kommst du mit GDIPlus in FreeBasic klar, oder soll ich ein kurzes Beispiel basteln?
Um die dynamische Struct in FreeBasic anzusprechen, kannst du mit Pointern arbeiten:
Hier zwei Möglichkeiten:
Global $hDll = DllOpen(@ScriptDir & "\Test.dll")
_Test_1()
_Test_2()
Func _Test_1($iCnt = 100)
Local $tStruct = DllStructCreate("struct; float X[" & $iCnt & "]; float Y[" & $iCnt & "]; float Z[" & $iCnt & "]; endstruct; ")
DllCall($hDll, "none", "_Test_1", "struct*", $tStruct, "uint", $iCnt)
For $i = 1 To $iCnt
ConsoleWrite("> " & StringFormat("% 4s %.1f %.1f %.1f", $i, $tStruct.X(($i)), $tStruct.Y(($i)), $tStruct.Z(($i))) & @CRLF)
Next
EndFunc ;==>_Test_1
Func _Test_2($iCnt = 100)
Local $tStruct = DllStructCreate("struct; float X[" & $iCnt & "]; float Y[" & $iCnt & "]; float Z[" & $iCnt & "]; endstruct; ")
DllCall($hDll, "none", "_Test_2", "struct*", DllStructGetPtr($tStruct, "X"), "struct*", DllStructGetPtr($tStruct, "Y"), "struct*", DllStructGetPtr($tStruct, "Z"), "uint", $iCnt)
For $i = 1 To $iCnt
ConsoleWrite("+ " & StringFormat("% 4s %.1f %.1f %.1f", $i, $tStruct.X(($i)), $tStruct.Y(($i)), $tStruct.Z(($i))) & @CRLF)
Next
EndFunc ;==>_Test_2
Alles anzeigen
Extern "Windows-MS"
Sub _Test_1(pStruct As Any Ptr, iCnt As UInteger) Export
Dim As Single Ptr pX, pY, pZ
pX = pStruct
pY = pStruct + (iCnt * SizeOf(Single))
pZ = pStruct + (iCnt * 2 * SizeOf(Single))
For i As UInteger = 0 To iCnt-1
pX[i] = 10000 + i
pY[i] = 20000 + i
pZ[i] = 30000 + i
Next
End Sub
Sub _Test_2(pX As Single Ptr, pY As Single Ptr, pZ As Single Ptr, iCnt As UInteger) Export
For i As UInteger = 0 To iCnt-1
pX[i] = 10000 + i
pY[i] = 20000 + i
pZ[i] = 30000 + i
Next
End Sub
End Extern
Alles anzeigen