|
Hello,
I'm working on a parser class. This class is recursively parsing the data, which means you can have nested elements (like an XML file).
Here is some of the code:
<br />
class CElement<br />
{<br />
private:<br />
std::list<CElement> m_lstChildren;<br />
};<br />
This code wont compile because of the following error:
<include dir> : error C2079: '_Value' uses undefined class 'CElement'
<project dir> : see reference to class template instantiation 'std::list<class CElement,class std::allocator<class CElement> >' being compiled
I guess that the class is not completely know to the compiler at the time it wants to compile the template. So I added a prototype declaration at the beginning of the header file, no luck.
I searched some FAQ's, no answer found. I hope that someone can help me out here.
Is it even possible what I'm trying to achieve?
Thanks in advance.
Multiply it by infinity and take it beyond eternity and you'll still have no idea about what I'm talking about.
|
|
|
|
|
A class can't contain an instance of itself, because that would result in infinite recursion. Or, in your case, sizeof(CElement) isn't known at the point where you refer to it in the list template parameter. You can use a std::list<CElement*> though.
--Mike--
Personal stuff:: Ericahist | Homepage
Shareware stuff:: 1ClickPicGrabber | RightClick-Encrypt
CP stuff:: CP SearchBar v2.0.2 | C++ Forum FAQ
----
"How does one know if one's aura is dirty? Does someone come along with their finger and write 'wash me' on it?"
-- Buffy
"Linux is good. It can do no wrong. It is open source so must be right. It has penguins. I want to eat your brain."
-- Paul Watson, Linux Zombie
|
|
|
|
|
Thanks, this is what I was afraid of. Anyway, it'll have to do...
Multiply it by infinity and take it beyond eternity and you'll still have no idea about what I'm talking about.
|
|
|
|
|
Hello guys,
someone is trying to intercept some dialog box of my application to modify its behaviour once the application is running and the dialog box opened (he doesn't have the source code of the application).
I need to prevent him to do this, could someone give me some hint on how to do it?
Thanx,
Fabio
|
|
|
|
|
This code is probably injecting a dll into your process. There are a number of ways they could be doing this.
You could try this.
Once you have built your app open the exe in Dependancy Viewer. Get a list of all the DLL's referenced by your app.
In your code you can use EnumProcessModules() and GetModuleFileName() to see what dlls have been loaded into your process. You can then determine if there is a dll loaded that you dont recognise. Im not sure if you can unload the problem dll by calling FreeLibrary() or not.
If I was in your situation I would try to get a copy of the software that is causing the problem and attempt to reverse engineer it to the point where you understand what it is doing. Then you will have a better chance of designing code to defeat it.
|
|
|
|
|
Thanx Josh...
I think they are hooking on my EXE only at a certain moment, and not since the beginning.
Is it possible to intercept the OnInitDialog message of a dialog box with an ActiveX and take the control over it? I think this is the type of attack... And in this case the dll is not part of my process, right?
About trying to get the soft causing the problem: impossible. I just have to guess and do the strongest protection possible.
I'm gonna try a sample attack program to test your protection method.
Thanx
Fabio
|
|
|
|
|
Hello,
Can someone give me some explanations how C++ actually doing the type casting? Is a Dynamic Cast really expensive? What about Static Cast, Constant Cast and Interrupter Cast? Thanks!
Nachi
|
|
|
|
|
The authoratative source on all things performance in C++ is:
C++ Standards Committee Performance TR[^]
From the performance TR:
const_cast<Type>(expression) // §IS-5.2.11
static_cast<Type>(expression) // §IS-5.2.9
reinterpret_cast<Type>(expression) // §IS-5.2.10
dynamic_cast<Type>(expression) // §IS-5.2.7
The first three forms of type conversion operator have no size or speed penalty versus the equivalent cast notation. Indeed, it is typical for a compiler to transform cast notation into one of the other type conversion operators when generating object code. However, dynamic_cast<t> may incur some overhead at run-time if the required conversion involves using RTTI mechanisms such as cross-casting (§2.3.8).
The report goes on to give examples of how dynamic cast costs are dependant on the types you are casting to and from. If you believe casting to be an issue profile your application and compare the cost of the cast to the rest of the application.
Casting is not likely to be significant performance cost in the bigger picture unless you do it very often - in which case the design may require refactoring. There are however, two conflicting opinions on the use of dynamic casts. One is that it is best to avoid dynamic casting where possible through the use of the visitor pattern (Design Patterns - Gamma, Helm et al.), and the other is that the use of dynamic_casts elminates the need for large ammounts of code that the visitor pattern requires.
Nish's Excellant article on Casting Basics[^]
If you can keep you head when all about you
Are losing theirs and blaming it on you;
If you can dream - and not make dreams your master;
If you can think - and not make thoughts your aim;
Yours is the Earth and everything that's in it.
Rudyard Kipling
|
|
|
|
|
Hi Everybody,
How r u all. I would like to know is there any way to search and Image inside a bitmap. If you kow please tell me any effective way or algorithm you follow.
Thanks in Advance.
If you have faith in cause and
the means and in gos, the hot
Sun will be cool for you.
|
|
|
|
|
If you know the byte-pattern (e.g., colors, palettes) that the image is comprised of, I don't see why not.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
I think he didn't mean an easy computer-generated bitmap. Image detection is not easy. There are very complicated math algorithms about that. I've read a book about that.. although it has been a long time ago I think there was a way doing it by using the FFT algorithm in a special way, but I'm not sure about that anymore. You could google for "digital image processing".
Don't try it, just do it!
|
|
|
|
|
I need help. I want to extract the ISO file to the local harddrive. Is there an sample code or some sample written in VC++ 6.0 or C#, which I can take a look. Please help.
Thank You
Regards,
ntuyen01
|
|
|
|
|
ntuyen01 wrote:
...the ISO file...
Ok, get me up to speed here. What is the ISO file?
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
DavidCrow wrote:
What is the iso file?
Bun of files compress to a single file to make the CD image.
Example: testing.iso
If someone gave me an testing.iso from the CD want to extract it out to the local disk.
Thank You
Regards,
ntuyen01
|
|
|
|
|
Does knowing the format of an ISO file help?
http://www.wotsit.org/download.asp?f=iso9660
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
The format of an ISO is iso9660
Thanks
Thank You
Regards,
ntuyen01
|
|
|
|
|
Right. Did I indicate otherwise?
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Would you please tell me what do you mean?
Thank You
Regards,
ntuyen01
|
|
|
|
|
You wanted to know how to extract the contents of an ISO file. I simply provided you with a link to the ISO file format. Usually when one knows the format of a file, they can start to put code together that will operate on said file.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Why that difficult? Code an easy CD emulator (that is a thing of lets say 2 hours) and use the windows file system driver (cdfs) for mounting the image and reading it via the normal file management API.
Don't try it, just do it!
|
|
|
|
|
If that'll work, great! I've never dealt with CD-type files so I was just taking a SWAG.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
well you can look at linux and *BSD source code to see how they read it from CDs. C, but might be useful. I don't know if it is easier to start from scratch or not, but you might try write a wrapper for their code.
http://www.freebsd.org/
|
|
|
|
|
What do I need to look at the http://www.freebsd.org/?
Thank You
Regards,
ntuyen01
|
|
|
|
|
|
I'm writing a program which needs to get the mouse capture in order to be able to select a part of the screen. I've tried this using GetCapture, but that doesn't work, because at the moment I start dragging at a point that is not in the my app's window, the capture is lost and the window at that point is activated.
Is there some way to prevent this loss of capture AND focus?
|
|
|
|