参考: Dim hResLoad As Long ' handle to loaded resource Dim hExe As Long ' handle to existing .EXE file Dim hRes As Long ' handle/ptr. to res. info. in hExe Dim hUpdateRes As Long ' update resource handle Dim lpResLock As Long ' pointer to resource data Dim result As Boolean
' Load the .EXE file that contains the dialog box you want to copy. hExe = LoadLibrary("hand.exe") If hExe = 0 Then MsgBox "Could not load exe."
' Locate the dialog box resource in the .EXE file. hRes = FindResource(hExe, "AboutBox", RT_DIALOG) If hRes = 0 Then ErrorHandler ("Could not locate dialog box.")
' Load the dialog box into global memory. hResLoad = LoadResource(hExe, hRes) If hResLoad = 0 Then MsgBox "Could not load dialog box."
' Lock the dialog box into global memory. lpResLock = LockResource(hResLoad) If lpResLock = 0 Then MsgBox "Could not lock dialog box."
' Open the file to which you want to add the dialog box resource. hUpdateRes = BeginUpdateResource("foot.exe", False) If hUpdateRes = 0 Then MsgBox "Could not open file for writing."
' Add the dialog box resource to the update list. result = UpdateResource(hUpdateRes, RT_DIALOG, "AboutBox", MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL), lpResLock, SizeofResource(hExe, hRes)) If Not result Then MsgBox "Could not add resource."
' Write changes to FOOT.EXE and then close it. If EndUpdateResource(hUpdateRes, False) <> 0 Then MsgBox "Could not write changes to file."
' Clean up. If FreeLibrary(hExe) <> 0 Then MsgBox "Could not free executable."
Dim hResLoad As Long ' handle to loaded resource
Dim hExe As Long ' handle to existing .EXE file
Dim hRes As Long ' handle/ptr. to res. info. in hExe
Dim hUpdateRes As Long ' update resource handle
Dim lpResLock As Long ' pointer to resource data
Dim result As Boolean
' Load the .EXE file that contains the dialog box you want to copy.
hExe = LoadLibrary("hand.exe")
If hExe = 0 Then MsgBox "Could not load exe."
' Locate the dialog box resource in the .EXE file.
hRes = FindResource(hExe, "AboutBox", RT_DIALOG)
If hRes = 0 Then ErrorHandler ("Could not locate dialog box.")
' Load the dialog box into global memory.
hResLoad = LoadResource(hExe, hRes)
If hResLoad = 0 Then MsgBox "Could not load dialog box."
' Lock the dialog box into global memory.
lpResLock = LockResource(hResLoad)
If lpResLock = 0 Then MsgBox "Could not lock dialog box."
' Open the file to which you want to add the dialog box resource.
hUpdateRes = BeginUpdateResource("foot.exe", False)
If hUpdateRes = 0 Then MsgBox "Could not open file for writing."
' Add the dialog box resource to the update list.
result = UpdateResource(hUpdateRes, RT_DIALOG, "AboutBox", MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL), lpResLock, SizeofResource(hExe, hRes))
If Not result Then MsgBox "Could not add resource."
' Write changes to FOOT.EXE and then close it.
If EndUpdateResource(hUpdateRes, False) <> 0 Then MsgBox "Could not write changes to file."
' Clean up.
If FreeLibrary(hExe) <> 0 Then MsgBox "Could not free executable."