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
D

Daniel L Kelly

@Daniel L Kelly
About
Posts
2
Topics
1
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Graphics.DrawRectangle draws rectangles one pixel too big [modified]
    D Daniel L Kelly

    Actually, I think the line drawing function is working perfectly. The FillRectangle function actually fills a rectangle defined as (top,left,right-1,bottom-1). The MSDN documentation doesnt clearly state that for FillRectangle, but it does for FillRect (and FillRectangle probably just makes a direct call to FillRect ) Check out the docs to FillRect here:

    http://msdn.microsoft.com/en-us/library/aa932720.aspx

    The important part being:

    This function fills the rectangle's left and top borders, but excludes the right and bottom borders.

    If it makes you feel better, I've been programming for windows SDK since 1987, and I still forget that from time to time. It's annoying. I disagree with Microsoft's decision process on that one. Dan K

    Clever Code graphics help csharp

  • (C++) Trick or Treat ( Make/Expand our tricks.h file) [modified]
    D Daniel L Kelly

    Okay, Haloween is coming and I'm trying to get in the spirit of the thing. So I figured we could swap treats that are tricks. I've got a file tricks.h that I include at the bottom of my stdafx.h header file that I stuff with neat little programming tricks. The idea is that they are all one or just a few lines, no multipage functions. Anyhow, I figured I'd share my best and my easiest trick treats and see if anyone else will reciprocate. My best trick:

    #ifdef TRACE
    #undef TRACE
    #define TRACE(s, ...) ATLTRACE((LPCSTR)(CStringA("%s(%d) : ")+s),__FILE__,__LINE__,__VA_ARGS__)
    #endif
    

    Now, I'm not one who's really fond of macros... Some programmers like to express the size of their manhood by how complicated and obfuscated their macros are. I'm not one of those coders. I only use a complicated macro when nothing else will get the job done as easily. Originally I had a full page function and a few macros that I replaced with this thing when Visual C++ got support for variadic macros. Anyhow what use is it? Well, when Visual C++ is compiling, it will spit out error messages into the debug window, something like this:

    c:\programming\orgprintview.cpp(32) : error C2143: syntax error : missing ';' before '!'

    When you hit F4 or doubleclick on that line, the IDE will deliver you to the file and line that generated the error. It turns out that if you format your TRACE statements to print "file(line) : message", then you can doubleclick in the output window on that line and the IDE will take you to that location. Pretty nifty. So those 4 lines when added to your tricks.h file will change all TRACE statements to do just that. Note that it only works on the char version of TRACE, not the wchar or tchar. that's all I use though so it's fine by me. My simplest tricks.h entry is this:

    #define IDENTICAL 0			// use: if(IDENTICAL==strcmp(a,b)) {;}
    

    And the comment shows it's usage... I try as hard as possible to have my code read like english (so long as it doesnt get more complicated), and this easy macro helps a bit :) Anyhow, Happy Haloween, and hit me back with something to add to my tricks.h Dan K (p.s. I'm looking for a good paying job anywhere in the US, or abroad actually, hook me up :))

    modified on Monday, October 12, 2009 8:32 PM

    Clever Code c++ debugging visual-studio help question
  • Login

  • Don't have an account? Register

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