Click here to Skip to main content
16,008,750 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: How to position a toolbar??? Pin
Cedric Moonen30-Jun-05 4:54
Cedric Moonen30-Jun-05 4:54 
GeneralRe: How to position a toolbar??? Pin
IlanTal1-Jul-05 8:37
IlanTal1-Jul-05 8:37 
GeneralAccount type Pin
__makaveli__30-Jun-05 3:10
__makaveli__30-Jun-05 3:10 
GeneralRe: Account type Pin
Blake Miller30-Jun-05 4:45
Blake Miller30-Jun-05 4:45 
GeneralRe: Account type Pin
David Crow30-Jun-05 5:51
David Crow30-Jun-05 5:51 
GeneralRe: Account type Pin
__makaveli__30-Jun-05 5:52
__makaveli__30-Jun-05 5:52 
GeneralVersion Control vs. resource files ( resource.h ) Pin
Maximilien30-Jun-05 2:48
Maximilien30-Jun-05 2:48 
GeneralRe: Version Control vs. resource files ( resource.h ) Pin
krmed30-Jun-05 4:05
krmed30-Jun-05 4:05 
We also have numerous projects, with many people possibly modifying the resources at the same time (on different branches of source control). Eventually these branches are merged into the mainline code, resulting in duplicate resource IDs.

To resolve the issue, I wrote some macros (for VC++ 6.0) that will allow you to edit the resource.h file, select any portion of the resource symbols, and then it will renumber them with a user-specified starting number.

It only requires that someone take the responsibility to renumber the resources after merges - and we assign that to the developer that made the merge.

Here's the macros I use:
Sub RenumResType()<br />
'DESCRIPTION: Renumber resource IDs sequentially for a specified type of resource<br />
	RType = InputBox("Enter the type of resource you want to renumber?" + vbLf + vbLf +_<br />
	"Example: IDC_ or IDD_" + vbLf +_<br />
	"Be sure to include the underscore if needed.", "Resource Type", "IDC_")<br />
	if len(RType) = 0 then<br />
		Exit Sub<br />
	end if<br />
<br />
	iStart = InputBox("Enter the starting resource number you want to use", _<br />
	"Starting Resource ID", "1000")<br />
	if len(iStart) = 0 then<br />
		Exit Sub<br />
	end if<br />
	i = iStart<br />
<br />
<br />
	ActiveDocument.Selection.StartOfDocument<br />
	ActiveDocument.Selection.SelectLine<br />
	ActiveDocument.Selection.SelectAll<br />
	StartLine = ActiveDocument.Selection.TopLine<br />
	EndLine = ActiveDocument.Selection.BottomLine<br />
	ActiveDocument.Selection.StartOfDocument<br />
	for lineno = StartLine To EndLine<br />
		ActiveDocument.Selection.SelectLine<br />
		CurrText = ActiveDocument.Selection<br />
		pos = InStr(CurrText, RType)<br />
		if pos > 0 then<br />
			ActiveDocument.Selection.EndOfLine<br />
			ActiveDocument.Selection.WordLeft dsExtend<br />
			ActiveDocument.Selection = i<br />
			i = i+1<br />
		end if<br />
		ActiveDocument.Selection.StartOfLine<br />
		ActiveDocument.Selection.LineDown<br />
	Next<br />
	ActiveDocument.Selection.StartOfDocument<br />
End Sub<br />
<br />
Sub RenumSelRes()<br />
'DESCRIPTION: Renumbers the selected resources sequentially<br />
	CurrText = ActiveDocument.Selection<br />
	if Len(CurrText) = 0 then<br />
		MsgBox "No text has been selected"<br />
		Exit Sub<br />
	end if<br />
<br />
	iStart = InputBox("Enter the starting resource number you want to use", _<br />
	"Starting Resource ID", "1000")<br />
	if len(iStart) = 0 then<br />
		Exit Sub<br />
	end if<br />
	i = iStart<br />
<br />
	StartLine = ActiveDocument.Selection.TopLine<br />
	EndLine = ActiveDocument.Selection.BottomLine<br />
	for lineno = StartLine To Endline<br />
		ActiveDocument.Selection.GoToLine lineno<br />
		ActiveDocument.Selection.SelectLine<br />
		CurrText = ActiveDocument.Selection<br />
		pos = InStr(CurrText, "#define ")<br />
		if pos > 0 then<br />
			ActiveDocument.Selection.EndOfLine<br />
			ActiveDocument.Selection.WordLeft dsExtend<br />
			ActiveDocument.Selection = i<br />
			i = i+1<br />
		end if<br />
	Next<br />
	ActiveDocument.Selection.GoToLine StartLine<br />
End Sub<br />

As you can see, there are two macros here - one will renumber all resources of a given type (IDC_, or IDS_, etc) and the other renumbers all resources you have selected.

Hope that helps.


Karl - WK5M
PP-ASEL-IA (N43CS)
<kmedcalf@ev1.net>
PGP Key: 0xDB02E193
PGP Key Fingerprint: 8F06 5A2E 2735 892B 821C 871A 0411 94EA DB02 E193
GeneralRe: Version Control vs. resource files ( resource.h ) Pin
Anna-Jayne Metcalfe30-Jun-05 6:38
Anna-Jayne Metcalfe30-Jun-05 6:38 
GeneralRe: Version Control vs. resource files ( resource.h ) Pin
Maximilien30-Jun-05 6:55
Maximilien30-Jun-05 6:55 
GeneralRe: Version Control vs. resource files ( resource.h ) Pin
Anna-Jayne Metcalfe30-Jun-05 11:17
Anna-Jayne Metcalfe30-Jun-05 11:17 
GeneralRe: Version Control vs. resource files ( resource.h ) Pin
charlieg2-Aug-05 3:19
charlieg2-Aug-05 3:19 
GeneralZoom Pin
Anonymous30-Jun-05 2:40
Anonymous30-Jun-05 2:40 
GeneralRe: Zoom Pin
David Crow30-Jun-05 2:47
David Crow30-Jun-05 2:47 
GeneralRe: Zoom Pin
Jose Lamas Rios30-Jun-05 2:58
Jose Lamas Rios30-Jun-05 2:58 
GeneralInitailizing nesting of structures Pin
napoleaninlondon30-Jun-05 1:52
napoleaninlondon30-Jun-05 1:52 
GeneralRe: Initailizing nesting of structures Pin
David Crow30-Jun-05 2:45
David Crow30-Jun-05 2:45 
GeneralConverting WCHAR to wchar_t Pin
Franz Klein30-Jun-05 1:28
Franz Klein30-Jun-05 1:28 
GeneralRe: Converting WCHAR to wchar_t Pin
«_Superman_»30-Jun-05 1:42
professional«_Superman_»30-Jun-05 1:42 
GeneralTCP and UDP difference Pin
xcavin30-Jun-05 1:25
xcavin30-Jun-05 1:25 
GeneralRe: TCP and UDP difference Pin
toxcct30-Jun-05 1:34
toxcct30-Jun-05 1:34 
GeneralRe: TCP and UDP difference Pin
Mike Dimmick30-Jun-05 2:26
Mike Dimmick30-Jun-05 2:26 
GeneralRe: TCP and UDP difference Pin
David Crow30-Jun-05 2:49
David Crow30-Jun-05 2:49 
GeneralRe: TCP and UDP difference Pin
David Chamberlain30-Jun-05 4:42
David Chamberlain30-Jun-05 4:42 
Generalcould not able to see the text box fields while data while debugging the dialog cpp file code Pin
Prasannajit Dash30-Jun-05 1:06
Prasannajit Dash30-Jun-05 1:06 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.