> ####CODE START#####
> typedef int (__stdcall *FINDNI) (LPCTSTR name);
> FINDNI mp_ibfind;
>
> void MyFunction(char *cardName/*GPIB0*/)
> {
> char name[100];
> int card = -1;
>
> //=== Clear the flags and pointers.
> m_hDll = NULL;
>
> //=== Local function pointers used during 'Find' //operations.
> mp_ibfind = NULL;
> mp_iopen = NULL;
> mp_iclose = NULL;
>
> //=== Try to load the DLL. Bail on fail.
> m_hDll = AfxLoadLibrary("gpib-32.dll");
> if (m_hDll == NULL)
> return;
>
> //=== Get a pointer to the 'ibfind' function. Bail on //fail.
> mp_ibfind = (FINDNI)GetProcAddress(m_hDll,"ibfindA");
> if (mp_ibfind == NULL) {
> AfxFreeLibrary(m_hDll);
> m_hDll = NULL;
> return;
> }
>
> //=== If a specific card name was requested, search //only for that
> name.
> if (cardName
!= NULL) {
> sprintf(name,"%s",cardName);
> card = (*mp_ibfind)(name);//** this line makes
> //the computer to crash
****
this line should crash your computer! To load library I used LoadLibrary,
not AfxLoadLibrary, but I think that they work the some. Whatever when you
call mp_ibfind you shoudn't use * I think.
Try to do this in this way :
card = mp_ibfind(name)
I hope - that help you.
Sorry that I answer now, but I went home and just get back today.
Have good day !
Gorgo
> }
> }
> ####CODE END####
>
> Thanks