Hello, does anybody know an add-in for VC 5.0 that fully integrates ASM files into this IDE. I dont want to create a custom build step manually every time I add a ASM file to a project. I'm too lazy to write it myself. japheth
Posted on 2001-06-29 01:06:00 by japheth
Here is a build macro for NASM - hopefully you can do a little mod to get it to work for you. It's not mine, I found it somewhere and wrote it to the HD (lucky you - I'm sure I couldn't find it again!). Custom File Build.dsm

Option Explicit
'
' This is the path to nasmw.exe
'
Public Const NASMPath = "C:\nasm\nasmw.exe"
Public Const NASMSwitches = " -f win32 ""$(InputPath)"" -o ""$(ProjDir)\$(IntDir)\" + _
	"$(InputName).obj"""
'
' The total number of ASM files created so far
'
Private ASMFilesCreated
ASMFilesCreated = 1

Sub AddNewAssemblyFile()
'Description: Add a new Assembly File to your project
	Dim TempConfiguration
	Dim TempDocument
	Dim TempFilename
	Dim TempBackSlashPosition
	Dim CurrentProject
	Dim FileSystem

	Set CurrentProject = Application.ActiveProject
	TempFilename = "Asm" + CStr(ASMFilesCreated) + ".asm"

	If CurrentProject.Type <> "Build" Then
		MsgBox "This project is not a build project."

	Else

		ASMFilesCreated = ASMFilesCreated + 1

		TempFilename = InputBox("Enter the filename:", "Add ASM File", _
			TempFilename)

		If TempFileName = "" Then Exit Sub

		TempBackSlashPosition = InStrRev(CurrentProject.FullName, "\")

		TempFilename = Left(CurrentProject.FullName, TempBackSlashPosition) + TempFilename
		
		Application.Documents.Add "Text"
		Application.ActiveDocument.Save(TempFilename)

		CurrentProject.AddFile TempFileName

		For Each TempConfiguration In CurrentProject.Configurations
			TempConfiguration.AddCustomBuildStepToFile TempFilename, NASMPath + _
				NASMSwitches, "$(ProjDir)\$(IntDir)\$(InputName).obj", _
				"Assembling $(InputName).asm..."
		Next

	End If
			
End Sub

Sub AddExistingAssemblyFile()
'Description: Add an existing Assembly File to your project
	Dim TempConfiguration
	Dim TempDocument
	Dim TempFilename
	Dim TempBackSlashPosition
	Dim CurrentProject
	Dim FileSystem

	Set CurrentProject = Application.ActiveProject
	TempFilename = "Asm" + CStr(ASMFilesCreated) + ".asm"

	If CurrentProject.Type <> "Build" Then
		MsgBox "This project is not a build project."

	Else

		ASMFilesCreated = ASMFilesCreated + 1

		TempFilename = InputBox("Enter the filename:", "Add ASM File", TempFilename)

		If TempFileName = "" Then Exit Sub

		CurrentProject.AddFile TempFileName

		For Each TempConfiguration In CurrentProject.Configurations
			TempConfiguration.AddCustomBuildStepToFile TempFilename, NASMPath + _
				NASMSwitches, "Assembling $(InputName).asm..."
		Next

	End If
			
End Sub
Posted on 2001-06-29 01:21:00 by bitRAKE
thanks bitRAKE, but the code cannot execute, method "AddFile" is not a valid member of class "project" in VC50. I wonder how I can add an existing file to a project in VBSript of VC50. japheth
Posted on 2001-06-30 10:09:00 by japheth
Sorry, I'm using VS6 SP5. I've never used VC5 before. Have you already looked here?: Code Project This message was edited by bitRAKE, on 6/30/2001 12:53:13 PM
Posted on 2001-06-30 12:46:00 by bitRAKE
If you replaced the two constants with the masm32 equivalent path and parameters, would it work? and how would you implement this. I have vs6 but I never use it
Posted on 2001-06-30 18:54:00 by Satrukaan
Yes, it works with VS6 to automatically set the build settings on asm files. One macro for adding new files, one for adding existing files.
Posted on 2001-07-01 13:43:00 by bitRAKE
Can you go through the steps for setting this up for MASM32? I don't know how to make or use Visual C++ macros. I also don't know what to replace the switches to use MASM switches instead of NASM switches. I'm assuming -f win32 and -o can just be replaced with /c and /coff, but I don't know what to do with the VC $(InputPath) and stuff in MASM.
Posted on 2001-07-03 14:39:00 by Satrukaan