Desktop Cpp Class

Desktop C++ Class

The reference page for the Desktop class is missing three of the new member functions added in XSI v5.0.

void* GetApplicationWindowHandle()

Returns the platform-specific top XSI window handle. On Windows, you must cast the return value to an HWND. On Linux, you get an X window.

void SuspendWin32ControlsHook()

Disables the Win32 hook used by XSI on Windows controls.

On Windows, this Win32 hook can interfere with the appearance and behavior of controls in the custom display host and other custom user interfaces. The hook does not interfere with property pages and views.

Disable the hook just before you create a custom UI. After you finish creating the custom UI, call Desktop::RestoreWin32ControlsHook to restore the hook.

You do not need to disable the hook for property pages and views, or on Linux.

Do not disable the controls hook at any other time.

Warning: XSI will not function properly if you do not restore the controls hook.

Example: Demonstrates suspending and restoring the Windows controls hook

//  This example uses the Win32 API and therefore does not run on Linux.

void ShowFontDlg()
   Application app ;

   LOGFONT lf;
   DWORD rgbCurrent = 0 ;

   ZeroMemory(&cf, sizeof(cf));
   cf.lStructSize = sizeof (cf);

   // Use the XSI main window so that the Font
   // dialog is properly parented
   cf.hwndOwner = (HWND)app.GetDesktop().GetApplicationWindowHandle();

   cf.lpLogFont = &lf;
   cf.rgbColors = rgbCurrent;

   // Disable the Win32 hook so the
   // Font dialog is displayed properly
   app.GetDesktop().SuspendWin32ControlsHook() ;
   ::ChooseFont(&cf) ; // This function is part of the Win32 API
   app.GetDesktop().RestoreWin32ControlsHook() ;

void RestoreWin32ControlsHook()

Restores the Win32 controls hook disabled by a previous call to Desktop::SuspendWin32ControlsHook.

This page was last modified 04:37, 2 Oct 2010.
This page has been accessed 105738 times.

© Copyright 2009 Autodesk Inc. All Rights Reserved. Privacy Policy | Legal Notices and Trademarks | Report Piracy