Custom built files
Posted
by Peter Gavin
on November 29th, 1998
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

Comments
There are no comments yet. Be the first to comment!