Quoting ME <
[email protected]>:
It looks like you're using VC6 where wchar_t is a typedef for unsigned
short instead its own distinct type and the 3rd parameter for MethodA
is a wchar_t ** for some really stupid reason.
Yes I am using VC++ 6.0. Please do see the code
Quoting ALL:
Alrt.. I am pasting the code of what I am doing... And Yes I need to
pass a BSTR value in the place of the third parameter
BEGIN_RULE_FUNCTION(rule_ONE_Schedule)
{
FIString batchName, lotStepName, lotName, stepName;
FIString remainingTaskName = "";
std::string* ChkName;
int position; //using it as an indexer....
char* StationName = new char[10];
// Copy text in the attribute
strcpy (StationName, theStation->name().data());
wchar_t wstr[256];
// Transform the text in the COM format
MultiByteToWideChar (CP_ACP, 0, StationName, -1, wstr, sizeof(wstr) /
sizeof (wchar_t));
// Format for the communication, and memory allocation
BSTR bstr = SysAllocString (wstr);
WCHAR ws[256];
MultiByteToWideChar(CP_ACP, MB_ERR_INVALID_CHARS, taskName->c_str, -1,
ws, sizeof(ws) / 2 - 1);
BSTR tName = SysAllocString (ws);
GlobalInterfacePtr->MethodA(position, bstr, &tName);
while ((tName != NULL))
{
batchName = tName->c_str();
rescueBatchName = tName->c_str();
//some other code.....
}
}
What this code does is... Passes the parameters to the Function written
in C# and gets a string value in return, the parameter "tName"
mentioned in the GlobalInterfacePtr->MethodA(.......).. and checks the
value in side the tName and goes into the "While" loop...
Does this help to provide a lead?
The error I get is
error C2664: 'MultiByteToWideChar' : cannot convert parameter 3 from
'const char *(void) const' to 'const char *'
There is no context in which this conversion is possible
Any thoughts???
Thanks a much!
Karthik