LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

I can't take the control of an ActiveX aplication.

Hi.
I developt an ActiveX aplication using Microsoft Calendar Control 8.0 and I used next funtion to create a new calendar on my panel.

CAObjHandle Calendar=0;
int Panel_handle;

MSACAL_NewICalendar(Panel_handle, "Mesage",50, 20, &Calendar, &UIL_Error);

This function works... in my panel is visible an calendar aplication.
Now I want to take control of that aplication but I can't find an activate function to use.

To be more clear I put a function that I used and didn't worked.

MSACAL_ICalendarGet_Value (Calendar, NULL, &Pvar_Value);

I now why this don't work... I must specify an Object Handle... but how can I do that if I don't have an Activate function?

Please help me.
0 Kudos
Message 1 of 6
(3,517 Views)
The Calendar variable holds the CVI Control ID. You need to get the ActiveX object handle for the control using this control ID. There is a function called GetObjHandleFromActiveXCtrl for this. You would do:

GetObjHandleFromActiveXCtrl(Panel_handle, calendar, &h_CalObj);

Then call your ActiveX functions with the h_CalObj as the object handle.

Best Regards,

Chris Matthews
National Instruments
Message 2 of 6
(3,517 Views)
Hi,

The function MSACAL_NewICalendar will create a UI control to hold the calendar. However as you say, you must get the Object Handle to be able to call the ActiveX functions.
The function that you need to do this is called GetObjHandleFromActiveXCtrl(,,,) it takes the ID of the UI control and returns a handle to the ActiveX control.

I your specific case it would look something like this:

MSACAL_NewICalendar(Panel_handle, "Mesage",50, 20, &Calendar, &UIL_Error);
GetObjHandleFromActiveXCtrl (panel_handle, Calendar,&calendarHandle);
MSACAL_ICalendarGet_Value (Calendar, NULL, &Pvar_Value);


you can find this function in the user interface library.

Let me know if you have any further questions.

Regards,

Juan Carlos
N.I.
Message 3 of 6
(3,517 Views)
Hi.
Thanks a lot for solution... it works.
Now I have another problem...:)
After I create a calendar on my panel I must hide it.
When I display it again the ActiveX object (the calendar) chages the position and the panel don't look like before.

Thaks.
0 Kudos
Message 4 of 6
(3,517 Views)
What type of changes do you see? I did some basic test here; I was able to move the panel, hide it, show it again and the calendar is in the same place.

Could you give us more specifics on this?

Juan Carlos
0 Kudos
Message 5 of 6
(3,517 Views)
"Hi.
I resoved the problem.
On my panel I have instaled an activeX object, the calendar object. When I was using the functions InstallPopup and DiscardPanel to activate and dezactivate another panel, then the position of the calendar was changing. But now, I use the pair of functions InstallPopup and RemovePopup and the problem doesn't apair.

Thanks."
0 Kudos
Message 6 of 6
(3,517 Views)