|
Is this a control that you have written?
If so, when you hit F5, devstudio will ask you what app that you want to debug in, choose the ActiveX Control Test Container.
After you do that then you will need to create a new object that is your object. Once you create your object, you eill be able to set break points in the debugger.
Then there are settings that you can change in the ActiveX control test container in order to invoke all of the member functions of your object.
|
|
|
|
|
Thanks,I got the point
Mazy
"So,so you think you can tell,
Heaven from Hell,
Blue skies from pain,...
How I wish,how I wish you were here." Wish You Were Here-Pink Floyd-1975
|
|
|
|
|
Hi,
I'm just starting out on VC++. I'm trying to get my head around the SDI. I know that the CView derived class is meant to be where the display is. How do I make the CView a dialog? For the dialog exe generated from the wizard, there is a nice gui to drag and drop controls. Where is this for the SDI?
a simple sample that shows how a control (eg. text box?) can be added to CView would be great!
|
|
|
|
|
|
Can anyone elaborate or give me an example to download?
|
|
|
|
|
Ahh.. got it there is a drop down box in the wizard. Damn this architecture is so confusing. Is there any where online that teaches you this without wizards? I want to know what the heck these wizards generate and how i can do it myself so I can get a better understanding.
|
|
|
|
|
I am still wondered by seeing some email utility senting spam
that hides the IP address using a proxy server
example
http://mailinglistmaster.com/index.cfm?action=proxylist
anybody have any idea what thay doing or which protocol they using?
anyway i am montitoring the TCP/IP events
i am not interested in writing a spam utility
but just curious,so help me if u can
hirosh
|
|
|
|
|
I want to do:
I can STOP the operation when a user delete some files or folders in a Win9x/Me/NT/2000 System.
How I do it? (xia0830@cmmail.com)
|
|
|
|
|
Write a copy hook extension. It will get called before every copy/move/delete operation, and you can cancel the operation or let it proceed.
--Mike--
"There are three things I can never remember, 1: um... 2: um... 3: um..."
-- Victor Borge
My really out-of-date homepage
Sonork - 100.10414 AcidHelm
Big fan of Alyson Hannigan and Jamie Salé.
|
|
|
|
|
I can do for folders.
But, for files?
May you give me some codes?
E-Mail: xia0830@cmmail.com
lx130@sina.com
Thanks!
|
|
|
|
|
hello
i want to know,
1)how to create User DSN in ODBC
2)& how to register .ocx file through install shield for vc++ 6
regards
Chanda.com
|
|
|
|
|
Chanda.com wrote:
how to register .ocx file through install shield for vc++ 6
Mostly they are "self-register",you have to only check that
ocx as self register in your installshield
Chanda.com wrote:
how to create User DSN in ODBC
Check SQLCreateDataSource
Mazy
"So,so you think you can tell,
Heaven from Hell,
Blue skies from pain,...
How I wish,how I wish you were here." Wish You Were Here-Pink Floyd-1975
|
|
|
|
|
class string {
public:
string(const char *value);
~string();
private:
char *data;
};
string::string(const char *value)
{
if (value) {
data = new char[strlen(value) + 1];
strcpy(data, value);
}
else {
data = new char[1];
*data = '\0';
}
}
inline string::~string() { delete [] data; }
void donothing1(string localstring) {}
void donothing2(string& localstring) {}
main()
{
string s1 = "the truth is out there";
donothing1(s1);
string s2 = "the truth is out there, too";
donothing1(s2);
}
I'm amumu, and you?
|
|
|
|
|
By calling:
<br />
string s1 = "the truth is out there";<br />
you are first invoking the default constructor of the string class, which you have not defined, so string::data is also undefined.
Next the operator= is invoked to assign "the truth is out there" to your object. This function is also undefined, therefore the default implementation is used and it will copy the pointer value that you sent in straight across. This is called a shallow copy, and it is generally bad.
If you want the code that you wrote to work, with out worrying about the shallow copy problem, you could make this change to the way that you invoke your objects:
<br />
string s1("the truth is out there";<br />
This will invoke the constructor that you have defined.
If you are going to have dynamically allocated data in any class, you should define these four functions, that will be automatically provided by the compiler if you do not choose to implement them yourself:
Default Constructor
string()
{
data = NULL;
}
Destructor
string()
{
delete[] data;
data = NULL;
}
Copy Constructor
string(const string& rhs)
{
if (rhs.data)
{
UINT nLen = strlen(rhs.data);
data = new char[nLen+1];
strcpy(data, rhs.data);
}
else
{
data = NULL;
}
}
Finally...
Assignment operator
string &operator=(const string& rhs)
{
if (this == &rhs)
{
return *this;
}
delete[] data;
if (rhs.data)
{
UINT nLen = strlen(rhs.data);
data = new char[nLen+1];
strcpy(data, rhs.data);
}
else
{
data = NULL;
}
return *this;
}
I have included a basic implementation of how it is done in order to set you onto the right track.
|
|
|
|
|
This is a technicality, but it might be worth mentioning:
string s1 = "the truth is out there"; You said that this sentence involves the default ctor and the assignment operation. In fact, none of these two is called here. The sequence is:- A temporary object is constructed from
"the truth is out there" using string::string(const char *) .
s1 is constructed from this temporary object using the copy ctor. The compiler is allowed to optimize away the temporary and the call to the copy ctor, as in fact VC++ does*. So, for our particular scenario, only string::string(const char *) is involved in the sentence.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
* The thing is rather complicated: for the optimization to be allowed it is necessary that the copy ctor be accesible (i.e. not private ). VC++, however, only conforms to this rule if MS proprietary extensions to the language are disabled (/Za).
|
|
|
|
|
Because string has no copy constructor, when the donothing1 invoked, compiler will create a temporary object, and invoke the default copy contructor, so, the temporary object will copy the point "data" from localstring, and when the donothing1 is finished, the temporary object will destoried, and the infomation stored in "data" will lost. That's the problem I read from <<effective c++="">>, but what happen when invoke donothing2 function?
I'm amumu, and you?
|
|
|
|
|
I just looked at your code from earlier, you have not invoked the donothing2 function.
qf0421 wrote:
<br />
main()<br />
{<br />
string s1 = "the truth is out there";<br />
<br />
donothing1(s1);<br />
<br />
string s2 = "the truth is out there, too";<br />
<br />
donothing1(s2);<br />
<br />
}<br />
|
|
|
|
|
As donothing2 accepts a reference, there's no copying involved in the calling process, and no problem as those posed by the first function will arise. If you think of a reference (in this context) as an alias for a pointer you'll see more clearly the differences between donothing1 and donothing2 .
Nevertheless, it is very much advisable to explictly write the "gang of four" (default ctor, copy ctor, assignment operator and dtor) for every class wihtout trivial semantics and not leave these holes to the interpretation and good sense of the user.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Joaquín M López Muñoz wrote:
A temporary object is constructed from "the truth is out there" using string::string(const char *).
s1 is constructed from this temporary object using the copy ctor.
That is incorrect. The following two lines are exactly the same:
string s1 = "the truth is out there";
string s1 ("the truth is out there"); They both call the one-parameter constructor.
--Mike--
"There are three things I can never remember, 1: um... 2: um... 3: um..."
-- Victor Borge
My really out-of-date homepage
Sonork - 100.10414 AcidHelm
Big fan of Alyson Hannigan and Jamie Salé.
|
|
|
|
|
That is incorrect. The following two lines are exactly the same
No they are not. My post explains it in pretty much detail.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
*shrug* Try it yourself. 'string s = "abc"' has nothing to do with the copy constructor or the = operator.
--Mike--
"There are three things I can never remember, 1: um... 2: um... 3: um..."
-- Victor Borge
My really out-of-date homepage
Sonork - 100.10414 AcidHelm
Big fan of Alyson Hannigan and Jamie Salé.
|
|
|
|
|
I did! Try the following (please bare with typos, I'm writing this without IDE support):
class A
{
public:
A(const char *)
{
}
private:
A(const A&);
};
int main()
{
A a="hello";
return 0;
} Under default settings, whis will compile fine and actually only A::A(const char*) is being invoked. However, if you set the /Za flag (disable MS proprietary extensions to C++), then an error pops up complaining that the copy ctor is not accessible and thus, by the rules of C++, optimizing it away is not legal. This is called elided copy constructor, and there's a paragraph in the standard dealing with the issue. Also Stroustrup in The C++ Programming Language, Special Edition states the sequence of calls for an expression of a form analogous to this in an example. If you're interested I could try to locate the exact paragraph for you.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
kilowatt wrote:
By calling:
string s1 = "the truth is out there";
you are first invoking the default constructor
That is incorrect. The following two lines are exactly the same:
string s1 = "the truth is out there";
string s1 ("the truth is out there"); They both call the one-parameter constructor.
--Mike--
"There are three things I can never remember, 1: um... 2: um... 3: um..."
-- Victor Borge
My really out-of-date homepage
Sonork - 100.10414 AcidHelm
Big fan of Alyson Hannigan and Jamie Salé.
|
|
|
|
|
Not exactly. If you like C++ standard subtleties, please take a look at my post above.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
What message should my app handle when user shutdown/logoff the system?
thanx
|
|
|
|