Ra

Members
  • Content count

    3040
  • Joined

  • Last visited

Community Reputation

1062 Excellent

About Ra

  • Rank
    Contributor
  1. .h vs .hpp

    I use .cxx and .hxx because it makes me feel cool. I also use .inl for headers that contain function definitions which I was too lazy to stick in a source file.
  2. OH TEH NOS!

    no moar foot pix ploxx. :(
  3. Crazy E-mail .. what to do

    Just ignore it. I'm sure you have better things to do. And if you don't, well... find some.
  4. Where is a good place to meet people?

    Quote:American History X Bob Sweeney: There was a moment... when I used to blame everything and everyone... for all the pain and suffering and vile things that happened to me, that I saw happen to my people. Used to blame everybody. Blamed white people, blamed society, blamed God. I didn't get no answers 'cause I was asking the wrong questions. You have to ask the right questions. Derek Vinyard: Like what? Bob Sweeney: Has anything you've done made your life better?
  5. trouble with CreateProcess

    Quote:Original post by Evil Steve Quote:Original post by MJP Quote:Original post by Evil Steve try..catch blocks only catch C++ exceptions, not exceptions thrown by the OS/CPU (I'm not sure which is responsible for it). To catch those sort of exceptions you need to use Structured Exception handling (SEH). Just to add to this...you almost never want to catch an SEH exception. It's rarely something you can recover from, so your best course of action is just let it crash. Once it crashes you can look at the exception code to decipher what the problem was (Visual Studio will tell you...in this case it was an access violation which means the program code attempted to read from an illegal area of memory) and you can look at the call stack to see where it came from. In this case the access violation makes perfect sense, as CreateProcess will follow the pointer you give it and attempt to modify the memory there...however you can't modify a string literal.And to expand on that - the documentation says somewhere (I can't be bothered to find out where, sorry) that if you get an access violation, there's almost nothing you can safely do to recover from it, since the application is in an indeterminate state. The only real thing you could do is try to write out a crash log or display a message to the user; but even that isn't guaranteed to work. If you got the access violation from accessing a dud pointer for instance, the heap could be completely broken, in which case doing any memory allocation at all will cause another access violation. If you want to write a crash dump the proper place to do it is inside your own UnhandledExceptionFilter(). This function should never return EXCEPTION_EXECUTE_HANDLER to execute finally and catch handlers because this opens your process up to some arbitrary code execution vulnerabilities (all an attacker has to do is overflow a buffer and overwrite code that gets called from an object's destructor, which is cake with virtual destructors.) So in general it's a very bad idea to catch exception that you can't handle, and, worst case, this can lead to some serious security holes in your program. (And if you want to write a crash dump in the event of an unhandled exception, use SetUnhandledExceptionFilter() (make sure it doesn't return EXCEPTION_EXECUTE_HANDLER!), not __try { ... } __except(EXCEPTION_EXECUTE_HANDLER) { /* dump code */ }, because this will run your destructors and lead to very bad things.)
  6. Picking a Language at GDWiki may be of interest.
  7. Quote:Original post by Kincaid Could you be more precise? I am currently not receiving the WM_COMMAND in the window proc. (cause the lv is the parent, and not the window. So the lv receives the WM_COMMAND, but it then gets stuck, while it should proceed one parent higher, the window, right?) No. Only the ListView will receive the message. You need to subclass the ListView in order to handle it. This means you replace the ListView's WndProc with a WndProc you provide, enabling you to intercept its messages.
  8. Buttons send a WM_COMMAND message with BN_CLICKED to their parent window when they are clicked. You'll need to subclass the ListView (the buttons' parent window) in order to handle these. [Edited by - Ra on August 6, 2008 1:15:57 AM]
  9. Timer function (c++)

    timeGetTime() should work fine. You probably forgot to link in winmm.lib (see requirements at the bottom), which exports that function.
  10. You can write conversion operators for your class to allow it to be implicitly converted to either vector type. class MyVector {     ...     operator physVector() const     {         return physVector(...);     }     operator graphicsVector() const     {         return graphicsVector(...);     } }; If your class has binary compatibility with either of these vector types you could potentially return by-ref rather than by-value from the conversion operators and reinterpret_cast as necessary, but that's treading into dangerous territory.
  11. Editing EXE Resources

    Pretty much. Win32 resources are intended as an organized way to store static information (resources) that the program uses. Settings and other things that change at runtime should be stored in an external configuration file.
  12. MSDN The 3rd parameter is a pointer to an int containing the length of the struct you're passing in the second parameter. When accept() returns it stores the length of the returned address in that variable. struct sockaddr_in sin; int size = sizeof(struct sockaddr_in); accept(server, (sockaddr *)&sin, &size);
  13. HASHTABLES

    std::tr1::unordered_map is a hashtable, and is available in the VC 2008 Feature Pack (need standard or higher to install, unfortunately.) stdext::hash_map should be available in MSVC 2005 and 2008, but is non-standard (#include <hash_map>.) You can also use boost::multi_index_container with a single index as a hashtable.