Using Visual Studio

This SDK supports Visual Studio 2008(SP1)/2010/2012/2013. Screen shots are almost made by for Visual Studio 2010, but any versions are almost common. The description for each version is written only if the operation is different.

  1. Open mqsdk.sln by Visual Studio.
    When you open the solution file with Visual Studio 2010/2012/2013, it is demanded whether to convert the project in a dialog. Please convert it and open.

  2. Download WTL (Windows Template Library), expand the file and add the include directory in [Configuration Properties > VC++ Directories > Include Directories] in each project property for building a sample project using WTL like as StationSpy. The WTL version 7.5 has been confirmed for a build.
    Currently, original widgets are recommended to create GUI like as a dialog. This setting is unnecessary if you do not want to build a sample project with WTL.

    Visual Studio 2008: Set in [Tool > Options].


    Visual Studio 2010/2012/2013: Set in [Configuration Properties > VC++ Directories] of the project property pages.


  3. Call the menu: File > Add > New project.

  4. Select [Visual C++ > Win32] from installed templates, select [Win32 Project], and input a project name.

  5. Select [Next] button in the Win32 Application Wizard.


  6. Check [DLL] for an application type and [Empty project] for additional options, and push the [Finish] button. And a new project will be created under the mqsdk directory.



  7. Existing projects have settings for both 32-bit and 64-bit. But, the created project initially has a setting for 32-bit only.
    Open [Build > Configuration Manager], select [x64] in [Active Solution Platform], and select [New] in the [Platform] for the created project. Push [OK] in the dialog, and a setting for 64-bit will be created.



  8. For both [Debug] and [Release] in the [Active solution configuration], select [x64] as [Platform] and check [Build] on and close the dialog.


  9. Copy a .cpp file in a plug-in which the type of the plug-in is same as you want to create (for example, Spring.cpp for "Create" plug-in), rename it and save.

  10. Add the saved .cpp file and MQInit.cpp to the project.

  11. Select [All Configurations] as Configuration and [All Platforms] as Platform in the project property pages, and input the following string in the [Output Directory] and [Intermediate Directory]:
      Visual Studio2008: $(PlatformName)\$(ConfigurationName)\
      Visual Studio2010/2012/2013: $(Platform)\$(Configuration)\
    Built files will be outputted in the Win32/x64 and Debug/Release directory under the project.

  12. Open [Property] of the project, select [Configuration Properties > C/C++ > General], and add ".." directory to the [Additional Include Directories]. And you can compile normally without copying MQPlugin.h in the mqsdk directory.


  13. Edit the .cpp file to create your own program. At the time, it is necessary for modifying plug-in functions like as MQGetPlugInID() and MQGetPlugInName().

  14. Change the Solution Platform to [Win32] or [x64] and the Solution Configuration to [Debug] or [Release] if necessary. And build the project. And the plug-in will be completed.


    Some resource files (.rc files) are failed to compile with Visual C++ Express Edition. The following code in each .rc file must be commented out:
    #include "afxres.h"
    , and replace to the following:
    #include <windows.h>
    #define IDC_STATIC -1
                  

    When you build projects using WTL (Windows Template Library) by Visual C++ 2010 Express Edition and Windows SDK, the error message "fatal error C1083: Cannot open include file: 'atlbase.h': No such file or directory" will be shown and fail to compile. I hear WDK (Windows Driver Kit) contains 'atlbase.h'. Please check details on the Web.

  15. Choose Metaseq.exe in [Configuration Properties > Debugging > Command] when you build a project for a [Debug] build. And you can debug the created plug-in .dll file.