K8061 with vfp9 pt. 2

hi, velleman;
thank you for your instructions 2 weeks ago. now i can open the device and be sure that the card is really connected to my pc. but i have problems running the following codes and do not know the way to solve it. a textbox(text1) with a click event is employed:-

thisform.text1.setfocus
messagebox("WAITING TIME 2S STARTED.",0+64,"SYSTEM NOTICE",2000)
declare integer opendevice in k8061.dll
   atlong=opendevice()
   thisform.text1.value=atlong
messagebox("PROCESS CONTINUES IN 4S.",0+64,"SYSTEM NOTICE",4000)
declare integer outputanalogchannel in k8061.dll
   dimension outputanalogchannel(3) as integer
   outputanalogchannel(0, 1, 127)
if messagebox("DO YOU WANT TO CLOSE DEVICE?",4+32,"REQUEST")=6
   declare integer closedevice in k8061.dll
   thisform.init
else
   thisform.init
endif
thisform.init

both mpusbapi.dll and k8061.dll must be in the windows’ system32 folder to make the 1st part of the codes work(i.e. -1 or -2 will appear in textbox1) as expected. my problem is on the 2nd
part. vfp9 gives a program error message - outputanalogchannel is not a function, procedure or program and stops at this line(of course!). program error switches to too many arguments
if line - dimension outputanalogchannel(3) as integer - is deleted.
how can i solve this one in order to alter the voltage of a channel according to the given data?
thank you for your kind attention.
regards.
this, from
kit

Could you please copy and paste your code to the post.
BTW: The DLL function names are case sensitive.
Please see: “Cannot find entry point (DLL name) in the DLL with Visual FoxPro”
support.microsoft.com/kb/149431

hi, velleman;
i cannot copy & paste the codes because the pc i am using to develop my application does not have an internet connection. anyway, the questions i am asking this time are not very
complicated(for you - i think) and the codes are short:-

  1. i am not exactly sure what it means by case-sensitive, would you like to give a more detailed explanation?
  2. my task is to alter an 8-bit da channel according to the new data, but the codes always end up with program error(p.e.) as shown below:-
    declare outputanalogchannel in k8061.dll; 0, 1, 127
    ? outputanalogchannel ( ) (p.e. cannot load 32-bit dll k8061.dll)
    delcare outputanalogchannel in k8061.dll
    outputanalogchannel(0, 1, 127) (p.e. too many arguments)
    how can i handle this to accomplish my task?
    thank you for your attention.
    regards.
    from, kit

[quote]delcare outputanalogchannel in k8061.dll
outputanalogchannel(0, 1, 127) (p.e. too many arguments)[/quote]There are no parameters in the declare statement.
I think should be:

DECLARE OutputAnalogChannel IN k8061.dll integer CardAddress, integer Channel, integer Data 

For more details please see:
http://msdn.microsoft.com/en-us/library/ydcf39aa(v=VS.80).aspx
http://msdn.microsoft.com/en-us/library/h5tx5dbz(VS.80).aspx

thank you very much for your instructions. upon some trial and error, i come to the conclusions(and it works) as follow:-

  1. case-sensitive - it means a .dll file must be called case by case. a function in a .dll must be declared everytime it is to be called. that is to say, the no. of declaration must be equal to the
    no. of calling, otherwise there will be a program error or the calling just does not work;
  2. an example below shows the codes for outputting a max. voltage to analog channel no.4 of cardaddress 0:-
    declare outputanalogchannel in k8061.dll integer cardaddress, integer channel, integer data
    outputanalogchannel(0, 4, 255)
    this comes to an end of the problems. from, kit

Case sensitive means that uppercase and lowercase letters must match exactly: “MyFunction” is not equal to “myFunction”.

Declaring a function means telling the compiler that a function exists and what it looks like; This is the same for declaring a variable. Declaring a function should only be done once. From that point the compiler will know that that function exists and you can use it freely in your application by calling it.

This line means: There is a function named ‘OutputAnalogChannel’ located in a DLL called ‘K8061.dll’. This function has three parameters: three integers called ‘CardAddress’, ‘Channel’, and ‘Data’.

Be sure to put that line somewhere at the top of your source where its scope is the largest.