2014-04-12 237 views
-2

如何加載資源形成另一個文件?
這是從項目加載資源腳本:從文件加載資源

function Loadhwid: string; 
var 
    ResourceLocation: HRSRC; 
    ResourceSize: dword; 
    ResourceHandle: THandle; 
    ResourcePointer: pointer; 
begin 
    ResourceLocation := FindResource(hInstance, 'HWID', RT_RCDATA); 
    ResourceSize := SizeofResource(hInstance, ResourceLocation); 
    ResourceHandle := LoadResource(hInstance, ResourceLocation); 
    ResourcePointer := LockResource(ResourceHandle); 
    if ResourcePointer <> nil then 
    begin 
    SetLength(Result, ResourceSize - 1); 
    CopyMemory(@Result[1], ResourcePointer, ResourceSize); 
    FreeResource(ResourceHandle); 
    end; 
end; 

但我想知道如何從外部exe文件(我知道怎麼寫的資源)加載資源。
我想用這個腳本作爲HWID的更新工具。

回答

1

致電LoadLibraryEx通過LOAD_LIBRARY_AS_DATAFILE or LOAD_LIBRARY_AS_IMAGE_RESOURCE

+0

你還需要幫助嗎? –