java - Windows Mobile Native Code - jstring to LPCTSTR -


i have java app needs interact camera on windows mobile device. have written java code , native code , works fine. problem having want start passing variables java native code, e.g. directory , file name use photo.

the native code uses shcameracapture object interact camera , expects directory , filename specified using lpctstrs. string passed in jstring, can const char * calling:

const char *strdir=(jenv)->getstringutfchars(dirname, 0); 

but not sure how can pass the shcameracapture object because cannot convert const char * lpctstr. tried cast (lpctstr)strdir , compiled, error when runs (that can't create file).

i java developer , pretty new c++ etc. not sure need string native call. ideas?

i think should try getstringchars() instead of getstringutfchars() according this page returns unicode string.

windowsce , windows mobile use unicode exclusively lpctstr lpcwstr (long pointer const widechar string)

shcameracapture shcc; zeromemory(&shcc, sizeof(shcc)); shcc.cbsize = sizeof(shcc); shcc.pszinitialdir = (tchar*)(jenv)->getstringchars(dirname, 0 );  shcc.pszdefaultfilename = (tchar*)(jenv)->getstringchars(deffilename, 0 ); 

i assume want provide path , filename. adapted this ms page


Comments

Popular posts from this blog

c++ - How do I get a multi line tooltip in MFC -

asp.net - In javascript how to find the height and width -

c# - DataTable to EnumerableRowCollection -