BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How to make an OCX visible

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (ActiveX)
View previous topic :: View next topic  
Author Message
ian
Guest





PostPosted: Thu Sep 23, 2004 10:23 am    Post subject: How to make an OCX visible Reply with 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
Mark Guerrieri
Guest





PostPosted: Fri Sep 24, 2004 1:42 am    Post subject: Re: How to make an OCX visible Reply with quote



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





PostPosted: Fri Sep 24, 2004 8:30 am    Post subject: Re: How to make an OCX visible Reply with quote




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
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (ActiveX) All times are GMT
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.