Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
S

sysop HAL9K com

@sysop HAL9K com
About
Posts
10
Topics
6
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Creating shortcuts in Windows CE?
    S sysop HAL9K com

    How can I create a shortcut for an EXE file in Windows CE? It doesn't seem to have all that DCOM stuff available? thanks

    Mobile question

  • Creating shortcuts
    S sysop HAL9K com

    What are the #include's needed for this code? I'm compiling for Win32 and I haven't been able to figure out the right combination of files thanks

    C / C++ / MFC help tutorial question

  • floating point error handler - how do I get a workable stackframe?
    S sysop HAL9K com

    Dear folks, We have a perfectly good FP error handler on VC7.1, VC8 and so on. However, none of the stack is visible if we set a breakpoint inside the FP handler. So basically we have no idea where the offending code is that is causing the FP error to fire. Any ideas on how to get a usable stack inside (or outside) the debugger? An example of the stack:

    > MyProgram.exe!IeeeFPHandler(_FPIEEE_RECORD * pieee=0x0012ec10)
    Line 168 C++
    msvcr71.dll!7c3744fa()
    ntdll.dll!7c90e21f()
    kernel32.dll!7c80b9bd()
    kernel32.dll!7c80b9e6()
    msvcr71.dll!7c34d518()
    MyProgram.exe!FPEGuardedExecution(int (void *)* func=0x0012fe20,
    void * d=0x0012edd4) Line 214 + 0x1d C++
    ntdll.dll!7c9037bf()
    ntdll.dll!7c90378b()
    ntdll.dll!7c937860()
    ntdll.dll!7c91b686()

    and our handler :wtf:

    #ifdef _WIN32

    #include #include #include static int fpWarningCount = 0;
    static int
    IeeeFPHandler( _FPIEEE_RECORD *pieee )
    {
    string s = "Unhandled floating point error";

    if (pieee->Cause.InvalidOperation) {
    s = "Invalid floating point operation";
    }

    if (pieee->Cause.ZeroDivide) {
    s = "Floating point zero divide";
    }

    if (pieee->Cause.Overflow) {
    s = "Floating point overflow";
    }

    if (pieee->Cause.Inexact) {
    s = "Floating point Inexact";
    }

    if (fpWarningCount == 8)
    s += "\nSuppressing further floating point errors";

    if (fpWarningCount <= 8)
    MessageDlg::critical(I18n(s));

    fpWarningCount++;
    return EXCEPTION_CONTINUE_EXECUTION;
    }

    C / C++ / MFC debugging tutorial question c++ data-structures

  • How to find total memory a process is using?
    S sysop HAL9K com

    Thanks Toby! There's still too much instrumentation for our simple needs. Here is what made the boss happy: C:\Temp>printmemorystats.exe total used 5054, free 760 OK - end of heap total used 10174, free 3816 OK - end of heap total used 12222, free 1760 OK - end of heap total used 16318, free 5848 OK - end of heap total used 24510, free 9936 OK - end of heap total used 40894, free 14024 OK - end of heap total used 73662, free 22128 OK - end of heap total used 139198, free 26216 OK - end of heap total used 270270, free 30304 OK - end of heap total used 532414, free 34392 OK - end of heap #include #include static void PrintMemoryStats(); int main() { int sizemem=1024; int ii; char *foo; for (ii=0; ii<10; ii++) { PrintMemoryStats(); foo = malloc(sizemem); sizemem *= 2; } } static void PrintMemoryStats() { _HEAPINFO hinfo; int heapstatus; long totalUsed = 0, totalFree = 0; hinfo._pentry = NULL; while( ( heapstatus = _heapwalk( &hinfo ) ) == _HEAPOK ) { if (hinfo._useflag == _USEDENTRY) totalUsed += hinfo._size; else if (hinfo._useflag == _FREEENTRY) totalFree += hinfo._size; } printf ("total used %ld, free %ld\n", totalUsed, totalFree); switch( heapstatus ) { case _HEAPEMPTY: printf( "OK - empty heap\n" ); break; case _HEAPEND: printf( "OK - end of heap\n" ); break; case _HEAPBADPTR: printf( "ERROR - bad pointer to heap\n" ); break; case _HEAPBADBEGIN: printf( "ERROR - bad start of heap\n" ); break; case _HEAPBADNODE: printf( "ERROR - bad node in heap\n" ); break; } } -- modified at 15:25 Friday 27th January, 2006

    C / C++ / MFC c++ performance help tutorial question

  • How to find total memory a process is using?
    S sysop HAL9K com

    We use a combination of malloc() and the new operator in our VC++ programs. How can we get a summary of either or both items total memory allocation? The heap walker stuff doesn't seem to do anything unless you use those dinosaur LocalAlloc() / GlobalAlloc() calls which are not portable to Unix. thanks for any help :confused:

    C / C++ / MFC c++ performance help tutorial question

  • customize CFileDialog for dynamic Files of Type
    S sysop HAL9K com

    My boss wants to be able to change Files of Type pulldown dynamically inside a CFildDialog callback. For example, we would start with a list of 5 file types and the last file type is "More...". If the user clicks on "More..." then the Files of Type combo is to be repopulated with 25 file types, for example. Then the last entry is "Less..." and so the user can reduce back to 5 file types. Has anyone seen this done in a commercial product or a demo? I'm no stranger to explorer style hookprocs, written them in (and out of) MFC. I can capture the child control notification, I clear the combobox, repopulate with a new list. However, the next time the user comes along and picks a type, I get a null pointer in COMMDLG32.DLL. Should I give up or is there hope?

    C / C++ / MFC c++ css tutorial question

  • VC++ 7.1 and WINVER warnings on Windows 2000
    S sysop HAL9K com

    We recently moved from VC++ 7.0 to 7.1 and now are getting these strange warnings whenever we compile on a Windows 2000 machine WINVER not defined. Defaulting to 0x0501 (Windows XP and Windows .NET Server) This warning does not show up on Windows XP compiles. Obviously it's the wrong answer since it should be 0x0500 for Windows 2000 right? please cc victor.volkman@ugsplm.com with answer :confused:

    C / C++ / MFC csharp c++ com sysadmin question

  • large malloc failures
    S sysop HAL9K com

    We seem to be hitting a fragmentation issue where we go to malloc 380MB on a machine with 1000MB and 3000MB swap and then we get a NULL pointer return from malloc(). This is happening intermittently since we went to VC7. Any ideas on how to work around this? The process shows in PERFMON that it only owns 600MB at the time the 380MB allocation fails and 720 out of 1000MB are in use (72% systemwide). Thanks for any clues :confused:

    C / C++ / MFC help tutorial question

  • fprintf function
    S sysop HAL9K com

    You forgot to ask for the CRT when you installed VisualStudio. Go back and reinstall and select C Runtime Libraries Source, which is un-checked by default in VisualStudio 6.0.

    C / C++ / MFC c++ question

  • How much memory does a process have?
    S sysop HAL9K com

    No, it doesn't work, at least according to the way I've tried to use it. The following code always returns the same values (workingset size never changes):

    #include void main()
    {
    long minn, maxx;
    long nbytes=1;
    while (1) {
    GetProcessWorkingSetSize(GetCurrentProcess(), &minn, &maxx);
    printf("%ld %ld\n", minn, maxx);
    malloc(nbytes);
    nbytes *= 2;
    Sleep(1000);
    }
    }

    #include C:\temp>workingset
    204800 1413120
    204800 1413120
    204800 1413120
    204800 1413120
    204800 1413120
    204800 1413120
    204800 1413120
    204800 1413120
    204800 1413120
    204800 1413120
    204800 1413120
    204800 1413120
    204800 1413120
    204800 1413120
    204800 1413120
    204800 1413120
    204800 1413120
    204800 1413120
    204800 1413120
    204800 1413120
    204800 1413120
    204800 1413120

    :omg:

    C / C++ / MFC question json performance help tutorial
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups