Globals: Host Display Info

LightWave

Global Memory Image List Globals Table of Contents

Host Display Info

Availability  LightWave 6.0
Component  Layout, Modeler
Header  lwdisplay.h

The host display global returns platform-specific information about LightWave's interface. This is primarily useful when you want to create a platform-dependent interface for your plug-in.

Global Call

   HostDisplayInfo *hdi;
   hdi = global( LWHOSTDISPLAYINFO_GLOBAL, GFUSE_TRANSIENT );

The global function returns a pointer to a HostDisplayInfo, or NULL if called in a non-interactive (e.g. Screamernet) context.

   typedef struct st_HostDisplayInfo {
    #ifdef _WIN32
      HANDLE    instance;
      HWND      window;
    #endif
    #ifdef _XGL
      Display  *xsys;
      Window    window;
    #endif
    #ifdef _MACOS
      WindowPtr window;
    #endif
   } HostDisplayInfo;

The operating system #defines (_WIN32, _XGL, _MACOS) are discussed in the section on plug-in compiling.

window
LightWave's main window. This is often used as the parent window of the plug-in's main window.

_WIN32 instance
Under Microsoft Windows, this is the instance handle for the LightWave process. You won't need this very often. If you want a handle to a resource (dialog templates, icons, bitmaps) that's stored in your plug-in's .p file, you need to use your plug-in's instance handle, not LightWave's. See your Win32 documentation to find out how to get your instance handle using the DllMain function.

_XGL xsys
Under Unix, this is LightWave's window session handle.

Example

This code fragment displays everyone's favorite first message, but using the Win32 MessageBox function with LightWave's main window handle as the parent window.

   #include <lwserver.h>
   #include <lwdisplay.h>   /* includes windows.h under Windows */

   HostDisplayInfo *hdi;

   hdi = global( LWHOSTDISPLAYINFO_GLOBAL, GFUSE_TRANSIENT );

   if ( hdi ) {
      MessageBox( hdi->window, "Hello, world!", "My Message", MB_OK );
   }