各位大侠,我想让我的程序每编译一次,版本号就自动增加1。如何在VC中实现?
解决方案 »
- 关于vc++6.0找不到ado控件的问题。
- 链表问题!请指教!
- 散分,新手上路,想做网络方面的开发,请有经验的达人赐教
- 以前的程序中的一个窗口,现在想拿过来用,怎么搞啊?
- 哪位高手能指点一下,我在SOCKET编程时编写如下代码,为何无法实现发送与接受?万分感谢!!!
- VC6中使用ADO执行SQL语句时可以用变量代替SQL语句里的条件吗?
- 更改完PATH环境变量之后,要重新启动计算机吗?
- 为什么线程只能执行一次?
- 在Debug下没问题,到了Release下就出内存操作错误,找不到原因,请高手提示一二!!!
- 关于COM中 SAFEARRAY(byte) 类型的问题
- 我用DirectShow作的视频采集程序(仿照SDK的PlayCap)作的我想在视频上面画点图怎么作?
- 如何提升自己进程的权限才能在其它进程分配虚拟内存和创建远程线程?
发信人: jiangsheng()
整理人: wenbobo(2002-12-27 15:59:45), 站内信件
I have tens of projects in my workspace. It is so boring to update ver
sion info(mainly,the version number) and I wrote this macro to replace
version info for every project.
Usage:
Input version information,include following:
1.company name.
2.Trade.
3.Copyright.
4.File Version.
5.Product Version.
Note:if you input an empty string,then no changes are made on correspo
nd version information.
The macro will prompt you if you want the changes applies to all proje
ct. If you select NO, the macro will prompt for every project just bef
ore apply changes.You can stop the macro by clicking "Cancel".
Note: hide wizard bar to skip reloading RC file for better performance
.
Sub SetProjectVersionInfo()
'DESCRIPTION: Set version information in rc script for one or more pro
ject(s) in current workspace .Company Name,Trade,LegalCopyright,an
d version number.If some information is empty, then no changes are mad
e on correspond version information.
'Created by Jiang Sheng at 2000-6-21 16:48
DIM strCompanyName
DIM strTrade
DIM strLegalCopyright
DIM strFileVersion
DIM strProductVersion
DIM bAllProject
DIM bApply
DIM nResult
bAllProject=1
Dim oneProject
if Application.Projects.Count =0 then
MsgBox("No project available.")
Exit Sub
end if
strCompanyName= InputBox ("Please input company name:"& Chr(13) & Chr
(10)&"Empty means no changes.","Input Company Name")
strTrade= InputBox ("Please input legal trades:"& Chr(13) & C
hr(10)&"Empty means no changes.","Input Legal Trades")
strLegalCopyright= InputBox ("Please input legal copyright:"& Chr(13)
& Chr(10)&"Empty means no changes.","Input Legal Copyright")
strFileVersion= InputBox ("Please input file version:"& Chr(13) & Chr
(10)&"Empty means no changes."& Chr(13) & Chr(10)& "Version must in x,
x,x,x format.","Input File Version")
strProductVersion= InputBox ("Please input product version:"& Chr(13)
& Chr(10)&"Empty means no changes."& Chr(13) & Chr(10)& "Version must
in x,x,x,x format.","Input Product Version") nResult=MsgBox("Apply changes for all projects?",VbYesNoCancel)
SELECT CASE nResult
case vbYes
bAllProject=1
case vbNo
bAllProject=0
case vbCancel
Exit Sub
End SELECT
For Each oneProject in Application.Projects
if bAllProject=0 then
nResult=MsgBox("Apply changes for project "+oneProject.Name+"?",VbY
esNo)
else
bApply=1
end if
SELECT CASE nResult
case vbYes
bApply=1
case vbNo
bApply=0
case vbCancel
Exit Sub
End SELECT
if bApply then
set ActiveProject=Projects(oneProject.Name)
Dim strTemp
Dim documentObject
' open the project's resource script: strTemp = ActiveProject.FullName
Wnd = Left(strTemp, Len(strTemp) - 3) + "rc" Documents.Open (Wnd), "Text"
For Each documentObject in Application.Documents
if documentObject.FullName = Wnd then
documentObject.Active = True
exit for
end if
Next ' SAVE BACK-UP OF FILE >>>>
ActiveDocument.Save (Wnd+"~") ActiveDocument.Close()
Documents.Open Wnd, "Text"
if strCompanyName<>"" then
ActiveDocument.Selection.FindText "VALUE ""CompanyName"", """, dsM
atchForward + dsMatchFromStart + dsMatchCase
ActiveDocument.Selection.CharRight
ActiveDocument.Selection.EndOfLine dsExtend
ActiveDocument.Selection.CharLeft dsExtend, 3
ActiveDocument.Selection.Text=strCompanyName
end if
if strTrade<>"" then
ActiveDocument.Selection.FindText "VALUE ""LegalTrades"", """,
dsMatchForward + dsMatchFromStart + dsMatchCase
ActiveDocument.Selection.CharRight
ActiveDocument.Selection.EndOfLine dsExtend
ActiveDocument.Selection.CharLeft dsExtend, 3
ActiveDocument.Selection.Text=strTrade
end if
if strLegalCopyright<>"" then
ActiveDocument.Selection.FindText "VALUE ""LegalCopyright"", """,
dsMatchForward + dsMatchFromStart + dsMatchCase
ActiveDocument.Selection.CharRight
ActiveDocument.Selection.EndOfLine dsExtend
ActiveDocument.Selection.CharLeft dsExtend, 3
ActiveDocument.Selection.Text=strLegalCopyright
end if
if strFileVersion<>"" then
ActiveDocument.Selection.FindText "FILEVERSION", dsMatchForward +
dsMatchFromStart + dsMatchCase + dsMatchWord
ActiveDocument.Selection.WordRight
ActiveDocument.Selection.EndOfLine dsExtend
ActiveDocument.Selection.Text=strFileVersion ActiveDocument.Selection.FindText "VALUE ""FileVersion"",", dsMatc
hForward + dsMatchFromStart + dsMatchCase
ActiveDocument.Selection.WordRight dsMove,2
ActiveDocument.Selection.EndOfLine dsExtend
ActiveDocument.Selection.CharLeft dsExtend, 3
ActiveDocument.Selection.Text=strFileVersion
end if if strProductVersion<>"" then
ActiveDocument.Selection.FindText "PRODUCTVERSION", dsMatchForward
+ dsMatchFromStart + dsMatchCase + dsMatchWord
ActiveDocument.Selection.WordRight
ActiveDocument.Selection.EndOfLine dsExtend
ActiveDocument.Selection.Text=strFileVersion
ActiveDocument.Selection.FindText "VALUE ""ProductVersion"",", dsM
atchForward + dsMatchFromStart + dsMatchCase
ActiveDocument.Selection.WordRight dsMove,2
ActiveDocument.Selection.EndOfLine dsExtend
ActiveDocument.Selection.CharLeft dsExtend, 3
ActiveDocument.Selection.Text=strProductVersion
end if
ActiveDocument.Save()
ActiveDocument.Close()
End if
Next
End Sub --
HE WHO CONTROLS THE PAST, COMMANDS THE FUTURE.
HE WHO CONTROLS THE FUTURE CONQUERS THE PAST.※ 来源:.网易虚拟社区 http://club.netease.com.[FROM: 202.96.44.196]