 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
ian Guest
|
Posted: Thu Sep 23, 2004 10:23 am Post subject: How to make an OCX visible |
|
|
Using C++ Builder 6 on XP pro.
How do you make an OCX visible?
I want the form to appear so that I can use the buttons etc on it.
The OCX was created as an ActiveForm.
I'm calling it manually rather than as a VCL drop in object.
I have CoCreateInstance running, got the Interface and can set and get properties e.g. a custom 'SimLevel' property that shows its the right object.
I tried setting the set_Visible property to 1 but that didn't work. Is there another value it should be set to?
So anybody know how to make the thing appear?
The folowing is the code to get the interface:
//**********************************
// CLSID and GUID are all setup
if(SUCCEEDED(CoInitialize(0)))
{
if(SUCCEEDED(hr)) // Got the CLSID ok
{
// Create the instance
hr = CoCreateInstance(CLSID_COMtest, NULL,
CLSCTX_INPROC_SERVER,
IID_IUnknown, (void**)&pInstance);
if(SUCCEEDED(hr))
{
// get the interface
hr = pInstance->QueryInterface(IID_ICOMtest, (void**)
&pCOMtestInterface) ;
(hr == S_OK)
{
// test message with custom property
MessageDlg("SimLevel = " +
AnsiString(pCOMtestInterface->get_SimLevel()),
mtInformation, TMsgDlgButtons() << mbOK, 0);
pCOMtestInterface->set_Visible(1); // Does nothing... }
}
}
//**************************
Thanks in advance
Ian.
|
|
| Back to top |
|
 |
Mark Guerrieri Guest
|
Posted: Fri Sep 24, 2004 1:42 am Post subject: Re: How to make an OCX visible |
|
|
Try passing VARIANT_TRUE (i.e. -1) to set_Visible.
Mark
"ian" <ian_nospam_ (AT) matrix_nospam_multimedia (DOT) co.uk> wrote
| Quote: |
Using C++ Builder 6 on XP pro.
How do you make an OCX visible?
I want the form to appear so that I can use the buttons etc on it.
The OCX was created as an ActiveForm.
I'm calling it manually rather than as a VCL drop in object.
I have CoCreateInstance running, got the Interface and can set and get
properties e.g. a custom 'SimLevel' property that shows its the right
object.
I tried setting the set_Visible property to 1 but that didn't work. Is
there another value it should be set to?
So anybody know how to make the thing appear?
The folowing is the code to get the interface:
//**********************************
// CLSID and GUID are all setup
if(SUCCEEDED(CoInitialize(0)))
{
if(SUCCEEDED(hr)) // Got the CLSID ok
{
// Create the instance
hr = CoCreateInstance(CLSID_COMtest, NULL,
CLSCTX_INPROC_SERVER,
IID_IUnknown, (void**)&pInstance);
if(SUCCEEDED(hr))
{
// get the interface
hr = pInstance->QueryInterface(IID_ICOMtest, (void**)
&pCOMtestInterface) ;
(hr == S_OK)
{
// test message with custom property
MessageDlg("SimLevel = " +
AnsiString(pCOMtestInterface->get_SimLevel()),
mtInformation, TMsgDlgButtons() << mbOK, 0);
pCOMtestInterface->set_Visible(1); // Does nothing... }
}
}
//**************************
Thanks in advance
Ian.
|
|
|
| Back to top |
|
 |
ian Guest
|
Posted: Fri Sep 24, 2004 8:30 am Post subject: Re: How to make an OCX visible |
|
|
Thanks.
I tried that but no effect either.
Cheers
Ian.
"Mark Guerrieri" <markg11 (AT) comcast (DOT) net> wrote:
| Quote: | Try passing VARIANT_TRUE (i.e. -1) to set_Visible.
Mark
"ian" <ian_nospam_ (AT) matrix_nospam_multimedia (DOT) co.uk> wrote in message
news:4152a422$1 (AT) newsgroups (DOT) borland.com...
Using C++ Builder 6 on XP pro.
How do you make an OCX visible?
I want the form to appear so that I can use the buttons etc on it.
The OCX was created as an ActiveForm.
I'm calling it manually rather than as a VCL drop in object.
I have CoCreateInstance running, got the Interface and can set and get
properties e.g. a custom 'SimLevel' property that shows its the right
object.
I tried setting the set_Visible property to 1 but that didn't work. Is
there another value it should be set to?
So anybody know how to make the thing appear?
The folowing is the code to get the interface:
//**********************************
// CLSID and GUID are all setup
if(SUCCEEDED(CoInitialize(0)))
{
if(SUCCEEDED(hr)) // Got the CLSID ok
{
// Create the instance
hr = CoCreateInstance(CLSID_COMtest, NULL,
CLSCTX_INPROC_SERVER,
IID_IUnknown, (void**)&pInstance);
if(SUCCEEDED(hr))
{
// get the interface
hr = pInstance->QueryInterface(IID_ICOMtest, (void**)
&pCOMtestInterface) ;
(hr == S_OK)
{
// test message with custom property
MessageDlg("SimLevel = " +
AnsiString(pCOMtestInterface->get_SimLevel()),
mtInformation, TMsgDlgButtons() << mbOK, 0);
pCOMtestInterface->set_Visible(1); // Does nothing... }
}
}
//**************************
Thanks in advance
Ian.
|
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|