1

I want to do some automation with SQL Server management studio and need to track what Windows messages were sent to it when I click the "Execute" button. Basically what I want to do is:

  1. When the user press the "Execute" button or press F5, intercept it.
  2. Check the text in the editor, it the first line is --sqlcmd, then change the query mode to "SQLCMD mode". Otherwise ensure the query mode is not "SQLCMD mode".
  3. Execute as normal.

I want to use AutoHotKey's PostMessage function to do it. However I don't know how to track what messages to post. Anyone can give some suggestions?

look at this

user133580
  • 1,479
  • 1
  • 19
  • 28
  • Use Spy++ and it might work. But the VS2010 Shell is built on WPF in most places and it doesn't use windows messages except out of necessity. – ta.speot.is Jan 24 '14 at 23:08
  • 1
    I think sending messages to SSMS at the windows level would be alot harder than automating the process with powershell / SQL api. – CRAFTY DBA Jan 25 '14 at 03:21

1 Answers1

0

I suggest you to create you own add-in. You have more control when you work from "inside". There are some samples and projects available, here is one that I have created:

http://www.ssmsboost.com/create-own-ssms-2012-add-in-sample-code-with-download

Andrei Rantsevich
  • 2,879
  • 20
  • 25
  • Agreed. I've worked on a project at Red Gate to open up their SSMS extensibility code. There's a developer guide here: http://www.red-gate.com/ssmsecosystem/developerresources – David Pond Apr 02 '14 at 17:42