×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Gettting preview bitmap

Gettting preview bitmap

Gettting preview bitmap

(OP)
Is there any way to get a preview bitmap from an outside executable rather than a macro or an addin?

RE: Gettting preview bitmap

Can you be more specific? Sorry, I'm not understanding.

Chris
Sr. Mechanical Designer, CAD
SolidWorks 05 SP3.1 / PDMWorks 05
ctopher's home site (updated 06-21-05)
FAQ559-1100
FAQ559-716

RE: Gettting preview bitmap

(OP)
solidworks provides this method
SldWorks::GetPreviewBitmap

however there is a note that it will only works if used in a macro or an add-in and not if I am using an external application.

However I need to get a preview from an outside program

RE: Gettting preview bitmap

You could always do a screen dump (hit the PrntScrn button) and edit it in a grpahics program.

SW can also 'saveas' as a jpeg

RE: Gettting preview bitmap

(OP)
I don;t know if you are joking or not, but what I would like to do is have an application display the preview of the file when you highlight it in a file list.

RE: Gettting preview bitmap

SW uses MS and MS use Shade files that are built into the File itself to get the preview in SW open menu. I assume that is what you are trying for. If you know anything about that then you might be able to use that to get your preview.

Your Initial post left all of us guessing what you meant. The more information you can provide in your initial post will make the thread much more efficient as most of us don't do API.

Regards,

Scott Baugh, CSWP
www.scottjbaugh.com
FAQ731-376

RE: Gettting preview bitmap

umm, no I'm not joking.

" I would like to do is have an application display the preview of the file when you highlight it in a file list"

what application, and what list?

RE: Gettting preview bitmap

(OP)
what I need is somebody with API knowledge. Therefore I have not explained this issue in great detail.
I have a previously written app in VB which does many things, one of which is it's ability to display a preview of an AutoCAD drawing that a user has selected in the custom filediaog box( on the custom app). I am trying to extend this to solidworks drawings.
users who use this application use it for the most part to search for drawings. A lot of times thought the desription of the drawing provided through my custon app does not give the enduser enough information to pich the right drawing. Therefore a preview would be of immense help.
Simply highlight the filename of the desired drawing in the custom app and see the preview of it.

RE: Gettting preview bitmap

we use a custom made vb app, which shows a preview, which is a simple bmp of the file, created using the 'saveas jpeg' option.

we highlight the 'file' and we see the preview

RE: Gettting preview bitmap

(OP)
can you show me some code plz. I have found only one example but it uses an unsupported method

RE: Gettting preview bitmap

The easy way to do this is to load SolidWorks in the background and use the GetPreviewBitmap method.  The harder way to do this is to read the bitmap from the SW file itself.  The SolidWorks files use the OLE structured storage, and the preview bitmap is in the stream called "Preview" if I remember correctly.  The format is a DWORD that is the preview bitmap size and then that many more bytes of bitmap data.  You should then be able to take that data and display it like a normal bitmap.  I don't have any code to do this in VB, but there is an example in C++ on the SolidWorks website.  Go to the API Downloads page and look for the "Retrieve SolidWorks preview bitmap and display lists" download.  It has a whole lot of code that you don't need, but the main files are in the sldworks directory and are previewdib.h, previewdib.cpp, and restoredib.cpp.

Jonathan Anderson

RE: Gettting preview bitmap

1) Can you open the existing file dialog in "view thumbnails" mode?  Do a google search and you will see discussions on forcing file dialogs to open in this way in VB.

2) If you need to have a listbox with a seperate bitmap preview (instead of the view thumbnails approach) do as Jonathan Anderson suggested and open SolidWorks silently so that you can use the existing tool.  This is definitely the easiest solution.

3) If you haven't already done so, download the E-Drawings SDK http://www.solidworks.com/downloads/api/downloads/00000/0300s/0346/edrw_sdk.zip and investigate using E-Drawings functionality in your form.  The eDrawings API is implemented as an ActiveX Control, so maybe you can embed an E-Drawing interface into your form?  I haven't tried this, but it has potential so you may want to investigate.

By the way, I thought the wording in the original question was fine.  

RE: Gettting preview bitmap

(OP)
thanks for all the replies. especially stoker. I have managed to make use of that unsupported method found in sdm.dll (extractBitMap2File). But e-drawings might be the way to go in the future. who knows

If anybody should need to look at it please let me know

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources