I have a Java app which needs to interact with the camera on a Windows Mobile device. I have written the Java Code and the Native code and it all works fine. The problem I am having now is that I want to start passing variables from Java to the Native code, e.g. the directory and file name to use for the photo.
The native code uses a SHCAMERACAPTURE
object to interact with the camera and it expects the directory and filename to be specified using LPCTSTR
s. The string passed in is a jstring, which I can get to a const char *
by calling:
const char *strDir=(jEnv)->GetStringUTFChars(dirName, 0);
But I am not sure how I can pass this to the the SHCAMERACAPTURE
object because it cannot convert const char *
to LPCTSTR
. I tried a cast (LPCTSTR)strDir
and it compiled, but I get an error when it runs (that it can't create the file).
I am a Java developer and pretty new to C++ etc. so I am really not too sure what I need to do to get my string into the native call. Any ideas?