Hide Table of Contents
PreviewDoc Method (ISldWorks)

Displays a preview of a document to the specified window.

.NET Syntax

Visual Basic (Declaration) 
Function PreviewDoc( _
   ByRef HWnd As System.Integer, _
   ByVal FullName As System.String _
) As System.Boolean
Visual Basic (Usage) 
Dim instance As ISldWorks
Dim HWnd As System.Integer
Dim FullName As System.String
Dim value As System.Boolean
 
value = instance.PreviewDoc(HWnd, FullName)
C# 
System.bool PreviewDoc( 
   ref System.int HWnd,
   System.string FullName
)
C++/CLI 
System.bool PreviewDoc( 
&   System.int% HWnd,
&   System.String^ FullName
) 

Parameters

HWnd
Window handle where you want the preview bitmap to display; this pointer is not valid across processes; therefore, this method only works if your application is implemented as a DLL
FullName
Full path name of document to preview

Return Value

True if successful, false if not

Remarks

If your application must be x64 compatible, then use ISldWorks::PreviewDocx64.

The bitmap is stored with the fixed size shown with the interactive SOLIDWORKS preview option. If your window is a different size, then the image is scaled appropriately. If scaling is needed, then shaded images may not be as crisp as the original.

This method works well in the WM_PAINT Windows Message handler. If used in WM_ONINITDIALOG the dialog only displays the preview for a brief moment. The reason is that the dialog should be initialized completely before calling SldWorks::PreviewDoc.

C++ programmers can also access this bitmap image from outside SOLIDWORKS. The bitmap was written with CArchive::Write( ) and is found in the Preview node in SOLIDWORKS part, assembly and drawing files. The format of the Preview node is as follows: DWORD (data size) followed by continues chunk of memory of that size (data). The data being read can be cast to LPBITMAPINFO, which has all of the information required to display the bitmap. You may want to use StretchDIBits() when displaying your image of the bitmap.

 

See Also



Provide feedback on this topic

SOLIDWORKS welcomes your feedback concerning the presentation, accuracy, and thoroughness of the documentation. Use the form below to send your comments and suggestions about this topic directly to our documentation team. The documentation team cannot answer technical support questions. Click here for information about technical support.

* Required

 
*Email:  
Subject:   Feedback on Help Topics
Page:   PreviewDoc Method (ISldWorks)
*Comment:  
*   I acknowledge I have read and I hereby accept the privacy policy under which my Personal Data will be used by Dassault Systèmes

Print Topic

Select the scope of content to print:

x

We have detected you are using a browser version older than Internet Explorer 7. For optimized display, we suggest upgrading your browser to Internet Explorer 7 or newer.

 Never show this message again
x

Web Help Content Version: API Help (English only) 2018 SP05

To disable Web help from within SOLIDWORKS and use local help instead, click Help > Use SOLIDWORKS Web Help.

To report problems encountered with the Web help interface and search, contact your local support representative. To provide feedback on individual help topics, use the “Feedback on this topic” link on the individual topic page.