|
Search for BHO on CP
Thanks
|
|
|
|
|
Search for BHO on CP
Thanks
|
|
|
|
|
hai !
i am facing a pbm in c++ . How can i prevent from inheritance of my class..
example:
class a
{
}
class b:public a
{
}
i want to prevent a from b not inherit like in java final keyword....
|
|
|
|
|
Switch to java
can't do it in C++
-prakash
|
|
|
|
|
can we check in base class constructor with this pointer which class is inveoked with this we can prevent from inheritance
sai
|
|
|
|
|
virtualkirankumar wrote:
can we check in base class constructor with this pointer which class is inveoked with this we can prevent from inheritance
sai
or make all members private. but i dont understand the your intention.
If the user cannot inherite ur class, then the user can certainly write a wrapper over ur class, which you cant prevent.
My suggestion,
be constructive on the class logic. if you are worried about ppl using ur class, just stick a copy right notice on the top.
-prakash
|
|
|
|
|
As Prakash says, there is no keyword for this. But there is a method for getting the same kind of encapsulation.
First you declare the interface for you class in a cpp file, then you declare an implementing class in a header file.
Here's a small example:
The header file dclares the interface Public, and a function that creates an instance:
<span style="color: green;">
<span style="color: blue;">#ifndef</span> _TESTER_H_
<span style="color: blue;">#define</span> _TESTER_H_
<br> <br>
<span style="color: green;">
<span style="color: blue;">class</span> Public
{
<span style="color: blue;">public</span>:
<span style="color: blue;">virtual int</span> GetX() = 0;
};
<br> <br>
<span style="color: green;">
Public * CreatePublic(<span style="color: blue;">int</span> x);
<br> <br>
<span style="color: blue;">#endif</span> // _TESTER_H_
The cpp file declares the implementing class Private:
<span style="color: green;">
<span style="color: blue;">#include</span> "tester.h"
<br> <br>
<span style="color: green;">
<span style="color: blue;">class</span> Private: <span style="color: blue;">public</span> Public
{
<span style="color: blue;">public</span>:
Private(<span style="color: blue;">int</span> x): m_x(x)
{
}
<br> <br>
<span style="color: blue;">int</span> GetX()
{
return m_x;
}
<br> <br>
<span style="color: blue;">private</span>:
<span style="color: blue;">int</span> m_x;
};
<br> <br>
Public * CreatePublic(<span style="color: blue;">int</span> x)
{
return new Private(x);
}
Here's how to use it:
<span style="color: blue;">#include</span> "tester.h"
<br> <br>
<span style="color: blue;">int</span> main()
{
<span style="color: green;">
<span style="color: green;">
<br> <br>
Public * pPub = CreatePublic(42);
<span style="color: blue;">delete</span> pPub;
<br> <br>
<span style="color: blue;">return</span> 0;
}
The funny thing is, that while the Java keyword final optimizes the code by removing the need for a vtable, this C++ technique adds an overlay by creating a vtable.
"After all it's just text at the end of the day. - Colin Davies
"For example, when a VB programmer comes to my house, they may say 'does your pool need cleaning, sir ?' " - Christian Graus
|
|
|
|
|
|
Hi!
I'm using the great COptionTree (http://www.codeproject.com/treectrl/coptiontree.asp)
So far no problems, but then I tried to combine it with a "Sidebanner" (http://www.kinkycode.com/?section=cppdev&sub=kcsidebannerwnd)....in order to have a small image on top of my dialog..
But now i have the problem, that the optiontree "moves under" the bannerimage...
Now here my question..how can i set that the y-position of the optiontree "moves" 40 pixels downwards..?
I think the OnSize function is responsable for my problem..so here the code which i have in my dialog..:
Isn't it possible to just move the OptionTree 40 pixels downwards??
Perhaps somebody can tell me the code, i have to add
void CPrefsDlg::OnSize(UINT nType, int cx, int cy)
{
// Resize the control
if ((cx > 0) && (cy > 0))
{
if (::IsWindow(m_otTree.GetSafeHwnd()))
{
m_otTree.MoveWindow(0, 0, cx, cy);
}
}
CPropertyPage::OnSize(nType, cx, cy);
}code>
mfg
|
|
|
|
|
if you post this question at http://www.codeproject.com/treectrl/coptiontree.asp[^] forum, maybe the author would be in a better position to help you out.
-prakash
|
|
|
|
|
|
aman-ul-haq wrote:
HI!
i am trying to avoid copying files and directories in windows. i want to design a spy application that does not allow me to select edit menu from windows explorer so that i may not select copy & Cut options. Can anybody plz help me in that.
I dont think its a good idea, how would you block a person issuing copy commands from the dos shell.
if at all you still want to do it, you need to write a filesystem device driver for that.
-prakash
|
|
|
|
|
Strictly saying, it's not a spy program, rather an admin tool.
But I can't think of any way to do it but messing with the explorer window ("disabling" menu items and toolbar buttons etc). However, any 3rd party software will still be able to copy anything...
|
|
|
|
|
I tried the function InternetDial, so how to point automatically in the internet call dialog my default connection?? And another question, how to handle the connected and disconnected status of my connection? I've red about call back function, but can't understand how to use it, are any examples in the internet?
|
|
|
|
|
Does anyone of you know how to develop a tool like tcpview(by sysinternals.com)? My requirement is to not just listing (as in TCPview) but to monitor and end a process before it actually starts. For example, i want to filter all applications passing through port 80 except Internet Explorer. so if some clicks any pdf file on Internet, he will not be allowed to do so? how do i proceed? i m really clueless and need some ideas.
Thanking u,
|
|
|
|
|
how can i get network ip address or
com port address(device)or
another computer which have entire network.
|
|
|
|
|
vc-programmer- wrote:
how can i get network ip address...
To get the IP address of a machine, use gethostbyname() .
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
in win32 console application you need to include windows.h and provide kernel32.lib to the linker.
-prakash
|
|
|
|
|
Friends,
I am using "Bounds Checker" for the first time. It detected cretain flaws in my code e.g buffer overruns, leaks e.t.c. I solved all these problems. Now it is not showing any problem in my code.
But the problem is that, on exiting, it detects too many memory leaks in MSVCRT71.dll . Do i need to worry about these leaks ??
Also please tell me that i am using VC 6.0, and Bounds Checker is showing me that the run time dll is MSVCRT71.dll. I think MSVCRT71.dll is a part of VC 7.0 that is also installed in my machine. Is my program of VC 6.0 using correct runtime library ??
Imtiaz
|
|
|
|
|
Hai!
i hope u may use the mfc class CMemoryState class .. u create object of that class later u call before function call which u have to check the memroy leaks after that u call another object of that class now u call this object function after function call later u compare these two objects u can find the memory leaks easily...
kiran.s
|
|
|
|
|
Hai!
i hope u may use the mfc class CMemoryState class .. u create object of that class later u call before function call which u have to check the memroy leaks after that u call another object of that class now u call this object function after function call later u compare these two objects u can find the memory leaks easily...
kiran.s
|
|
|
|
|
But the problem is that, on exiting, it detects too many memory leaks in MSVCRT71.dll. Do i need to worry about these leaks ??
Don't worry about it !
Also please tell me that i am using VC 6.0, and Bounds Checker is showing me that the run time dll is MSVCRT71.dll. I think MSVCRT71.dll is a part of VC 7.0 that is also installed in my machine. Is my program of VC 6.0 using correct runtime library ??
Might be some cross link, don't worry about it !
If your application is some dll, then you should use dependency viewer of VS6, just to track dependency of ur application on several dll's. Check whether "MSVCRT71.dll" is there ?
Regards,
Vishal
|
|
|
|
|
That depends. Not all "leaks" are detected correctly, it has happened where a bound checker has found a leak that wasn't a problem. (I don't know about yours in particular, though. I'd start with the assumption that you should worry)
There are two possibilities. First, MSVCRT71.dll might be programed incorrectly, and therefore there is nothing you can do other than upgrade to a newer version if one exists. Odds are strongly against this case, but it has happened, so if you get nowhere you might want to check into it.
More likley is that you are using the library incorrectly. Read the documentaiton for all the functions you use. Look for the little line that says something like "allocates a foo resource which the caller must free when done by a call to freefoo()". Your bounds checker might give you a clue where to look first, but sometimes you just have to read the documentation for every function, and then check each time you use it.
|
|
|
|
|
now i have something as following:
A a* = new A();
B b* = new B();
there is a class C created in the constructor of A, but i want the b class also can use this C class. for example:
A a1* = new A(); //c class will be created (we call it c1 for differencial)
A a2* = new A(); //c class will be created (we call it c2 for differencial)
B b1* = new B(); // I want b1 share the c1 with a1, but not use c2
B b2* = new B(); // I want b2 share the c2 with a2, but not use c1
Is there anyway i can do this?
Thanks a lot in advance.
|
|
|
|
|
Class A<br />
{<br />
private:<br />
C *c1;<br />
public:<br />
c1* GetThatClass()<br />
{ <br />
return c1 <br />
};<br />
}<br />
<br />
Class B<br />
{<br />
private:<br />
A *a;<br />
C *c;<br />
Public:<br />
StoreThat(Class *a1)<br />
{<br />
a = a1;<br />
}<br />
<br />
Somefunction()<br />
{<br />
c = a->GetThatClass();<br />
c->CallMethod();<br />
}<br />
}
Something on this line.
-prakash
|
|
|
|