~~Title: Image Viewer messages~~ When the [[.dvp_createviewer|DVP_CreateViewer]] function is called, your plugin should simply create its viewer window using the supplied parameters and return the window handle. The implementation of this function is therefore fairly straightforward. However, the viewer window itself needs to respond to messages from Directory Opus in order to load and display images and respond to input from the user correctly. The currently defined messages are as follows: ==== DVPLUGINMSG_LOAD ==== ^wParam|undefined| ^lParam|LPTSTR lpszName| ^Return|**TRUE** if load was successful, **FALSE** for failure| Instructs the viewer to load and display the disk file specified by the **lParam** parameter. Note the **DVPLUGINMSG_SETABORTEVENT** message may be sent to the viewer before this message to specify an event object used to abort a load operation. ==== DVPLUGINMSG_LOADSTREAM ==== ^wParam|LPTSTR lpszName| ^lParam|LPSTREAM lpStream| ^Return|**TRUE** if load was successful, **FALSE** for failure| Instructs the viewer to load and display the file from the supplied **IStream** data stream object. This message is only sent if your plugin specifies the **DVPFIF_CanHandleStreams** flag. ==== DVPLUGINMSG_GETIMAGEINFO ==== ^wParam|undefined| ^lParam|LPVIEWERPLUGINFILEINFO lpVPFileInfo| ^Return|None| Asks the viewer to return information about the currently displayed file in the supplied **VIEWERPLUGINFILEINFO** structure. See the description of the [[.dvp_identifyfile|DVP_IdentifyFile]] function for information about this structure. ==== DVPLUGINMSG_GETCAPABILITIES ==== ^wParam|undefined| ^lParam|undefined| ^Return|**DWORD** value indicating capabilities of viewer window| Asks the viewer to return flags indicating its capabilities. The currently defined flags are: * **VPCAPABILITY_RESIZE_FIT** \\ Viewer supports resizing the image to "fit" the size of the window * **VPCAPABILITY_RESIZE_ANY** \\ Viewer supports resizing the image to any size. * **VPCAPABILITY_ROTATE_RIGHTANGLE** \\ Viewer can rotate the current image in increments of 90 degrees. * **VPCAPABILITY_ROTATE_ANY** \\ Viewer can rotate the current image by any angle. * **VPCAPABILITY_SELECTALL** \\ Viewer supports the 'Select All' function to select all data for copying to the clipboard. * **VPCAPABILITY_COPYALL** \\ Viewer supports the 'Copy All' function to copy all data to the clipboard immediately. * **VPCAPABILITY_COPYSELECTION** \\ Viewer supports the clipboard and allows the user to select a portion of the image to copy to the clipboard. * **VPCAPABILITY_PRINT** \\ Viewer supports printing the image. * **VPCAPABILITY_WANTFOCUS** \\ Viewer wants to be given the input focus. If set, Directory Opus will give your viewer the input focus when the user presses the **Tab** key in a Lister to move the input focus from the file display to the Viewer Pane. * **VPCAPABILITY_SHOWPROPERTIES** \\ Viewer can show its own Properties dialog. If set, Directory Opus will send your viewer a **DVPLUGINMSG_PROPERTIES** message when the user selects the //Properties// function. * **VPCAPABILITY_WANTMOUSEWHEEL** \\ If set, Directory Opus will forward **WM_MOUSEWHEEL** messages to your window if the user rotates the mouse wheel over the viewer. * **VPCAPABILITY_ADDCONTEXTMENU** \\ Viewer wants to be able to add its own items to the context menu displayed when the user right-clicks the viewer window. If set, Directory Opus will send your viewer a **DVPLUGINMSG_ADDCONTEXTMENU** message when appropriate. * **VPCAPABILITY_HASDIALOGS** \\ If your viewer opens its own dialog windows for any reason, you should set this flag to cause Directory Opus to send your window **DVPLUGINMSG_ISDLGMESSAGE** messages. This allows you to call the **IsDialogMessage()** function to enable proper message processing for your dialogs. * **VPCAPABILITY_HASACCELERATORS** \\ If your viewer has its own keyboard accelerators, you should set this flag to cause Directory Opus to send your window **DVPLUGINMSG_TRANSLATEACCEL** messages, allowing you to process keyboard input. * **VPCAPABILITY_CANSETWALLPAPER** \\ If your viewer is able to process the 'Set as desktop wallpaper' command you should set this flag. * **VPCAPABILITY_CANTRACKFOCUS** \\ Set this flag if you can reliably track your input focus state. * **VPCAPABILITY_SUPPLYBITMAP** \\ Set this flag if you are able to provide a representation of your display as a bitmap. Opus uses this when the user selects the 'Save As' command in the viewer. * **VPCAPABILITY_GAMMA** \\ Set this flag if you support gamma correction. * **VPCAPABILITY_FILEINFO** \\ Set this flag if you support the display of file information overlaid on the image. * **VPCAPABILITY_RESIZE_TILE** \\ Set this flag if you can display a tiled preview. * **VPCAPABILITY_HIDEALPHA** \\ Set this flag if you are able to hide the alpha channel of any image you display (this means that for an image with alpha channel, the alpha channel can be toggled off to only show the raw image data) * **VPCAPABILITY_NOFULLSCREEN** \\ Set this flag if your viewer does not support full-screen mode. ==== DVPLUGINMSG_RESIZE ==== ^wParam|left (low word), top (high word)| ^lParam|width (low word), height (high word)| ^Return|None| This message is sent to tell the viewer window to reposition and resize itself. The new window coordinates are specified in wParam and lParam. ==== DVPLUGINMSG_SETROTATION ==== ^wParam|rotation factor (degrees)| ^lParam|undefined| ^Return|None| This message is sent to the viewer to set the **initial** rotation factor to be used for images. It will be sent before any image is loaded - when an image is loaded, your viewer should automatically rotate it by the amount specified by this message. If your plugin does not support rotation you can ignore this message. ==== DVPLUGINMSG_ROTATE ==== ^wParam|rotation factor (degrees)| ^lParam|undefined| ^Return|None| This message is sent to tell the viewer window to rotate the image currently displayed. The rotation factor is given in wParam and may be negative (anti-clockwise) or positive (clockwise). If your plugin does not support rotation you can ignore this message. ==== DVPLUGINMSG_SETZOOM ==== ^wParam|zoom factor (percentage)| ^lParam|undefined| ^Return|None| This message sets the **initial** zoom (scaling) factor to be used for images. It will be sent before any image is loaded - when an image is loaded, your viewer should automatically scale it by the amount specified in wParam. This amount is given as a percentage - less than 100 represents a decrease in size, and more than 100 represents an increase in size. A value of 0 (or 100) means the image should not be scaled. The special value **ZOOM_FITPAGE** represents 'fit to page' - the image should be scaled to best fit within the current viewer window. The special value **ZOOM_TILED** represents 'tiled mode' - if you support this mode you should tile the image across your plugin's window. If your plugin does not support scaling or tiling you can ignore this message. ==== DVPLUGINMSG_ZOOM ==== ^wParam|zoom factor (percentage)| ^lParam|undefined| ^Return|None| This message is sent to tell the viewer window to scale the image currently displayed. The zoom factor is given in wParam and is expressed as a percentage of the **original** size - not of the current size. A value of 0 (or 100) means the image should be restored to its original size. The special value **ZOOM_FITPAGE** represents 'fit to page' - the image should be scaled to best fit within the current viewer window. The special value **ZOOM_TILED** represents 'tiled mode' - if you support this mode you should tile the image across your plugin's window. If your plugin does not support scaling you can ignore this message. ==== DVPLUGINMSG_GETZOOMFACTOR ==== ^wParam|undefined| ^lParam|undefined| ^Return|**int** indicating the current zoom (scaling factor)| This message is sent to retrieve the current scaling factor from the image viewer. For example, Directory Opus may ask for a zoom factor of 400% but your viewer is unable to allocate enough memory to generate an image that large, and instead falls back to a smaller zoom factor. This message is how Directory Opus discovers the scaling factor that was actually used. ==== DVPLUGINMSG_SELECTALL ==== ^wParam|undefined| ^lParam|undefined| ^Return|None| This message is sent to tell the viewer window to select the entire contents for copying to the clipboard. ==== DVPLUGINMSG_TESTSELECTION ==== ^wParam|undefined| ^lParam|undefined| ^Return|**BOOL** indicating the presence of a selection for clipboard copying| This message is sent to test whether or not the user has selected a portion of the image for copying to the clipboard. If the return value for this message is **TRUE** then Directory Opus will enable the //Copy// function to copy the current selection to the clipboard. If the return value is **FALSE** then Directory Opus instead enables the //Copy All// function to copy the entire contents. If you have disallowed clipboard activity for your viewer via the **DVPLUGINMSG_GETCAPABILITIES** message you can ignore this message. ==== DVPLUGINMSG_COPYSELECTION ==== ^wParam|undefined| ^lParam|undefined| ^Return|None| This message is sent to tell the viewer window to copy the current selection to the clipboard. ==== DVPLUGINMSG_PRINT ==== ^wParam|undefined| ^lParam|undefined| ^Return|None| This message is sent to tell the viewer window to print the currently viewed image. ==== DVPLUGINMSG_PROPERTIES ==== ^wParam|HWND hWndParent| ^lParam|undefined| ^Return|**BOOL** indicating success or failure| If your viewer returned the **VPCAPABILITY_SHOWPROPERTIES** flag for the **DVPLUGINMSG_GETCAPABILITIES** message, Directory Opus will send this message when the user selects the //Properties// function for your image viewer. If you are able to successfully display a properties dialog, return **TRUE** to this message. If you return **FALSE**, Directory Opus will display a standard Properties dialog if possible. Your dialog can either be modal or modeless - if it is modeless, you should use the **VPCAPABILITY_HASDIALOGS** capabilities flag to ensure proper processing of your dialog messages. ==== DVPLUGINMSG_REDRAW ==== ^wParam|BOOL fBackgroundChange| ^lParam|COLORREF crBkCol| ^Return|None| This message is sent to tell the viewer window to redraw its current display. If wParam is set to **TRUE**, lParam contains a **COLORREF** value indicating the new background color to use (presumably because the user changed the color through Preferences). If wParam is **FALSE** then lParam is undefined. ==== DVPLUGINMSG_GETPICSIZE ==== ^wParam|LPINT lpiNumBits| ^lParam|LPSIZE lpszSize| ^Return|**TRUE** if there is currently a valid image, **FALSE** if otherwise| This message is used to obtain the size of the currently displayed image. This must be the actual displayed image size, taking any scaling and rotation into account. wParam points to an **int** value where you should store the bit depth of the current image, if applicable. If not, set to 0. lParam points to a **SIZE** structure where you should store the current image size. ==== DVPLUGINMSG_GETAUTOBGCOL ==== ^wParam|undefined| ^lParam|undefined| ^Return|COLORREF crBkCol| If the user has enabled the //Automatic background color// option for the image viewer, Directory Opus will send your viewer this message to retrieve the color that should be used as the background color. You should return a COLORREF value as appropriate. If you are not able to generate an automatic background color you can ignore this message. ==== DVPLUGINMSG_MOUSEWHEEL ==== ^wParam|key indicator and wheel rotation| ^lParam|horizontal and vertical position| ^Return|None| If your viewer specified the **VPCAPABILITY_WANTMOUSEWHEEL** capabilities flag, Directory Opus will forward mouse wheel messages to you when the user rotates the wheel over your viewer window. This message has the same parameters as the **WM_MOUSEWHEEL** system message. In order to support correct mouse wheel functionality, any real **WM_MOUSEWHEEL** messages that you receive must not be processed by your viewer, but instead need to be forwarded to your viewer's parent window using SendMessage(). ==== DVPLUGINMSG_ADDCONTEXTMENU ==== ^wParam|LPDWORD lpdwNumItems| ^lParam|undefined| ^Return|LPDVPCONTEXTMENUITEM lpMenuArray| This message allows the viewer window to add its own items to the viewer context menu. It is sent to your window if you specified the **VPCAPABILITY_ADDCONTEXTMENU** capabilities flag. wParam points to a DWORD value where you should store the number of items that you wish to add, and you should return the address of a **DVPCONTEXTMENUITEM** array that specifies the items to be added. The **DVPCONTEXTMENUITEM** structure contains the following fields: * **LPTSTR lpszLabel** \\ Pointer to menu label string. * **DWORD dwFlags** \\ Menu item flags. Currently defined flags are: * **DVPCMF_CHECKED** \\ Menu item appears with a check mark next to it. * **DVPCMF_RADIOCHECK** \\ A radio button image is used instead of a check mark. * **DVPCMF_DISABLED** \\ The menu item will be disabled. * **DVPCMF_SEPARATOR** \\ The menu item will appear as a separator. * **DVPCMF_BEGINSUBMENU** \\ The menu item will have a sub-menu consisting of the next items in the array (until one has the **DVPCMF_ENDSUBMENU** flag set) * **DVPCMF_ENDSUBMENU** \\ This item is the last in the sub-menu, any further items appear back on the parent menu. * **UINT uID** \\ Menu item ID that will be associated with this menu item. This ID is used in the **WM_COMMAND** message that your viewer receives when the user selects this menu item. **Note**: The DVPCONTEXTMENUITEM array that you return for this message and strings that the array elements point to **must** remain valid after you have replied to this message. It is suggested that you use static data or allocated memory that is not freed until your viewer window is destroyed. ==== DVPLUGINMSG_SETABORTEVENT ==== ^wParam|undefined| ^lParam|HANDLE hAbortEvent| ^Return|None| This message is may be sent to your viewer to supply an event handle that will be used to abort a **DVPLUGINMSG_LOAD** message in progress. If you receive this message you should store the event handle and check it periodically for signaled status during the load operation. See the description of the **hAbortEvent** parameter for the [[.dvp_identifyfile|DVP_IdentifyFile]] function for more information. ==== DVPLUGINMSG_GETORIGINALPICSIZE ==== ^wParam|LPINT lpiNumBits| ^lParam|LPSIZE lpszSize| ^Return|**TRUE** if there is currently a valid image, **FALSE** if otherwise| This message is used to obtain the original size of the currently displayed image. This must be the original image size, ignoring any scaling and rotation. wParam points to an **int** value where you should store the bit depth of the current image, if applicable. If not, set to 0. lParam points to a **SIZE** structure where you should store the image size. ==== DVPLUGINMSG_CLEAR ==== ^wParam|undefined| ^lParam|undefined| ^Return|None| This message is sent to tell the viewer window to clear its currently displayed image. All internal state information should be reset as if the viewer had just been created. ==== DVPLUGINMSG_NOTIFY_LOADPROGRESS ==== ^wParam|int value percentage complete| ^lParam|undefined| ^Return|None| This message is **not** sent to the viewer window. Instead, the viewer window can **post** this message to its parent window to notify the progress of a lengthy load operation. Implementation of this message is optional. If your plugin takes a long time to load an image you may like to occasionally post this to the parent to allow the user to see how the load operation is progressing. ==== DVPLUGINMSG_ISDLGMESSAGE ==== ^wParam|undefined| ^lParam|LPMSG lpMsg| ^Return|**TRUE** if the message was for a plugin dialog, **FALSE** if not| This message is sent to the viewer window if the **VPCAPABILITY_HASDIALOGS** capabilities flag was specified, and lets the viewer plugin properly handle messages for any modeless dialogs that it creates. lParam points to a MSG structure which you should pass to the **IsDialogMessage()** function, specifying the window handle of your dialog. You should use the return value of **IsDialogMessage()** as the return code for this message. ==== DVPLUGINMSG_TRANSLATEACCEL ==== ^wParam|undefined| ^lParam|LPMSG lpMsg| ^Return|**TRUE** if the message was translated, **FALSE** if not| This message is sent to the viewer window to allow it to process messages for its own accelerators. lParam points to a MSG structure which you should pass to the **TranslateAccelerator()** function specifying your own accelerator table. You should use the return value of **TranslateAccelerator()** as the return code for this message. ==== DVPLUGINMSG_REINITIALIZE ==== ^wParam|undefined| ^lParam|undefined| ^Return|None| This message is both sent from Directory Opus to the viewer, and posted from the viewer to Directory Opus. It is used to indicate that the viewer should reinitialize itself because of a configuration change by the user. If your viewer plugin supports the [[.dvp_configure|DVP_Configure]] function to display a configuration dialog, you should post Directory Opus a **DVPLUGINMSG_REINITIALIZE** message. Directory Opus will then send this message to all current instances of your viewer so that they can reinitialize themselves if necessary. ==== DVPLUGINMSG_SHOWHIDESCROLLBARS ==== ^wParam|BOOL fShowScrollbars| ^lParam|undefined| ^Return|None| This message is sent to tell the viewer window to either show or hide scroll bars if possible. If the user has configured the image viewer to hide scroll bars, you will receive this message with wParam set to **FALSE**. If you do not support hiding scroll bars you can ignore this message. ==== DVPLUGINMSG_INLOADLOOP ==== ^wParam|BOOL fLoadState| ^lParam|undefined| ^Return|None| This message is sent before and after Opus begins loading a new image in your viewer window. **fLoadState** will be **TRUE** when loading begins and **FALSE** when it is complete. ==== DVPLUGINMSG_SETIMAGEFRAME ==== ^wParam|BOOL fFrameState| ^lParam|undefined| ^Return|None| This message is sent to inform your viewer if it should display a frame around the image. **fFrameState** will be **TRUE** if a frame should be displayed or **FALSE** if it should not. ==== DVPLUGINMSG_SETDESKWALLPAPER ==== ^wParam|undefined| ^lParam|LPTSTR pszType| ^Return|None| This message is sent when the user selects the 'Set as desktop wallpaper' command in the viewer (assuming you have reported that you can set the desktop wallpaper.) **pszType** may point to a string containing the wallpaper style to set (**center**, **tile**, **stretch**) or **NULL** for normal positioning. ==== DVPLUGINMSG_GETZOOMLIMITS ==== ^wParam|undefined| ^lParam|undefined| ^Return|DWORD dwLowHighLimits| This message is sent by the viewer to inquire about the minimum and maximum zoom level you support. The return value should store the lower level in the low word and the upper level in the high word. ==== DVPLUGINMSG_THUMBSCHANGED ==== ^wParam|DWORD dwFlags| ^lParam|undefined| ^Return|None| This message is not sent by Opus to you - instead, your plugin can send it to Opus to cause all displayed thumbnails to be automatically regenerated. You should post this message to the window whose handle was provided to the [[.dvp_initex|DVP_InitEx]] function (so you need to export this function if you wish to use this message.) The flag values for **dwFlags** are: |**DVPTCF_REDRAW**|redraw all thumbnails| |**DVPTCF_FLUSHCACHE**|flush the thumbnail cache| ==== DVPLUGINMSG_GETBITMAP ==== ^wParam|undefined| ^lParam|undefined| ^Return|HBITMAP hBmp| This message is sent when the user selects the 'Save As' option in the image viewer. It lets you return a bitmap to Opus (if possible) that can then be saved to disk in one of the supported image formats. You should render your display into a bitmap and return the handle (or return **NULL** if you can't render to a bitmap.) Note that Opus will destroy the returned bitmap handle by calling **DeleteObject()**. ==== DVPLUGINMSG_GAMMACHANGE ==== ^wParam|undefined| ^lParam|undefined| ^Return|None| This message is sent when the user selects a new gamma correction level. If you support gamma adjustment you should send a **DVPN_GETGAMMA** message and update your display. ==== DVPLUGINMSG_APPCOMMAND ==== ^wParam|message wParam| ^lParam|message lParam| ^Return|Return TRUE if handled| This message is sent to forward on any **WM_APPCOMMAND** messages that occur in your viewer plugin. If you handle the message return **TRUE** to prevent further processing. See the Windows SDK for information on the **WM_APPCOMMAND** message. ==== DVPLUGINMSG_PREVENTFRAME ==== ^wParam|undefined| ^lParam|undefined| ^Return|FALSE if frame is allowed, TRUE to prevent framing of the image| This message is sent to allow you to stop Opus from adding space for a frame around your image when automatically sizing the viewer window. Return **TRUE** to prevent Opus from adding space for a frame. ==== DVPLUGINMSG_FULLSCREEN ==== ^wParam|BOOL fFullScreenState| ^lParam|undefined| ^Return|TRUE to prevent change, FALSE to allow it| This message is sent when the user requests to enter or leave full-screen mode. **fFullScreenState** will be **TRUE** when entering full-screen mode, and **FALSE** when returning to normal. You can return **TRUE** to prevent the change or **FALSE** to allow it. ==== DVPLUGINMSG_SHOWFILEINFO ==== ^wParam|BOOL fFileInfoState| ^lParam|undefined| ^Return|None| This message is sent when the user toggles the display of file information on or off. **fFileInfoState** will be **TRUE** if file info is to be shown, or **FALSE** if not. If you support file information you should either display or hide it as appropriate. ==== DVPLUGINMSG_ISFILEINFOSHOWN ==== ^wParam|undefined| ^lParam|undefined| ^Return|TRUE if file information is currently displayed, FALSE if not| This message is sent by Opus to determine if you are currently displaying file information in your viewer plugin. Return **TRUE** if you are displaying file info or **FALSE** if it is currently hidden (or not supported.) ==== DVPLUGINMSG_PREVENTAUTOSIZE ==== ^wParam|undefined| ^lParam|undefined| ^Return|TRUE to prevent auto-sizing of viewer window, FALSE to allow it| This message is sent just before Opus auto-sizes a viewer window. You can return **TRUE** to prevent auto-sizing or **FALSE** to allow it. ==== DVPLUGINMSG_SHOWHEX ==== ^wParam|BOOL fSetState| ^lParam|BOOL fState| ^Return|TRUE if in hex mode, FALSE if in normal mode| This message is sent when your plugin indicates that it can display hex data and the user selects the 'View as Hex' command. If **fSetState** is **TRUE**, **fState** will be either **TRUE** or **FALSE**, indicating the new desired hex state. If **fSetState** is **FALSE**, you should not change state, but should just return your current state. In either case, return **TRUE** if you are displaying hex or **FALSE** if not. ==== DVPLUGINMSG_ISALPHAHIDDEN ==== ^ |wParam =undefined| ^lParam|BOOL* pfIsHidden| ^Return|TRUE if there is an alpha channel, FALSE if there is not| This message is sent to determine both if you have an alpha channel or not, and if it is currently hidden or not. You set the variable pointed to by **pfIsHidden** to **TRUE** if the alpha channel is currently hidden, or **FALSE** if it is displayed. You should return **TRUE** if you have an alpha channel or **FALSE** if there is no alpha channel. ==== DVPLUGINMSG_HIDEALPHA ==== ^wParam|BOOL fHideAlpha| ^lParam|undefined| ^Return|None| This message is sent when the user chooses the 'Hide Alpha Channel' command in the viewer. **fHideAlpha** will be **TRUE** if the alpha channel is to be hidden, or **FALSE** if it is to be displayed. As well as handling and responding to the messages described above, a viewer plugin must also send occasional notification messages to Directory Opus. These messages must be sent as **WM_NOTIFY** messages, and so must be sent via **SendMessage()** rather than posted. Messages should be sent to the viewer window's parent window (identified via **GetParent()**). ==== DVPN_GETBGCOL ==== ^Message structure|NMHDR (standard)| ^Return|COLORREF crBkCol| You should send this message to Directory Opus to retrieve the currently configured background color for the viewer. The return code is a COLORREF value indicating the background color to use. ==== DVPN_SIZECHANGE ==== ^Message structure|DVPNMSIZECHANGE| ^Return|None| You should send this message to Directory Opus to indicate that the image size has changed (for example, because of a zoom or rotation). The **szSize** field of the **DVPNMSIZECHANGE** structure supplies the new image size. ==== DVPN_CLICK ==== ^Message structure|DVPNMCLICK| ^Return|None| You should send this message to Directory Opus to inform Directory Opus that the user has clicked the left mouse button on your viewer window. This is used by the image viewer in full-screen mode to reveal or hide the menu bar. The **pt** field of the **DVPNMCLICK** structure specifies the mouse position in client coordinates, and the **fMenu** flag should be set to **TRUE** if the click is in the 'menu bar' area of the window (that is, if it should be used to reveal the menu bar). ==== DVPN_RESETZOOM ==== ^Message structure|DVPNMRESETZOOM| ^Return|None| Send this message to Directory Opus if the zoom factor has had to be reset or changed from the requested value. The new zoom factor is specified by the **iZoom** field in the **DVPNMRESETZOOM** structure. ==== DVPN_LBUTTONSCROLL ==== ^Message structure|NMHDR (standard)| ^Return|BOOL fLeftButtonScroll| If the return value is **TRUE**, the user has asked that the left mouse button be used to scroll around in the image rather than for clipboard selection. ==== DVPN_CLEARED ==== ^Message structure|NMHDR (standard)| ^Return|None| Send this message to inform Directory Opus that the current picture has been cleared from the display. For example, you should send this in response to a **DVPLUGINMSG_CLEAR** message. ==== DVPN_FOCUSCHANGE ==== ^Message structure|DVPNMFOCUSCHANGE| ^Return|None| Send this message to inform Directory Opus that your viewer window has lost or gained the input focus. The **fGotFocus** flag in the **DVPNMFOCUSCHANGE** structure should be set to **TRUE** if you gained the focus, and **FALSE** if you lost it. ==== DVPN_CAPABILITIES ==== ^Message structure|DVPNMCAPABILITIES| ^Return|None| Send this message to inform Directory Opus that your viewer capabilities flags have changed. Specify the new capabilities flags in the **dwCapabilities** field of the **DVPNMCAPABILITIES** structure. Please see the description of the **DVPLUGINMSG_GETCAPABILITIES** message for more information about plugin capabilities. ==== DVPN_STATUSTEXT ==== ^Message structure|DVPNMSTATUSTEXT| ^Return|None| Send this message to ask Directory Opus to display a string of status text. Note that depending on how your viewer has been invoked, Directory Opus may not display this string. The string that the **lpszStatusText** field points to must remain valid until your viewer has been destroyed, a new image is loaded or you specify a new status text string. Set the **fUnicode** flag to **TRUE** if the string you supply is Unicode, or **FALSE** if it is ANSI. To reset the status bar to the default content, specify 0 for the value of **lpszStatusText**. ==== NM_KEYDOWN ==== ^Message structure|NMKEY| ^Return|None| If the **DVPCVF_ReturnTabs** flag was set in the call to your [[.dvp_createviewer|DVP_CreateViewer]] function, this message must be sent to Directory Opus whenever your viewer window has the input focus and the user presses the **Tab** key. This is necessary to allow correct tabbing between the Lister Viewer Pane and other windows within the Lister. ==== DVPN_LOADNEWFILE ==== ^Message structure|DVPNMLOADNEWFILE| ^Return|None| Send this message to ask Directory Opus to load a new file into the viewer. The **DVPNMLOADNEWFILE** structure allows you to specify either a filename via the **lpszFilename** field or a stream via the **lpStream** field. If you specify a filename you must set the **fUnicode** flag to indicate if the filename you are supplying is a Unicode or ANSI string. ==== DVPN_SETCURSOR ==== ^Message structure|DVPNMSETCURSOR| ^Return|None| Send this message to ask Directory Opus to help process a **WM_SETCURSOR** message for your viewer plugin's window. The **DVPNMSETCURSOR** structure must supply the cursor's position in the **pt** field. You should set the **fMenu** flag to **TRUE** if the cursor is currently in the menu area of your viewer. You should also set the **fCanScroll** flag to **TRUE** if the displayed image can be scrolled. When this message is returned the **iCursor** field will contain the ID of the appropriate cursor that should be shown (**VPCURSOR_NONE**, **VPCURSOR_DRAG** or **VPCURSOR_SELECT**.) ==== DVPN_MCLICK ==== ^Message structure|DVPNMCLICK| ^Return|None| You should send this message to Directory Opus to inform Directory Opus that the user has clicked the middle mouse button on your viewer window. See the description of the **DVPN_CLICK** message for more information. ==== DVPN_GETGAMMA ==== ^Message structure|DVPNMGAMMA| ^Return|None| Send this message to Directory Opus to retrieve the current gamma correction settings for the viewer. The **fEnable** flag will be **TRUE** if gamma correction is currently enabled, and the amount of gamma is given by the **dbGamma** field. ==== DVPN_BUTTONOPTS ==== ^Message structure|DVPNMBUTTONOPTS| ^Return|None| Send this message to Directory Opus to retrieve the current viewer actions configured for each mouse button. On return the **iLeft**, **iRight** and **iMiddle** fields will contain codes representing the action that should be carried out when those buttons are clicked. Valid actions include **BUTTONOPT_NONE**, **BUTTONOPT_SELECT** (select area for clipboard), **BUTTONOPT_ADVANCE** (advance to next image), **BUTTONOPT_SCROLL** (scroll image by dragging), **BUTTONOPT_FULLSCREEN** (toggle full-screen mode on or off) and **BUTTONOPT_CLOSE** (close the viewer.) ==== DVPN_GETCURSORS ==== ^Message structure|DVPNMGETCURSORS| ^Return|None| Send this message to Directory Opus to gain access to the standard cursors used in the image viewer. On return the fields of the structure will contain pointers to the 'hand open', 'hand closed' (used for dragging) and 'crosshair' (used for selecting) cursors. ==== DVPN_MOUSEWHEEL ==== ^Message structure|DVPNMMOUSEWHEEL| ^Return|None| You should use this message to forward **WM_MOUSEWHEEL** messages to Opus for proper handling. Mouse wheel messages are sent by the system to the window with input focus, however Opus will route the message to the window the cursor is currently over. Fill out the **DVPNMMOUSEWHEEL** structure with the values from the **WM_MOUSEWHEEL** message. ==== DVPN_HEXSTATE ==== ^Message structure|DVPNMHEXSTATE| ^Return|None| Send this message to inform Opus that the current 'hex view' state has changed. Set the **fState** flag to **TRUE** if you are currently displaying the file in hex view, or **FALSE** if not.