|
In VC++ 6.0 in "ResourceView tab->Version" we find four places where version number has to be changed.
1. FILEVERSION
2. PRODUCTVERSION
and
3. FileVersion
4. ProductVersion
Initially the version number in all these four places will be
1,0,0,1. Now our client requirement is to add intermediate version number i.e. fifth digit (e.g. 1,0,0,1, I2).
I am able to add at "FileVersion" and "ProductVersion" but "FILEVERSON" and "PRODUCTVERSION" are not accepting the fifth digit.
Any solution in this regards will be highly appreciated.
Thanks & Regards,
Neeraj
|
|
|
|
|
There are only four defined places for digits.
The one place you can add stuff all day is to the version information that is stored as a string (FileVersion and ProductVersion).
The one that is a number is only treated as the two WORDS of two DWORDS. So you only get four numbers possible for each of FILEVERSION and PRODUCTVERSION.
What you might consider doing, assuming you don't have 'hundreds' of patches and more than 9 service packs, is to use the lower number as a build identifier and then for the third number use the 10's digits as a patch number and the hundreds or thousands place as a service pack indicator.
For example, 7.11.1.3452
would mean product version 7.11, patch 1, build 3452
7.11.201.35
would mean product version 7.11 service pack 2 patch 1 build 35
7.5.434.99
would mean product version 7.5 service pack 4 patch 34 build 99
This works well with version checking tools as well, because all numebrs are constantly increasing.
Some scheme similar to this might help you out.
|
|
|
|
|
Thanks miller.
I would try with the solution you have provided.
thanx again.
Thanks & Regards,
Neeraj
|
|
|
|
|
I am trying to make an array of function pointers in C++. I have done it sucessfully in C, but I am having a problem with the arrays not giving defined correctly. Syntactically they are correct (or at least according to the compiler they are), but when it comes time to call the function, the arrays show that they are not defined with the functions that i am putting in the arrays.
Here is the declaration for both of my function pointer arrays that are public members of my "CDialog" class in my dialog.h file:
void (*functionarray1[48])();
void (*functionarray2[160])();
That file also houses the declarations for all of the functions I will use with the arrays.
Next I define the 2 arrays in my dialog.cpp file:
void (CDialog::*functionarray1[48])() = {CDialog::function1,CDialog::function2};
void (CDialog::*functionarray2[160])() = {CDialog::function3,CDialog::function4};
So according to this function1 should be in functionarray1[0]. function2 in functionarray1[1], etc... but at runtime when i run a debug the array never gets filled and I get an assertion error
Here is the code to call the function pointer based on an unknown offset value between 00h and 9Fh in "insptr":
CDialog FuncPtr;
UINT insptr = (INSNum / 2);
(FuncPtr.functionarray1[insptr])(); <-----------------
The assertion error happens when the line pointed to executes.
I took this syntax from a paper on C++ array of function pointers
if anyone can help, I'd really appreciate it.
|
|
|
|
|
you should call the functions like
assign the address of the function like:
void (CDlg::*functionarray1[48])() = { &CDlg::function1, &CDlg::function2 };<br />
and call them like:
(FuncPtr.*(functionarray1[insptr]))();<br />
I think that should do it...
Offcourse you should be mindfull to call functions on a CDialog object which has not yet been created (does not have a valid HWND member).
Greetings,
Davy
|
|
|
|
|
it is not as GDavy suggested (the & operator is not necessary when assigneing function addresses, as the name of a function is already its address).
i'd suggest you better assign an instance of the function instead of its name...
i doubt you have a CDialog::function1 in your code...
but if you have a CDialog object instanced (let's say dlg ), then you could pass dlg.Function1 .
better like this ?
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
toxcct wrote:
it is not as GDavy suggested (the & operator is not necessary when assigneing function addresses, as the name of a function is already its address).
According to ANSI C++[^]it is! VS 2005 even requires it..
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
|
|
|
|
|
CNewbie wrote:
...at runtime when i run a debug the array never gets filled and I get an assertion error
What is the file/line of the assertion?
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Ok FWIW the function that calls the function pointer array is not in the same source file as the function pointer array definition.
The definition:
void (CflowlogDlg::*call_ins_function[48])() = {CflowlogDlg::doins00,CflowlogDlg::doins02,CflowlogDlg::doins04,CflowlogDlg::doins06,CflowlogDlg::doins08,CflowlogDlg::doins0A,CflowlogDlg::doins0C,CflowlogDlg::doins0E};
Is in my dialog1.cpp file and the call:
CflowlogDlg INSFunction;
UINT insptr = (INSNum / 2);
(INSFunction.call_ins_function[insptr])();
is in the dialog2.cpp file
the assertion happens on this line:
(INSFunction.call_ins_function[insptr])();
It should be *call_ins_function, but the compiler wont allow it. Keeps giving me an error C2109: subscript requires array or pointer type
and
error C2597: illegal reference to non-static member 'CflowlogDlg::call_ins_function'
but that is because I am calling from a static member function to a non static member function.
|
|
|
|
|
CNewbie wrote:
the assertion happens on this line:
(INSFunction.call_ins_function[insptr])();
Ok, what assertion is being fired?
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Unhandled exception at 0xcccccccc in flowlog.exe: 0xC0000005: Access violation reading location 0xcccccccc.
And as you might have guessed, in the debug at that spot, when I look at what is in the array there is nothing but 0xcccccccc where the function addresses should be.
When I run the program without debug I get the assertion error on line 1002 of wincore.cpp which is:
ASSERT(pMap->LookupPermanent(hWndOrig) == NULL);
|
|
|
|
|
CNewbie wrote:
Unhandled exception at 0xcccccccc...
This is the standard value for uninitialized local variables in debug mode. One thing to try is the Debug -> Exceptions options to select breaking (rather than stopping) on the raising of an exception. Then you can catch them directly when they happen.
See here for more.
CNewbie wrote:
When I run the program without debug I get the assertion error on line 1002 of wincore.cpp which is:
This indicates that you are using something other than VC++ v6. Correct?
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
yes, I am using VS.NET 2003 or VC++ 7.1 whichever way you want to look at it.
My problem would seem to come down to the fact that I am not defining the array correctly, but I dont see why. Maybe you could see what I am doing wrong.
|
|
|
|
|
CNewbie wrote:
Maybe you could see what I am doing wrong.
Try these articles:
http://www.everything2.com/index.pl?node_id=1509071
http://oopweb.com/CPP/Documents/FunctionPointers/Volume/CCPP/FPT/em_fpt.html
http://mail.nl.linux.org/kernelnewbies/2003-05/msg00447.html
http://www.newty.de/fpt/fpt.html
http://lists.trolltech.com/qt-interest/2004-07/thread00496-0.html
http://publications.gbdirect.co.uk/c_book/chapter5/function_pointers.html
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Hey David. i just wanted to update you on my Function Pointer array problem.
I have solved the problem of the arrays not being initialized by filling them within a member thread using an instance of my class as such:
CDialog Function;
Function.call_function[0] = &CDialog::dFunction1;
Function.call_function[1] = &CDialog::dFunction2;
However, these are only Local definitions and would need to be redefined whenver this function is called. So what I would rather do is define them globally, but I have not been able to figure out how to do it without error.
According to books I read. To declare instances (objects) of a class, you do so by including them at the end of the class declaration outside of the ending curly bracket. I did this using the "extern" keyword so the object could be used throughout all of my source files as such:
<br />
class CDialog<br />
{<br />
public:<br />
CDialog(CWnd* pParent = NULL);
protected:<br />
virtual void DoDataExchange(CDataExchange* pDX);
protected:<br />
virtual BOOL OnInitDialog();<br />
DECLARE_MESSAGE_MAP()<br />
public:<br />
CEdit m_sigstrEdit;<br />
}extern Function;<br />
I then defined the instance globally in one of my source files as such:
CDialog Function;
and it compiled without syntax error, but as soon as the program starts I get an assertion error in Line 26 of afxwin1.inl. If I do not use the "extern" keyword i get linker errors about the object already being defined. So I am at a loss about how to implement this globally.
I really appreciate your help thus far.
|
|
|
|
|
CNewbie wrote:
CDialog Function;
Function.call_function[0] = &CDialog::dFunction1;
Function.call_function[1] = &CDialog::dFunction2;
If call_function is an array of function pointers, why not initialize it in the dialog's OnInitDialog() method? The other odd-looking thing is that dFunction1 and dFunction1 do not belong to CDialog .
CNewbie wrote:
To declare instances (objects) of a class, you do so by including them at the end of the class declaration outside of the ending curly bracket.
You can instantiate an object anytime after the class has been declared. Doing so in the class' header file is odd.
CNewbie wrote:
}extern Function;
I'm surprised this compiled. In any case, I don't think it's necessary. But without a better understanding of what exactly it is you are after, my suggestions are sparse.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
What I want to do is define the 2 function pointer arrays with the appropriate functions globally so that I can use them throughout the problem without having to redefine them each time I have to use them.
The 2 function pointer arrays are as follows:
void (*call_cmd_function[160])();
void (*call_ins_function[48])();
The functions (NOTE: I did declare them in my class, just didnt put them in the class example above) for both of these arrays are named "dFunction 1 through 45" and "dFunction 46 through 99".
My Class is CDialog.
If you need anymore info Please ask, I really appreciate the help.
|
|
|
|
|
CNewbie wrote:
What I want to do is define the 2 function pointer arrays with the appropriate functions globally so that I can use them throughout the problem without having to redefine them each time I have to use them.
Right. The compiler is never happy when it encounters a redefinition. You can certainly make the arrays global to the entire program. However, they must be initialized within some function (e.g., main() ). After that, they can be used from wherever they are needed. And, as you have already discovered, if the arrays are needed in more than one file, you'll need to employ the extern keyword. This means the arrays are visible from files other than the one in which they are defined.
CNewbie wrote:
My Class is CDialog.
Does this mean that you are not using MFC?
I'm sure you've figured this much out:
void (*call_cmd_function[160])(void);
void Func1( void )
{
cout << "Func1" << endl;
}
void Func2( void )
{
cout << "Func2" << endl;
}
void Func3( void )
{
cout << "Func3" << endl;
}
void main( void )
{
call_cmd_function[0] = Func1;
call_cmd_function[1] = Func2;
call_cmd_function[2] = Func3;
(*call_cmd_function[2])();
(*call_cmd_function[1])();
(*call_cmd_function[0])();
}
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Actually I am using MFC. "CDialog" is a ficticious name.
As I pointed out in the last post, I declared both of the arrays in my header file as such:
<br />
void (*call_cmd_function[160])();<br />
void (*call_ins_function[48])();<br />
Then I defined them "globally" at the top of one of my source files as such:
<br />
void (CflowlogDlg::*call_ins_function[48])() = {NULL};<br />
void (CflowlogDlg::*call_cmd_function[160])() = {NULL};<br />
As you said without the "extern" keyword this would not be seen within all of my source files. The wierd thing is that I reference these arrays in more then one of my source files and the compiler didnt give me any errors when compiling with this code.
Now I do define these arrays in my InitDialog() as such:
<br />
CflowlogDlg INSFunction;<br />
INSFunction.call_ins_function[0] = &CflowlogDlg::doins00;<br />
INSFunction.call_ins_function[46] = &CflowlogDlg::doins5C;<br />
but when I get to reference the array in another member function it is not defined. Instead of the array having the function addresses in them they have the default memory address of 0xCCCCCCCC in them. The definition only works if i put the definition of the arrays in the same member function as the one I reference them from. Now obviously I am doing something wrong here, but i do not know what
|
|
|
|
|
CNewbie wrote:
void (*call_cmd_function[160])();
void (*call_ins_function[48])();
Then I defined them "globally" at the top of one of my source files as such:
void (CflowlogDlg::*call_ins_function[48])() = {NULL};
void (CflowlogDlg::*call_cmd_function[160])() = {NULL};
Here you have two separate copies of call_ins_function and call_cmd_function .
Are call_cmd_function and call_ins_function supposed to be a member of CflowlogDlg ?
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Yes, both call_ins_function and call_cmd_function are members of CflowlogDlg.
|
|
|
|
|
See if this helps:
class CflowlogDlg
{
public:
void Func1( void )
{
cout << "Func1()" << endl;
}
void Func2( void )
{
cout << "Func2()" << endl;
}
void Func3( void )
{
cout << "Func3()" << endl;
}
typedef void (CflowlogDlg::*call_cmd_function)(void);
};
void main( void )
{
CflowlogDlg::call_cmd_function arr[160];
arr[0] = CflowlogDlg::Func1;
arr[1] = CflowlogDlg::Func2;
arr[2] = CflowlogDlg::Func3;
CflowlogDlg m;
(m.*arr[2])();
(m.*arr[1])();
(m.*arr[0])();
}
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
That worked as local definitions, but didn't work for the global aspect. The reference of call_cmd_function and call_ins function as well as the class referencein my other source files go unresolved.
I can pinpoint my problem to the fact that I need to globalize my class instance. I can lcoalize them by defining them in a member function like so:
CflowlogDlg Instance;
but again i dont know how to globalize it and extern it so it can be used throughout all of my source files. I tried doing it like I read in the c++ book I have, but it doesnt seen to work correctly as I get Linker errors.
|
|
|
|
|
At this point, I suggest you boil the problem down to just what is absolutely necessary. From there you can post a code snippet and we can put it to rest once and for all.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Ok I decided to make both arrays static so that I wouldn't have to use any class instances to access them. Plus it boads better for my program to do it this way since all of the member functions that the array uses are already static.Now I know that static variable (even global ones) are only known within the file that it is declared in. Here is what I did:
Within my Header file I declare the 2 arrays as static:
<br />
static void (*call_cmd_function[160])();<br />
static void (*call_ins_function[48])();<br />
Then I define them at the top of the source files where I reference them:
<br />
void (CflowlogDlg::*call_cmd_function[160])() = {NULL};
void (CflowlogDlg::*call_ins_function[48])() = {NULL};
When I compile I get unresolved external symbol errors:
<br />
flowlogcmds.obj : error LNK2001: unresolved external symbol "public: static void (__cdecl** CflowlogDlg::call_cmd_function)(void)" (?call_cmd_function@CflowlogDlg@@2PAP6AXXZA)<br />
flowlogins.obj : error LNK2001: unresolved external symbol "public: static void (__cdecl** CflowlogDlg::call_ins_function)(void)" (?call_ins_function@CflowlogDlg@@2PAP6AXXZA)<br />
neither are referenced outside of its file, so I dont know why I am getting the Linker errors.
|
|
|
|