I would suggest to use the loadlibrary from the SDK, then GetProcAddress and
then a function pointer to make a call. Feel free to quickly review the page
: http://perso.wanadoo.fr/philippe.baucour/pratiquer/ptrfn/ptrfn.html
You may want to try the code below
//---------------------------------
#include
#include
#include
// FCTX est donc un pointeur sur une fonction qui attend un int, un char *
etc...
typedef int (*FCTX)(int hWnd, char *Texte, char *Titre, unsigned int Type);
// Nom de la fonction que l'on veut appeler
#define NOM_FONCTION "MessageBoxA"
// Nom de la DLL � charger
#define NOM_MODULE "user32.dll"
int main (int argc, char *argv[]) {
static char ModPath[255]="C:\\WINNT\\system32\\";
int Status;
FCTX Fn_Ptr;
HMODULE ModId;
wchar_t bob;
strcat (ModPath, NOM_MODULE);
// Chargement de la DLL
ModId = LoadLibrary(ModPath);
// R�cup�re l'adr de la fonction
Fn_Ptr = (FCTX)GetProcAddress(ModId, NOM_FONCTION);
// Appel de la fonction avec passage de param�tres
Status = Fn_Ptr(0, "Le texte de la boite de dialogue", "Le tire", MB_OK);
// D�chargement de la DLL
FreeLibrary(ModId);
printf ("Apr�s appel de la fonction dans le module, le status = %i\n",
Status);
printf("Strike ENTER to exit :");
getchar();
return(0);
}
//--------------------------------------------------
In addition, for what I know using these function was explain during the
last CVI Days in France. You may want to contact NI France to get a copy of
the CVI Day Manual (if yet available). In any case a huge zip file is
available on ni.com/france/cvi
--
Philippe
Feel free to visit : http://perso.wanadoo.fr/philippe.baucour
"Pierre" a �crit dans le message de news:
506500000008000000367D0000-1042324653000@exchange.ni.com...
> Hello,
> I've got problem trying to "GetExternalModuleAddr" from a function
> inside a DLL that is loaded with "LoadExternal()". I've already done
> that in the past but I've got an error (-25). Here's my code :
> Inside the DLL :
> I've tried both __stdcall and DLLEXPORT:
> int __stdcall DEV1502_Load( void *pvData, char *va_psPath, int
> va_hPanel )
>
> Inside my application :
>
> vl_iModuleId = LoadExternalModule( "1502.lib");
> if( vl_iModuleId >=0 )
> {
> vl_pfDEV_Load = GetExternalModuleAddr ( vl_iModuleId,
> "DEV1502_Load", &iStat );
> }
>
> The iModuleID is correct, but I can't reach the function: iStat=-25.
> SO, I've used the SDK function and it works !.
> I've to load "1502.dll" instead of "1502.lib" with CVI function. Why ?
>
> I use CVI beta 7 and Windows 2000.
>
> Thank's for any advice