Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Borland Delphi > Re: Advice for ...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 5 of 10 Topic 3843 of 3888
Post > Topic >>

Re: Advice for jedi project.

by "Kevin Urben" <me@[EMAIL PROTECTED] > Jul 20, 2008 at 09:56 AM

Here's my function for loading dynamically loading a DLL.

Returns 0 for success, 1 for no DLL, 2 for missing function.

I've deleted some of the "GetProcs" to shorten the code.

Not sophisticated - but it works.

{------------------------------------------------------------------------------}

function DaqOpenLib : Integer;

var
s : array [0..79] of Char;

label Error;

begin
hDLL:=LoadLibrary('NICAIU.DLL');
if hDLL=0 then
   begin
   ShowLastError(GetLastError);
   ShowError('Cannot load National Instruments NI-DAQ DLL !', 0);
   Result:=1;
   Exit;
   end;

s:='DAQmxCreateTask';
@[EMAIL PROTECTED]
(hDLL, s);
if @[EMAIL PROTECTED]
 then goto Error;

s:='DAQmxClearTask';
@[EMAIL PROTECTED]
(hDLL, s);
if @[EMAIL PROTECTED]
 then goto Error;

s:='DAQmxCreateDIChan';
@[EMAIL PROTECTED]
(hDLL, s);
if @[EMAIL PROTECTED]
 then goto Error;

s:='DAQmxCreateDOChan';
@[EMAIL PROTECTED]
(hDLL, s);
if @[EMAIL PROTECTED]
 then goto Error;

Result:=0;
Exit;

Error:
FreeLibrary(hDLL);
ShowError('Function '+ s +' not found in NI-DAQ.DLL !', 0);
Result:=2;
end;

{------------------------------------------------------------------------------}
 




 10 Posts in Topic:
Advice for jedi project.
"Skybuck Flying"  2008-07-20 07:24:46 
Re: Advice for jedi project.
"Skybuck Flying"  2008-07-20 07:26:33 
Re: Advice for jedi project.
"Skybuck Flying"  2008-07-20 07:27:53 
Re: Advice for jedi project.
"Skybuck Flying"  2008-07-20 07:29:58 
Re: Advice for jedi project.
"Kevin Urben" &  2008-07-20 09:56:50 
Re: Advice for jedi project.
"Skybuck Flying"  2008-07-20 16:03:42 
Re: Advice for jedi project.
spam2you <spam2you@[EM  2008-07-20 18:17:23 
Re: Advice for jedi project.
"Kevin Urben" &  2008-07-20 18:11:22 
Re: Advice for jedi project.
"Skybuck Flying"  2008-07-21 04:41:50 
Re: Advice for Skybuck project.
spam2you <spam2you@[EM  2008-07-20 12:35:42 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Thu Aug 28 5:45:09 CDT 2008.