|
|
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
|
|
|
|
|
The code will work on i create the classes a1 and b1, but now they wont be created by me, it will be created by others, they only pass in one parameter, like A a1 = new A(1), C c1, B b1 = new B(1), then i should know c1 is shared by a1 and b1. that means b1 will go to find c1.
|
|
|
|
|
Who is designing the 3 classes? you or someone else?
-prakash
|
|
|
|
|
|
So you can very well lay down the rules how to use ur classes, you need to link all 3 classes somehow so that they know which object to use.
The one i showed in the earlier post is one of the methods, there could be other method.
-prakash
|
|
|
|
|
The way I use is a common header. For example, you might have classes A, B and C.
Then the header would be the following (assuming you have separate cpp and h files for each class):
<br />
class A;<br />
class B;<br />
class C;<br />
#include "A.h"<br />
#include "B.h"<br />
#include "C.h"<br />
Then you just #include this common header in each class' header and voila! And yes - don't forget to remove other includes of A, B and C in these class headers.
Works fine for me.
|
|
|
|
|
|
Sounds like you might need a factory.
class factory {
factory(int num, a *A, b *B) {
A =new a(num);
B = new b(num, a,C);
}
};
class a {
private: // THIS IS IMPORTANT!
a(...)
friend class factory
class C;
...
}
class b {
private: // AGAIN, IMPORTANT
b(...)
...
}
Note that I skiped some details, that you will need to take care of, but this should give the idea.
It occurs to me that you could do this differently with a static vector. I don't use the STL (I have to support a compiler that doesn't support modern C++), but something like this instead:
class Cfactory {
private:
static STL::vector<class c=""> Cs; // I'm not sure about this syntax! The static is critical to this though
static getSharedC(num) {
c *C;
if((C = Cs[num]) == NULL) {
C = new c(num);
Cs.add(num,C);
}
return C;
}
};
Again, I left out a lot of details, and I'm not even sure how the vector class works, but you should be able to make it work.
The last has two major problems! The first is easy to work around, but the second could be a show-stopper.
First, you need something to prevent memory leaks. Reference counting is easiest (that I know of, maybe a smart pointer would work?), something needs to make sure that c1 goes away only after both a1 and b1 is deleted.
Second, this gives you global context for all c1. You can't have different two parts of the code creating their own a1, because even though the a1 class is different, those two instance share the same c1! You need to figure out how to deal with this. I can't think of anything that I'd really trust.
|
|
|
|
|
How to list the program hooking windows?
ex: language bar in win 2000,XP, the anti virus program...
Thanks!!!
[VC++ or Delphi]
Help me, please! Thank you very much
Mail: lekhacnhu@gmail.com
|
|
|
|
|
I have a function that performs some drawing according to the bitdepth of the screen. The function is called in a loop continuously. The problem is, after a while it crashes. I have narrowed it down the problem to the HDC not being released. How can i release it?
void Plot()
{
//Obtain current screen depth
HDC hdc = ::GetDC(NULL);
int screendepth=GetDeviceCaps(hdc, BITSPIXEL);
//do something here according to the current bitdepth
//how to release here?
}
|
|
|
|
|
From the MSDN documentation on the GetDC function
After painting with a common DC, the ReleaseDC function must be called to release the DC. Class and private DCs do
not have to be released. ReleaseDC must be called from the same thread that called GetDC. The number of DCs is
limited only by available memory.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it!
|
|
|
|