Killing a "Critical Process" In Windows (C/C++)
What is the best way to kill a critical process? ...
What is the best way to kill a critical process? ...
The g++ compiler complains with this error when I declare a friend thusly: friend MyClass; instead of friend class MyClass; Why should the class keyword be required? (the Borland C++ compiler, BTW, does not require it.) Couldn't the compiler simply look-up MyClass in the symbol table and tell it was declared as a class? (it is ob...
I'm making a dll that has to respond to an application's requests. One of the application's requirements is that a call should not take long to complete. Say, I have a function foo(), which is called by the host application: int foo(arg){ // some code i need to execute, say, LengthyRoutine(); return 0; } Lets say, foo has to perform ...
Hello, I have simple base and derived class that I want both have shared_from_this(). This simple solution: class foo : public enable_shared_from_this<foo> { void foo_do_it() { cout<<"foo::do_it\n"; } public: virtual function<void()> get_callback() { return boost::bind(&foo::foo_do_it,shared_from_this()); } virtual ~foo() {}...
I'm compiling my application on a new box (vista 64) and now it doesn't compile anymore. The compiler gives me the error in the title. The problem seems(?) to be that HWINEVENTHOOK is defined twice in windef.h #if(WINVER >= 0x0400) DECLARE_HANDLE(HWINEVENTHOOK); #endif /* WINVER >= 0x0400 */ and then in winable.h it's #if WINVER < ...
Is there any way for a C++ programmer with 1,5 years of experience to have no idea that null-terminated strings exist as a concept and are widely used in a variety of applications? Is this a sign that he is potentially a bad hire? ...
I'm writing a game, and I want to model its different states (the Game Maker analogy would be frames, I guess) in a clean, object-oriented way. Previously, I've done it in the following way: class Game { enum AppStates { APP_STARTING, APP_TITLE, APP_NEWGAME, APP_NEWLEVEL, APP_PLAYING, APP_PAUSED, APP_ENDE...
I recently took a class at school where we had to learn Scheme to build a parser for a simple made up scheme-like language. As the semester went on, we added to our parser to make it more and more interesting. Since then, on my own time, I've started writing my own parser that's quite a bit neater than what I did in class, but it parses...
Is where any C++ compiler that supports C++0x features already? ...
While compiling this morning I had a thgought. Given a dedicated Linux machine (running Fedora for example), users remotely log in and compile (using gcc) their c++ software, which is stored on their own machines (on a small LAN), linked with symbolic links, to the Linux box. Assume that each user is compiling exaclty the same code fo...
I want to add a breakpoint condition to my code in VC++ Express 2005, so that the breakpoint only triggers if a local variable meets a specified criteria. e.g. bool my_test(UIDList test_list) { foo(test_list); bar(test_list); // I have a breakpoint here, but only want it to trigger if test_list.Length() > 0 print(test_list);...
What does the tbb::scalable_allocator in Intel Threading Building Blocks actually do under the hood ? It can certainly be effective. I've just used it to take 25% off an apps' execution time (and see an increase in CPU utilization from ~200% to 350% on a 4-core system) by changing a single std::vector<T> to std::vector<T,tbb::scalable_...
What's the difference between File (File* pointer)stream in C and iostream in C++? Why are they both called stream, do they have something in common? ...
I have a Message class which parses text messages using lookup tables. I receive a lot of messages and create and destroy a lot of objects so I thought I declare those lookup tables as static members to prevent initializing the same tables with the same values again and again. Is it the correct approach or there's more appropriate C++ w...
Hi, I came across this code: void f(const std::string &s); And then a call: f( *((std::string*)NULL) ); And I was wondering what others think of this construction, it is used to signal that function f() should use some default value (which it computes) instead of some user provided value. I am not sure what to think of it, it loo...
I have this error like at service windows, this occurs one time a week or more: Application popup: application_name - Application Error : The instruction at memory_location referenced memory at memory_location. The memory could not be "read". production environment; multi-thread app; each thread performs a task; source is C++, VC8; ha...
Hi, I am using expat parser to parse an XML file of around 15 GB . The problem is it throws an "Out of Memory" error and the program aborts . I want to know has any body faced a similar issue with the expat parser or is it a known bug and has been rectified in later versions ? ...
I have a large amount of code for an MFC/ATL program that I would like to use in a windows form appllication. What is the easiest way to "convert" this code so that it compiles with /clr enabled and finds the basic classes, e.g. CObject, CString, CFile and the templates? ...
After reading some tutorials I came to the conclusion that one should always use pointers for objects. But I have also seen a few exceptions while reading some QT tutorials (http://zetcode.com/tutorials/qt4tutorial/painting/) where QPaint object is created on the stack. So now I am confused. When should I use pointers? ...
I have a custom WTL control which is a panel with a list and a custom scroll bar. class Panel : public ATL::CWindowImpl<Panel>, public WTL::CDoubleBufferImpl<Panel> { public: DECLARE_WND_CLASS("Panel") BEGIN_MSG_MAP_EX(Panel) MSG_WM_CREATE(OnCreate) MSG_WM_DESTROY(OnDestroy) MSG_WM_SIZE(OnSize) CHAIN_MSG_MAP...