Here are two macros for Visual Studio, one to add an existing asm file, and one to add a new asm file. (So one do not need to add the custom settings every time one adds a asm file to a project.)

The macros names are:
AddExistingASM
AddNewAsm

I would liked to add this to the File/New and File/Open of Visual, but I do not know how to. (If anyone knows I would like to hear about it).

The file is a .dsm inside a .zip (because the board does not like .dsm file extension).

BTW: Is there any way to tell Visual Studio to open another editor every time I double click a .asm file??
Posted on 2001-12-21 13:11:00 by dxantos
1. Put the macro on Visual C++ Macro Directory, in my case:



C:\Program Files\Microsoft Visual Studio\Common\MSDev98\Macros


2. Run Visual C++, and select the Menu item:
Tools
Customize

3. In the Customize dialog, select Add-ins and Macro files tab.

4. Select the masm macro, and then press the Close Button.

Now Visual C++ Knows about the AssNewAsm and AddExistingAsm Macros. But to use it, its convenient to have a shortcut button. To make the shortcuts:

1. Go again to Tools/Customize Dialog. This Time select the Commands Tab.

2. In the Category, select Macros.

3. In Commands Select AddExistingAsm and drag it to a toolbar.

4. Select the icon for the new button.

5. Repeat steps 3 and 4 for AddNewAsm

There you have it 2 shorcuts, 1 to add a new asm file, 1 to add an existing asm file.

To use the macro.
1. Press the shortcut button.
2. Type in the name of the file.

And thats it, the macro has taken care of add the customize settings to the asm project item. It even puts the .obj in the Debug (for debug builds) and in Release (for release build) directories.

PS. I will really like to know is someone actually uses it
:tongue:
Posted on 2001-12-24 10:58:53 by dxantos
I meant AddNewAsm, not AssNewAsm
Posted on 2001-12-25 20:18:53 by dxantos
Very nice macro ! It could be better with a "Browse..." button, the flag "-W3" added to the compile line and the properties set to "C/C++" (to enable limited syntax highlighting)
Posted on 2001-12-26 06:20:34 by Dr. Manhattan
I wanted it to be on the File/Open File/New dialogs, but I dont know how to add an adding for doing that. (I have found info on various addins, and even on how to create a custom wizard, but no info on how to create an addin for the File/Open, File/New dialogs.

It will be very usefull to be able to browse instead of writing the name of the file. But havent found a Function in the reference of VBA in the MSDN that would open a OpenFile Dialog. Since my expertise in on C++ and assembly, not Visual Basic, I will not be amazed if there is a simple way to do that. Its just that I dont know how.

As for the -W3 option for increasing the warning level, its a matter of personal or institutional taste. Just edit the .dsm file and change the MasmRelease and MasmDebug strings at the beggining to add the options you want.

Anyway, if someone outhere know how to invoke a FileOpen dialog from a VBA macro, it would be very helpful if that person could share the info.
Posted on 2001-12-26 16:48:13 by dxantos
The funny thing is that even in VBA, you can just import a dll and use all the standard API calls. This example works in
Word 97 VBA, so I expect it to work in the Visual Studio VBA:



' MessageBox() Flags
Const MB_OK = &H0&
Const MB_ICONQUESTION = &H20&
Private Declare Function MessageBox Lib "user32" Alias "MessageBoxA" (ByVal hwnd As Long, ByVal lpText As String, ByVal lpCaption As String, ByVal wType As Long) As Long

Sub Main()
MessageBox 0, "This is a test", "Test", MB_OK + MB_ICONQUESTION

End Sub


You can find all the Const's and Declares in win32api.txt, search your HD for it.
Important: don't forget to add a "Private" in front of the declare, or VBA will give an error!
The text file was written for VB, not VBA.
Posted on 2001-12-30 03:33:55 by Qweerdy
VC++ uses VBS (Visual Basic Script), not VBA(Visual Basic For Applications) as I wrote before. Sorry, my mistake

Reading the MSDN, a VBS application cannot call the Windows API, thus it would be better to make a pluging to handle this.
Posted on 2002-01-08 22:35:48 by dxantos
I thought VBS can use COM? I know there is an API wrapper for COM, that allows you to call any Win32 API from COM, but that is a fairly hacky way to do it. I have a pluggin that someone wrote for using MASM from VC, and posted to the newsgroups, but I'd have to hunt it down. Never could get it to work on VS6, but I think it was wrote for VC5? Let me know and I'll hunt it down - that had to be a couple years ago that is was released, and then there was no support - I can't even remember who posted it? I might not even have it? :tongue:
Posted on 2002-01-08 23:34:21 by bitRAKE