API: Implementing Mouse Events In A C++ Add-in

Document created by Michael Kozikowski Employee on Feb 16, 2010Last modified by Joyce Bossom on Oct 31, 2017
Version 9Show Document
  • View in full screen mode

This C++ add-in implements mouse events and currently handles the LMB down event. Search for the string "MouseImplementation" in the Document.h and Document.cpp files for the implementation code of the CMouse class. Note that the mouse handler is implemented per model view, so your add-in must implement the model view event handling as well. (Check the ModelView events checkbox during the add-in creation). You have to change the Visual Studio Project\Properties C/C++ settings to your main SolidWorks install folder to pick up the sldworks.tlb.


In 2015, Microsoft removed support for Windows 2000 and earlier. Windows 2000 support has been replaced by Windows 7 support in the attached stdafx.h. ( #define WINVER 0x0400 ==> 0x0601) After you have extracted the attached SwAddinMouse.zip, replace its stdafx.h with the attached version. If you need XP support, modify stdafx.h to use it (#define WINVER 0x0501).


- Subscription Services required for full access.

- Looking for more API Examples?


Copyright (c) 2010 Dassault Systemes SolidWorks Corp. All rights reserved. Do not distribute or reproduce without the written consent of Dassault Systemes SolidWorks Corp.