Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi all,
I'm trying to convert a BSTR string pass from VBA to a xll/dll but without success. I tried the following: 1. WideCharToMultiByte (result is ????, if I replace the bstr with a hardcoded string say with *bstr = SysAllocString(L"this is BSTR!!!"), it'll work) DWORD len, bstrLength; bstrLength = SysStringLen(*bstr); len = WideCharToMultiByte(CP_ACP, 0, *bstr, bstrLength, 0, 0, 0, 0); size_t result; if(len 0) { result = WideCharToMultiByte(CP_ACP, 0, *bstr, bstrLength, buffer, len, 0, 0); buffer[len] = 0;//null-terminated char } 2. wcstombs (result is empty string) int len = wcslen(*bstr); char *dest = (char*)malloc(len); size_t result = wcstombs(dest, (wchar_t*)bstr, len); 3. Direct casting work but it'll crash the program later strcat(buffer, (char*)(*bstr)); Anyone have any advise? |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Char(10) or Char(13) in body of email | Excel Programming | |||
FIND 1 char in cell of any 3 char =True | Excel Discussion (Misc queries) | |||
8500 cells with phone number(7 char.), wishing to add area code (10 char.) | Excel Discussion (Misc queries) | |||
Getting rid of char(160) | Excel Programming | |||
How to removed the first three char and last char in XLS | Excel Programming |