Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Retrieving information from DLL
Message
De
15/01/2001 05:39:42
 
 
À
15/01/2001 04:12:01
Information générale
Forum:
Visual FoxPro
Catégorie:
Contrôles ActiveX en VFP
Divers
Thread ID:
00460761
Message ID:
00463694
Vues:
12
I have never had a need to do this from VFP so I don't a VFP specific example, however I can say that you need to use more than just the UpdateResource() function as you will see from the following C/C++ code:-
HRSRC hResLoad;     // Handle to loaded resource.
HANDLE hExe;        // Handle to source .EXE file. 
HRSRC hRes;         // Handle to res. info. in hExe.
HANDLE hUpdateRes;  // Update resource handle. 
char *lpResLock;    // Pointer to resource data.
BOOL result; 
 
   // Load the .EXE file that contains the dialog box 
   // you want to copy. 
   hExe = LoadLibrary("source.exe"); 
 
   if (hExe == NULL) 
      ErrorHandler("Could not load the source EXE."); 
 
   // Locate the dialog box resource in the .EXE file. 
   hRes = FindResource(hExe, "SampleDialog", RT_DIALOG); 
 
   if (hRes == NULL) 
      ErrorHandler("Could not locate the SampleDialog resource."); 
 
   // Load the dialog box into global memory. 
   hResLoad = LoadResource(hExe, hRes); 
 
   if (hResLoad == NULL) 
      ErrorHandler("Could not load the SampleDialog resource."); 
 
   lpResLock = LockResource(hResLoad); 
 
   if (lpResLock == NULL) 
      ErrorHandler("Could not lock resource memory."); 
 
   // Open the destination file to which we add the resource.
   hUpdateRes = BeginUpdateResource("destination.exe", FALSE); 
 
   if (hUpdateRes == NULL) 
      ErrorHandler("Could not open destination file for writing."); 
 
   // Add the dialog box resource to the update list. 
   result = UpdateResource(hUpdateRes,           // Update resource handle.
      RT_DIALOG,                                 // Change dialog box resource. 
     "AboutBox",                                 // Dialog box name. 
     MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL),  // Neutral language.
     lpResLock,                                  // Pointer to resource info.
     SizeofResource(hExe, hRes));                // Size of resource info. 
 
   if (result == FALSE) 
      ErrorHandler("Could not add resource to the update list."); 
 
   // Write changes and close destination EXE. 
   if (!EndUpdateResource(hUpdateRes, FALSE)) 
      ErrorHandler("Could not write changes to destination EXE."); 
 
   if (!FreeLibrary(hExe)) 
      ErrorHandler("Could not free executable."); 
} 
This is source originally taken from sn MSDN example but as you can see its quite involved.

HTH
Neil
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform