Netscape DevEdge

Skip to: [content] [navigation]




Forces a paint message for a windowless plug-in.


#include <npapi.h>
void NPN_ForceRedraw(NPP instance);


The function has the following parameters:

Plug-in instance for which the function forces redrawing.


A windowed plug-in determines when it draws, while a windowless plug-in draws only in response to a paint message from the browser. NPN_ForceRedraw forces a paint message for a windowless plug-in.

Once a value has been invalidated with NPN_InvalidateRect or NPN_InvalidateRegion, a plug-in can call NPN_ForceRedraw to force a paint message. This causes a synchronous update event or paint message for the plug-in.

MS Windows

The plug-in receives a WM_PAINT message. The lParam of the WM_PAINT message holds a pointer to an NPRect that is the bounding box of the update area. Since the plug-in and the browser share the same HDC, before drawing, the plug-in is responsible for saving the current HDC settings, setting up its own environment, drawing, and restoring the HDC to the previous settings. The HDC settings must be restored whenever control returns back to the browser, either before returning from NPP_HandleEvent or before calling a drawing-related Netscape method. §

Mac OS

The plug-in receives an updateEvent. The clipRegion of the drawable's CGrafPtr is set to the update region. As is the case for windowed plug-ins on Mac OS, the plug-in must first save the current settings of the port, setting up the drawing environment as appropriate, drawing, and restoring the port to the previous setting. This should happen before the plug-in returns from NP_HandleEvent or before the plug-in calls a drawing-related Navigator method. §

See Also

NPN_InvalidateRect, NPN_InvalidateRegion, NPP

Netscape Communications