Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 943111
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T22:23:03+00:00 2026-05-15T22:23:03+00:00

I have a Java app which needs to interact with the camera on a

  • 0

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 LPCTSTRs. 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?

  • 1 1 Answer
  • 1 View
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T22:23:03+00:00Added an answer on May 15, 2026 at 10:23 pm

    I think you should try GetStringChars() instead of GetStringUTFChars()
    According to this page it returns the Unicode String.

    WindowsCE and Windows mobile use UNICODE exclusively so LPCTSTR
    is actually LPCWSTR (Long Pointer to 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 you want to provide a path and a filename. This is adapted from this MS page

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 493k
  • Answers 493k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer You can use String.Join. If you have a List<string> then… May 16, 2026 at 10:48 am
  • Editorial Team
    Editorial Team added an answer SHOW COLUMNS FROM WHERE TYPE LIKE "%enum%" you could afterwards… May 16, 2026 at 10:48 am
  • Editorial Team
    Editorial Team added an answer A classic case of message handling in clustered environment. This… May 16, 2026 at 10:48 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I have a Java app which needs to run differently when on Windows 7.
I have a Java application which needs to be audited (so obviously I need
I have an external web app, which needs to connect to Facebook and get
I have a Java app that can authenticate to LDAP by logging users into
We have recently upgraded one of our applications from Java 1.4 to Java 6.
For homework, I need to build a small java application.The main goal is to
I'm on planning/modeling phase to develop a remote desktop sharing solution, which must be
I'd like to know the simplest way, in Java, to get a list of
I would like to write an app on Android to upload my GPS location
This is the situation: We have some binary files (PDFs, PPTs, ZIPz, etc.) stored

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.