Writing data to the neofox, Closing a connection, Application maintenance – Ocean Optics NeoFox Engineering Note User Manual
Page 6: Sample code, Remarks
 
NeoFox Communication Interfaces
6 013-20000-010-04-201211
Writing Data to the NeoFox
Writing variables to the device is similarly accomplished through either of two functions: DeviceSetParameter 
or DeviceSetParameterFloat. Again, the determination of which function to use will be based on the type of the 
data that is to be sent. 
Closing a Connection
When interaction with the device is complete, the connection should be closed by calling the DeviceClose 
function. 
Application Maintenance
Before calling any functions from the DLL, applications should make a call to the DLL’s ApplicationStartup 
function, which will begin a new thread in which it can run its background processes. Before exiting, 
applications should call ApplicationShutdown to terminate this thread. 
Sample Code
A sample C++ program (MS Visual C++) that demonstrates how to use the device is available from th
website.
Remarks
There is one additional issue that some early developers have faced which bears some discussion. The szText 
parameters, which are defined as type LPTSTR, are implemented as type char* in the DLL. There is a known 
issue with the Microsoft Visual C++ compiler in which sometimes the compiler has trouble casting between 
LPTSTR and char* types. One simple way to resolve this issue is to not include windows.h, which defines 
LPTSTR, and use a typedef instead (typedef char* LPTSTR). Another, more advisable, way to correct this issue 
is to set the project properties to use a multi-byte character set. This can be done by adjusting the “character set” 
project property at Properties  Configuration Properties  General. 
It is also important to note that the maximum number of NeoFox units that can be supported by the DLL at one 
time is 8.