|
ilostmyid2 wrote: i myself don't know what the code is supposed to do too
ilostmyid2 wrote: i just need to know what does the code do
Interesting...
So you already know what you have to do; you said it yourself: understand the code.
Or, make said modification that allows the code to compile, and it'll probably work exactly like it did in VC6.
|
|
|
|
|
i created this topic for this, to get help to understand what does the code do!
|
|
|
|
|
From the discussions, it looks like the code is attempting to select 'the same' button (int in the modified example) from every instance of class A, using an index and the Info array.
So, as a way of selecting the first or the second button on each instance of A and working with that.
int whichButton = 1; A* arrayOfA = ...
for (int i = 0; i < numOfAs; i++)
{
CButton& button = arrayOfA[i].*(A::m_values[whichButton]);
... }
Or something like that. It's probably a good idea to find out what the code does with this. You should search for all references to A::m_values and find out what exactly it's for.
Then, think of a proper way of implementing that, or verify that it still works and keep it.
|
|
|
|
|
let's continue with a completed code. i wonder that it really works and it's not going to be a mistake or bug of the compiler:
#include "StdAfx.h"
using namespace std;
class A
{
public:
struct Info
{
int A::*a;
};
int a, b;
static Info m_values[];
void f();
};
A::Info A::m_values[] = {&a, &b};
void A::f()
{
int a = this->*(m_values[0].a);
int b = this->*(m_values[1].a);
cout << "m_values: " << a << ", " << b << endl;
}
void f()
{
A a1, a2;
a1.a = 10;
a1.b = 11;
a2.a = 20;
a2.b = 21;
a1.f();
a2.f();
}
the output is:
m_values: 10, 11
m_values: 20, 21
so how does vc6 implements this and what's the equivalent code in vs2010?
thx
|
|
|
|
|
ok, i found it at last. it's enough to replace &a and &b in the initialization of m_values with &A::a and &A::b. thank u Maximilien. i couldn't figure it out sooner.
|
|
|
|
|
Hello,
I'm Using a 3rd party software that uses log4cxx as its logging provider.
I'm intersted in directing the log to a log4net appender, since my other programs uses log4net.
Can anyone help me ?
thanks,
berlus
|
|
|
|
|
Ask the person who provides the 3rd party software.
|
|
|
|
|
Choices would be
1. Write a lot of code to create a C appender that wrap .Net functionality.
2. Write, or get, a C appender that uses something like TCP. Then set up a .Net server to receive it.
Berlus wrote: since my other programs uses log4net.
Hopefully there is more to it than that.
|
|
|
|
|
In the "INDEX" tab of the explorer,If I look for a function(such like GetDlgItemInt), the explorer always list mobile function( GetDlgItemInt) entry first, I have to switch to platform sdk entry over and over again. It's kind of annoying.
How Can I make the Platform SDK entry topmost or simply eliminate those entries getting in the way?
|
|
|
|
|
1. This has nothing to do with C++.
2. Change the "Refine Search" options in the left hand pane.
|
|
|
|
|
Sorry. There isn't any column fit this kind of problems, but it is a problem related to using VC.
|
|
|
|
|
This is nothing to do with C++/MFC, it is purely to do with your Help settings/options in Visual Studio, which you will need to change.
|
|
|
|
|
These day I install Win7 and I use only in VC6. But I have a weird problem : when I try to use 'Open File' ( Ctrl+O ) , VC6 crush down ... I could open a workspace, but not a file ... why ?
|
|
|
|
|
Flaviu2 wrote: I use only in VC6
Have you applied latest service pack i believe SP6 on VS6.., also try to run in compatibility mode of window XP
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
Also, try running it elevated
|
|
|
|
|
I don't know how ... I use Win7 for few days ...
|
|
|
|
|
First of all, is there a reason that you are using VC6? The environment was built for Win98 and was already slightly dated at the time of WinXP (didn't always function 100%). It might be wise to make the switch to Visual C++ 2010 (Express Edition for home use).
At any rate, if you're stuck with VC6 for a reason, installing the service packs can help increase stability, compatibility and security, so it's a good advice to install them.
To run the studio in elevated mode is a bit bothersome, but can be done by right-clicking the executable or shortcut to the executable and selecting "Run as Administrator".
There is no easy way to run it elevated when you double click a project file from explorer, unfortunately.
I know Visual Studio 2007 even came with the advice to run elevated on Vista/Win7 (along with the advice to upgrade to 2010 to avoid this and other issues), so that's why it's probably useful for VC6 too.
Another thing, try to avoid navigating to Libraries inside VC6 file browse dialogs. I've seen several pre-Win7 applications crash when trying to navigate to a Library (such as the Documents library which includes both the My Documents folder and the Public Documents folder).
Finally, you can try playing around with the Compatibility settings, such as setting its environment to WinXP (or Win98) and seeing if that helps any.
Hope any of this helps. Best advice in this text is: go to a newer version of Visual Studio if you can.
|
|
|
|
|
No, I haven't install any SP ... should I ?
|
|
|
|
|
Hello,
I developed a program to update my aplication. I created the MFC program myApp.exe and Console download.exe.
The download.exe when is running, this update the file "myApp.exe" and de myApp.exe running, this update the file "Download.exe too.
Than, I create the parameter /v to return version program into download.exe
"download.exe /v" return 1.00.
but now, I need the myApp.exe (MFC program) get that return. How to do this?
My idea is compare this version before to update the programa.
regards
André
|
|
|
|
|
Are you using CreateProcess() or ShellExecute() to start download.exe?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Some people are making such thorough preparation for rainy days that they aren't enjoying today's sunshine." - William Feather
|
|
|
|
|
I didnt. I have been using
CreateProcess(
NULL
"cmd /C download.exe"
NULL, // Process handle not inheritable.
NULL, // Thread handle not inheritable.
FALSE, // Set handle inheritance to FALSE.
0, // No creation flags.
NULL, // Use parent's environment block.
NULL, // Use parent's starting directory.
&si, // Pointer to STARTUPINFO structure.
&pi ); // Pointer to PROCESS_INFORMATION structure.
|
|
|
|
|
You can look at the hProcess member of pi and call GetExitCodeProcess() .
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Some people are making such thorough preparation for rainy days that they aren't enjoying today's sunshine." - William Feather
|
|
|
|
|
ok, perfect I have been using this, but I can't getting the return of download.exe /v. I still didn't find the member to do get this return... The member GetExitCodeProcess() return to me if the state of command, but I need the return of executable and not your state.
Example in line prompt, I need to get the '1.00'.
c:\download.exe /v
1.00
c:\
|
|
|
|
|
Is download.exe a console application? If so, its main() function will be returning an int (i.e., 1). That value is available from GetExitCodeProcess() .
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Some people are making such thorough preparation for rainy days that they aren't enjoying today's sunshine." - William Feather
|
|
|
|
|
Now, I understood.
I returned in the main the value of version (version * 1000). And I can to do the MFC to get it with GetExitCodeProcess() and converting the version (version / 1000) to double value.
I forgot that main return int value and I didnt understand that GetExitCodeProcess to get this.
Thanks to explain this.
André
|
|
|
|