WCHAR[] to 'wchar_t'

Hi guys I'm writing a program for Microsoft's Kinect. I borrowed some code from one of the samples provided in Microsoft's SDK and now I'm getting an error which I can't resolve.

: cannot convert parameter 1 from 'WCHAR [260]' to 'wchar_t'
There is no context in which this conversion is possible


1
2
3
4
5
6
      WCHAR screenshotPath[MAX_PATH];
      GetScreenshotFileName(screenshotPath, _countof(screenshotPath));
      .
      .
      .
      HRESULT GetScreenshotFileName(wchar_t *screenshotName, UINT screenshotNameSize)


I've also included the header file "winnt.h" which I'm not sure is necessary or not but when I did a lookup on the declaration of WCHAR visual studio said the typedef was done there. Honestly, im not all that familiar with these data types and am looking for a quick fix since this a very small portion of my code but if thats not an option I'm willing to do what it takes.
First, confirm that WCHAR is another name for wchar_t, and then this might do the job:

GetScreenshotFileName(&(screenshotPath[0]), _countof(screenshotPath));
Last edited on
When I hover WCHAR in visual studio it says "typedef wchar_t to WCHAR" so I think it is another name for wchar_t.

I made the changes to my code as you suggest and now the error changed to "cannot convert parameter 1 from 'WCHAR *' to 'wchar_t' ".
That seems very ood, given that
RESULT GetScreenshotFileName(wchar_t *screenshotName, UINT screenshotNameSize)
clearly indicates it should be trying to transform it into wchar_t*

If you had
GetScreenshotFileName(screenshotPath[0], _countof(screenshotPath));
that would be handing it a wchar_t, but what it would do with a single character in place of a en entire pathname I've no idea.

Is RESULT GetScreenshotFileName(wchar_t *screenshotName, UINT screenshotNameSize) definitely the right function prototype?

Yea so I'm an idiot and forgot the * in my function prototype. Thanks for the help.
Topic archived. No new replies allowed.