Util-Resource import by name

From Vectorlab

Jump to: navigation, search


Searches a list created by "BuildResourceList" for a given resource name. Returns true upon finding the name and importing it in the current document. By Orso B. Schmid


{ Orso *********************************************** }
{ parses all resources for a res of given name, imports the first found, result : FALSE if no import }
FUNCTION U_ImportFromListByName(listID: LONGINT; name2search: STRING): BOOLEAN;
    VAR
        resListSize, i: LONGINT;
        temp_h : HANDLE;
        
    BEGIN
        resListSize := ResourceListSize(listID);
        i := 0;
        
        { here I just pick the first I find, if any }
        WHILE (i < resListSize) & (temp_h = NIL) DO BEGIN
            i := i + 1;
            
            IF GetActualNameFromResourceList(listID, i) = name2search THEN
                temp_h := ImportResourceToCurrentFile(listID, i);
        END;
        
        U_ImportFromListByName := (temp_h <> NIL);
    END;
Personal tools