以下は開発者向けの情報です。
ProgIDは「MacBinManipulator.MacBinFile」である。よってたとえばVBScriptで生成する場合は以下のようにする。
Dim macbin
Set macbin = WScript.CreateObject("MacBinManipulator.MacBinFile")
メソッドの戻り値はすべてHRESULTである。{}内の引数はVB(Visual Basic)等で使用する場合は省略可である。最後の引数pValはVisual Basicで言う戻り値である。BSTRはVisual BasicでのStringである。
プロパティはすべてReadOnlyである。
OFN_ALLOWMULTISELECT(=0x00000200)を指定した場合は2以上になることもある。)
Dim macbin
On Error Resume Next
Set macbin = WScript.CreateObject("MacBinManipulator.MacBinFile")
If Err.Number <> 0 Then
MsgBox "MacBinManipulatorコンポーネントがシステムにインストールされていません。", vbCritical
Else
On Error Goto 0
Dim filePath
filePath = macbin.GetOpenFileName()
If macbin.FileCount = 1 Then
Call macbin.OpenFile(filePath) 'GetOpenFileNameだけではファイルはオープンされないのに注意
If macbin.MacBinVersion > 0 Then
Dim msg
msg = "MacBinary Version: " & macbin.MacBinVersion & vbCrLf & "Data Fork
Size: " & macbin.DataForkSize & " bytes" & vbCrLf & "Resource Fork Size: " &
macbin.RsrcForkSize & " bytes" & vbCrLf & vbCrLf
If macbin.DataForkSize > 0 Then 'データフォークが存在する
If MsgBox( msg & "データフォークをファイルに保存しますか?", vbYesNo + vbQuestion,
"MacBinManipulator") = vbYes Then
Dim fso
Dim newFileName, ext, defExt, filter
defExt = "dat"
On Error Resume Next
Set fso = WScript.CreateObject("Scripting.FileSystemObject")
If Err.Number <> 0 Then
On Error Goto 0
newFileName = "NewFile.dat"
Else
On Error Goto 0
newFileName = fso.GetFileName(filePath)
ext = fso.GetExtensionName(newFileName)
If StrComp(ext, "bin", 1) = 0 Then
newFileName = fso.GetBaseName(newFileName)
defExt = fso.GetExtensionName(newFileName)
If defExt = "" Then
defExt = "dat"
newFileName = newFileName & ".dat"
End If
ElseIf(ext = "") Then
newFileName = newFileName & ".dat"
Else
defExt = ext
newFileName = fso.GetBaseName(newFileName) & "_dat." & ext
End If
End If
If StrComp(defExt, "dat", 1) = 0 Then
filter = "" 'Use default filter
Else
filter = "*." & defExt & "|*." & defExt & "|All Files (*.*)|*.*|"
End If
Dim newFilePath
newFilePath = macbin.GetSaveFileName(newFileName , defExt, filter,
fso.GetParentFolderName(filePath))
If newFilePath <> "" Then
Call macbin.ExtractDataFork(newFilePath, 1) 'flags = 1:
ファイル日付をオリジナルファイルと同じにする
End If
End If
Else 'リソースフォークの保存はあまり意味が無いのでやらない
MsgBox msg, vbInformation, "MacBinManipulator"
End If
Else
MsgBox filePath & vbCrLf & "はマックバイナリではないようです。", vbInformation,
"MacBinManipulator"
End If
End If
End If
DLLファイルのインストール場所は 「Drive:\ProgramFiles\Common Files\Kanadea Software\Utilities\MacBinManipulator.dll」である。