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


Pre/Post menu actions (API)

Pre/Post menu actions (API)

Pre/Post menu actions (API)

I am trying to find a way to bind a custom dll to an existing button in Solidworks. Basically when the user hits the print button, I want that action to trigger my code to run first, then once execution is completed, continue on with the normal print function. I am used to having this functionality when programming for NX by loading custom menu files that I can push out to the whole organization. I have not been able to find similar editing of the menu capability in Solidworks. Through my searching commandOpenPreNotify looks the most promising and in testing it will indeed trigger my function. My problem is isolating it to run just when the print button is hit. At the moment it will run when a user does anything in the software. It is my understanding that I can pass an integer to this function in order to specify on what existing command it should be triggered (please correct me if I'm wrong). If this is the case I am having issues finding what this integer would be. I latched on with my debugger and have set countless watch points trying to see the result of what menu item the user selects, but with no luck.

I just started API programming for Solidworks a few days ago. More or less I have to emulate the same custom functions I've programmed for NX and "port" them for Solidworks. I am making headway but this triggering of my custom functions is what is holding me back currently.

Using vb.net or c#,

Thankyou ahead of time

RE: Pre/Post menu actions (API)

So I don't know how I didn't see this one before but there is a printNotfiy event handler which I missed in the documentation. Have to see if I can have it be able to trigger before actually printing the document but we will see, looks promising from the documentation.

RE: Pre/Post menu actions (API)

Seems like huge trouble. What about killing the print button in the UI through a standard "copy settings wiz" file and substituting your own macro button that looks the same but runs your code? Much more lightweight than having your dll always watching every single thing the user does.

-handleman, CSWP (The new, easy test)

RE: Pre/Post menu actions (API)

I settled on just making a new menu to trigger the functionality I'm coding. The project kind of ballooned with more functionality that is better served by the user running separate functions that is not longer tied to when the user prints. Thanks for the suggestion anyway.

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!


Close Box

Join Eng-Tips® Today!

Join your peers on the Internet's largest technical engineering professional community.
It's easy to join and it's free.

Here's Why Members Love Eng-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close