Thread: Windows Pixel Blocks... PLEASE READ!

  1. #16
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,868
    I had similar problems and fixed them with the way I created DC's and set the rendering. Look at the update area in the paint, see what is being redrawn.

    I don't like to use SaveDC() / RestoreDC().

    I keep the objects released from the SelectObject and replace these and delete the created ones before the function exits.

    I do not do any drawing in the paint function except to BitBlt() the frame buffer (HDC I send into the paint) to the paint DC. All drawing is done prior to ME calling paint or if windows calls the paint no new drawing is done, the old buffer is redrawn.

    I create the DC's ect compat with the screen, set all to half tone rendering. I have no problems with any drawing.

    Remember not all paint msg's are called by your program. Controls will call to be redrawn if they are used.
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

  2. #17
    erstwhile
    Join Date
    Jan 2002
    Posts
    2,227
    from msdn:

    The RGB macro is defined as follows:

    #define RGB(r, g ,b) ((DWORD) (((BYTE) (r) | \
    ((WORD) (g) << 8)) | \
    (((DWORD) (BYTE) (b)) << 16)))

    so that returns the COLORREF or DWORD value.

    so if RGB, for some strange reason, is not working for you then replace RGB(r,g,b) with the value of the colour required.

    eg. blue 0xFF0000 or 16711680.

    or could #undef and redefine the RGB macro or define it under another name for testing.

    //===========================================

    and to all those who are concerned with my original example where everything is done within the WM_PAINT and between BeginPaint....EndPaint - that was the quickest, easiest and simplest to follow, IMHO, what is going on since I believe:
    I'm not incredibly expierienced with gdi...
    is euphemistic for 'make it as simple to follow as possible'

    I don't like using SaveDC/RestoreDC either but I recognise that one int value has got to be a lot simpler than all those int (handles) if you are ripping apart and re-assembling the dc params. Nor would I under normal circumstances do all that kind of stuff there.

    I could have used CreateCompatibleDC(NULL); to get a dc compatible with the desktop but again it is clearer, IMHO, to see an explicit dc that is being 'cloned'. Also it is clear from
    true mostly becosue the windows are created on the same paramiters as the desktop
    that the original questioner, minime6696, is well aware of the possibilities. Also on the basis of his openGL knowledge it seems that minime6696 would be well capable of identifying and implementing any required efficiency improvements.

    That's not to say that I wish to stifle discussion or opinion - quite the reverse actually; but please don't assume that if a code example is given that it is anything other than what is asked for: the simplest route to a working, analysable example that this humble amateur can fart out his rear end.

  3. #18
    Registered User minime6696's Avatar
    Join Date
    Aug 2001
    Posts
    267

    Question Um...

    Well, I appriciate the help but, why does everyone here assume im an ametuer!?!??! im ANYTHING BUT! I have made SEVRAL API's, and I have made sevral 3d Englines. I work with modular and dynamic virtual machines in some cases, mostly using DLL's and scripts. Sorry but im no newbie.

    Also, it wont support the color red, I have no idea what it is, but just becouse I am not 'that good' with gdi, becouse I never explored it, does in no way make me a newbie... i've just allways kept me code portable .

    SPH

  4. #19
    Just one more wrong move. -KEN-'s Avatar
    Join Date
    Aug 2001
    Posts
    3,227
    Damn sean, cool your jets. Noone insulted your talent, Ken (other Ken. ) was actually complimenting you.

    >>that this humble amateur can fart out his rear end.<<

    I think you are far too humble for the amount of knowledge you seem to posess. I wish certain others here would be a bit more humble though...not to put blame on anyone, but I bet you can figure out who I'm talking about

    ...and what do yu mean by red won't work? won't show up? what color does it put there instead..?

  5. #20
    erstwhile
    Join Date
    Jan 2002
    Posts
    2,227
    Sincere apologies - but I assure you I do NOT think of you as a Newbie - and nor did I describe you either explicitly or implicitly as one.

    For example:
    on the basis of his openGL knowledge it seems that minime6696 would be well capable of identifying and implementing any required efficiency improvements.
    These are clearly not the observations of anyone who considers you as anything other than what you most obviously are: a very capable and adept programmer. (I am an amateur).

    But what do you find easier when moving into unfamiliar/unexplored territory? A simple or a complex example?

    The question is, of course, rhetorical.

    [ This is probably just a 'po-ta-to' poh-tah-toh thing. ]

    //////////////////////
    Anyway - that's real strange the RGB macro failing that way. Did you try using the raw numbers and/or #undef RGB - #define RGB blah blah blah?

    If you have done the latter and still no good then it beats me what's wrong.

    Hopefully one of the giants who frequent this forum may be able to provide a solution (once Australia wakens up ).

    //=========
    p.s - er thanks -KEN- my ego kind of momentarily flickered into irritable life but hopefully i've stomped the 4-millijoule firefly into extinction. Consider yourself nominated for a Nobel Peace Prize
    Last edited by Ken Fitlike; 01-24-2002 at 07:28 PM.

  6. #21
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,868
    I'm sorry if you find my comments / attitude less than helpful. I did not intend to insult your ability.

    We are talking more of style than content.(not what will work but what will work better, what is good practice rather than acceptable).

    Its Australia Day tomorrow and so I'm off.
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Script errors - bool unrecognized and struct issues
    By ulillillia in forum Windows Programming
    Replies: 10
    Last Post: 12-18-2006, 04:44 AM
  2. Read Excel File from Windows Program
    By baburajv in forum Windows Programming
    Replies: 2
    Last Post: 11-07-2006, 01:42 PM
  3. Dialog Box Problems
    By Morgul in forum Windows Programming
    Replies: 21
    Last Post: 05-31-2005, 05:48 PM
  4. dual boot Win XP, win 2000
    By Micko in forum Tech Board
    Replies: 6
    Last Post: 05-30-2005, 02:55 PM
  5. Unknown Memory Leak in Init() Function
    By CodeHacker in forum Windows Programming
    Replies: 3
    Last Post: 07-09-2004, 09:54 AM