[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Manipulate and close/release an visual OLE control (PB7)

Posted on 2006-03-24
5
Medium Priority
?
370 Views
Last Modified: 2013-12-26
I've created a COM object which contains a form of "canvas" for drawing. This component exposes some functions which allow me to manipulate it through pb. I've managed to load the object in a window, by inserting it as an OLE custom Control (Insert > Control > OLE > InsertControl...).

The object seems to work ok, and I can access its methods using controlName.object.method(). So far so good. My problem is when I close the application, it crashes. I thought that I need to destroy the control in the window's close() event. That does not seem to work though. Or calling the controlName.clear() function. Is there a way to release the object's memory and avoid crashing the application?
0
Comment
Question by:varkon
  • 2
  • 2
5 Comments
 
LVL 18

Expert Comment

by:diasroshan
ID: 16286766
Hi,

why dont u create/destroy ur object everytime u need to use it and finish using it... instead of the close event...

lole_object = create oleobject
...
blah..
blah...
....
If IsValid(lole_object) then destroy lole_object

if absolutely required to destroy in the close event then try the script,
If IsValid(lole_object) then destroy lole_object

Also,
Another suggestion is to apply the latest patch of the PB version ur using...
u can find it on www.sybase.com
downloads section...

Cheers,
Rosh
0
 

Author Comment

by:varkon
ID: 16297965
Yes, I've already installed all available patches... Furthermore, since this is a visual COM I cannot "see" it on screen by using:

OLEObject myOLE
integer res
myOLE = CREATE OLEObject
res = myOLE.ConnectToNewObject("...")
blah..
blah..
.....

The only way I found so as to "see" the object is the one described in the original question...
0
 
LVL 6

Accepted Solution

by:
tr1l0b1t earned 540 total points
ID: 16299366
Hi varkon,
try this in the Close event of your window :

ULong lul_pointer
myOLE.GetNativePointer(lul_pointer)
myOLE.ReleaseNativePointer(lul_pointer)

Please, let me know if it works
Regards
0
 

Author Comment

by:varkon
ID: 16308436
tr1l0b1t it works!! Thank you very much. However, I've read the documentation about those two methods and I still do not understand how they are related with my problem. Could you explain this to me please?
0
 
LVL 18

Expert Comment

by:diasroshan
ID: 16309011
Hi,

nice post tr1l0b1t  @GetNativePointer,ReleaseNativePointer

guess even i learnt something new...

Cheers,
Rosh
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Here is a helpful source code for C++ Builder programmers that allows you to manage and manipulate HTML content from C++ code, while also handling HTML events like onclick, onmouseover, ... Some objects defined and used in this source include: …
How to install Selenium IDE and loops for quick automated testing. Get Selenium IDE from http://seleniumhq.org Go to that link and select download selenium in the right hand column That will then direct you to their download page. From that p…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
The viewer will learn how to use NetBeans IDE 8.0 for Windows to connect to a MySQL database. Open Services Panel: Create a new connection using New Connection Wizard: Create a test database called eetutorial: Create a new test tabel called ee…
Suggested Courses

868 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question