Click here to Skip to main content
15,892,804 members
Home / Discussions / COM
   

COM

 
GeneralIPropertyBag who knows?! Pin
Member 115323814-Jun-05 22:29
Member 115323814-Jun-05 22:29 
GeneralRe: IPropertyBag who knows?! Pin
User 21559722-Jun-05 4:50
User 21559722-Jun-05 4:50 
GeneralIPropertyBag who knows?! Pin
Member 115323814-Jun-05 22:28
Member 115323814-Jun-05 22:28 
GeneralStrange ActiveX behaviour. Pin
Jan van den Baard13-Jun-05 8:09
professionalJan van den Baard13-Jun-05 8:09 
Generalactivexscripting Pin
dittygrail12-Jun-05 23:08
dittygrail12-Jun-05 23:08 
GeneralBSTR Pin
pardis11-Jun-05 20:20
pardis11-Jun-05 20:20 
GeneralRe: BSTR Pin
User 21559713-Jun-05 3:44
User 21559713-Jun-05 3:44 
GeneralRe: BSTR Pin
Lim Bio Liong13-Jun-05 23:44
Lim Bio Liong13-Jun-05 23:44 
Hello pardis,

Here's a simple example program to illustrate it :

#include <windows.h>
#include <comdef.h>
#include <iostream>

void Function01(_bstr_t bst)
{
std::cout << (char*)bst << "\r\n";
}

int main()
{
BSTR bstr01 = ::SysAllocString(L"Hello World.");

Function01(bstr01);

if (bstr01)
{
::SysFreeString(bstr01);
bstr01 = NULL;
}

return 0;
}

The BSTR defined in main() (i.e. bstr01) is treated by the compiler as a "const wchar_t*" when it enters Function01().

Next, the compiler will take the const wchar_t* and use it as the parameter to the version of the _bstr_t constructor that takes a "const wchar_t*". The resultant _bstr_t object is "bst".

The std::cout stuff is just to demonstrate a usage of the "bst" object.

Hope the above will be helpful,
Bio.


GeneralRe: BSTR Pin
Get.Well14-Jun-05 1:57
Get.Well14-Jun-05 1:57 
GeneralLooking for Excel ver.9 type library (and how to make it work!) Pin
minette9-Jun-05 3:58
minette9-Jun-05 3:58 
GeneralCopy data to spread sheet component from excel file Pin
Member 20313358-Jun-05 22:34
Member 20313358-Jun-05 22:34 
GeneralCapturing ActiveX events Pin
Haroon8-Jun-05 19:51
Haroon8-Jun-05 19:51 
GeneralSending User Defined Types over COM Interface Pin
ChemmieBro8-Jun-05 4:53
ChemmieBro8-Jun-05 4:53 
GeneralRe: Sending User Defined Types over COM Interface Pin
Andy Moore8-Jun-05 11:06
Andy Moore8-Jun-05 11:06 
GeneralRe: Sending User Defined Types over COM Interface Pin
Lim Bio Liong14-Jun-05 1:16
Lim Bio Liong14-Jun-05 1:16 
GeneralRe: Sending User Defined Types over COM Interface Pin
Logan from Singapore26-Jun-05 23:05
Logan from Singapore26-Jun-05 23:05 
GeneralRe: Sending User Defined Types over COM Interface Pin
Lim Bio Liong27-Jun-05 0:26
Lim Bio Liong27-Jun-05 0:26 
GeneralCreate GUID from string Pin
Kri58-Jun-05 4:17
Kri58-Jun-05 4:17 
GeneralRe: Create GUID from string Pin
Anonymous9-Jun-05 1:00
Anonymous9-Jun-05 1:00 
GeneralGet Control ID from ActiveX button Pin
MailtoGops6-Jun-05 5:52
MailtoGops6-Jun-05 5:52 
GeneralRe: Get Control ID from ActiveX button Pin
Veera Raghavendra17-Jun-05 19:08
Veera Raghavendra17-Jun-05 19:08 
GeneralRe: Get Control ID from ActiveX button Pin
MailtoGops22-Aug-05 0:25
MailtoGops22-Aug-05 0:25 
GeneralDistributed Transaction Error Pin
janlala5-Jun-05 0:10
janlala5-Jun-05 0:10 
QuestionIDispacth, ADORecordset and properties loss?!? Pin
almc3-Jun-05 0:53
almc3-Jun-05 0:53 
General Acessing ActiveX Component Interfaces/ Library not registered Pin
Florian Storck1-Jun-05 23:13
Florian Storck1-Jun-05 23:13 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.