c++ errors ( cannot convert parameter 2 from 'char [32]' to 'int')

I am getting the following errors in my code (from an override):

.\TotalControl.cpp(36) : error C2664: 'wsprintfW' : cannot convert parameter 1 from 'char [32]' to 'LPWSTR'
        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
.\TotalControl.cpp(37) : error C2664: 'HRESULT (char *,int)' : cannot convert parameter 2 from 'char [32]' to 'int'
        There is no context in which this conversion is possible



#include <windows.h>
#include <stdio.h>
#include "stdafx.h"
#include "KC0Mapper.h"
#include "VdjPlugin.h"
#include "vdjDevice.h"

// Mapper class
class KC0DefaultMapper : public IVdjPluginDevice

      HRESULT __stdcall GetDeviceType(int *type);
      HRESULT __stdcall OnGetPluginInfo(TVdjPluginInfo *infos);
      HRESULT __stdcall OnSlider(int chan,int slider,int absvalue,int relvalue);


// Set device type
HRESULT KC0DefaultMapper::GetDeviceType(int *type)

HRESULT KC0DefaultMapper::OnSlider(int chan,int slider,int absvalue,int relvalue)
      char cmd[32];

            case KC0_SLID_CROSSFADER:
            wsprintf(cmd,"video_crossfade %d",absvalue);

// Return information about plugin
HRESULT KC0DefaultMapper::OnGetPluginInfo(TVdjPluginInfo *infos)
      static char st[128];

      infos->PluginName = ".";
      infos->Author = ".";
      infos->Description = ".";
      infos->Flag = 0;

      infos->Bitmap = LoadBitmap(hInstance,MAKEINTRESOURCE(100));

      return S_OK;
Who is Participating?
From just looking at this code, there are two separate issues I think.

For the first error:
Try changing from wsprintf to sprintf.

For the second error:
HRESULT (char *,int) seems to be the prototype for the function SendCommand, however you are providing (int, char*). Switch your params around and that should work. SendCommand(cmd,chan). I'm making guesses since I don't have the function prototype to reference.
>>error C2664: 'wsprintfW' : cannot convert parameter 1 from 'char [32]' to >>'LPWSTR'

To me that looks like the project is set to use UNICODE, yet the code doesn't - try to turn off UNICODE in your project settings or make that the ANSI version explicitly:

wsprintfA(cmd,"video_crossfade %d",absvalue);

Yet changing the settings will save you a lot of changes like the above.
makman111Author Commented:
Use Multi-Byte Character Set?
Yes, that would be the setting ;o)
makman111Author Commented:
Can you look at (below) as well?  I think you are correct, but the errors below are preventing me from seeing to total solution.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.