If you encounter problems at ordinary times, record them here. Make a record for yourself and refer to users who encounter similar problems.
When using javascript to call activex controls, I need to pass a string to the activex control. Now I have encountered a strange problem. Printing in javascript is correct, but it is not correct in activex control.
If you directly pay the char * type in the activex control, there is no problem. It is suspected that the parameter conversion is incorrect during data transfer. The conversion is indeed incorrect after verification. This involves a type of LPCTSTR.
Since I have been developing in linux, I am really not familiar with the LPCTSTR. Later I checked the definition and found that the comment in it was a 16-bit UNICODE character. It seems that the conversion is incorrect. What my program in activex control needs is char *
It is an 8-bit width. This is definitely not the case. Fortunately, many people have encountered similar problems on the Internet, but the answers are mixed. The verified items are provided here:
Let's assume that rtsp_URL is the type of LPCTSTR transmitted by javascript.
DWORD tmp_len = WideCharToMultiByte (CP_OEMCP, NULL, rtsp_URL,-1, NULL, 0, NULL, FALSE );
StreamURL = (char *) malloc (tmp_len );
WideCharToMultiByte (CP_OEMCP, NULL, rtsp_URL,-1, streamURL, tmp_len, NULL, FALSE );
StreamURL is of the char * type.
Author: huguohu2006