Results 1 to 12 of 12

Thread: Rendering graphics to desktop

  1. #1

    Thread Starter
    Fanatic Member Mushroom Realm's Avatar
    Join Date
    Mar 2002
    Location
    Murrieta, California
    Posts
    650

    Rendering graphics to desktop

    kindof like how those little screenmate things do

  2. #2
    Frenzied Member Zaei's Avatar
    Join Date
    Jul 2002
    Location
    My own little world...
    Posts
    1,710
    Could use regions to do it.

    Z.

  3. #3

    Thread Starter
    Fanatic Member Mushroom Realm's Avatar
    Join Date
    Mar 2002
    Location
    Murrieta, California
    Posts
    650
    whats regions?

  4. #4
    Frenzied Member Zaei's Avatar
    Join Date
    Jul 2002
    Location
    My own little world...
    Posts
    1,710
    MSDN it =).

    Z.

  5. #5
    Hyperactive Member
    Join Date
    Sep 2001
    Posts
    396
    This is the MFC way of doing, copied from the book 'Practical Visual C++ 6".
    PHP Code:
    // ** Get a pointer to the desktop window
    CWnd pDesktop GetDesktopWindow();
    // ** Get a pointer to it's device context
    CDC pDC pDesktop->GetWindowDC();

    //* Do your drawing here
    // pDC->blahblah()
    // After drawing

    pDesktop->ReleaseDC(pDC); 
    Bcos the above code draws straight into the desktop, you must make reparations and clean up in the WM_DESTROY message.

    PHP Code:
    // ** tell windows to redraw its desktop and all child windows

    GetDesktopWindow->RedrawWindow(NULL,NULL,
    RDW_ERASE+RDW_INVALIDATE+RDW_ALLCHILDREN+RDW_ERASENOW); 
    If u want to do it the win32 API, I think it is not difficult to figure it out as

    "In most cases, you'll find that the MFC class member function is implemented as a call to the native API" --Visual C++ 5 Bible

    I have to say this, before I get shot down, that MFC does not encapsulate all the Win32 APIs.

    I'm also interested to make a screen saver (after I'm finished with my current project) but I will do it the Win32 API's way bcos I can choose not to ShowWindow().

  6. #6
    Hyperactive Member
    Join Date
    Sep 2001
    Posts
    396

    Food for thought

    I tried changing the extension of screen saver that came with windows from *.scr to *.exe and execute them by double clicking.

    They showed me a options dialog for the screen saver

    If I double-clicked the same file with *.scr extension, it is the screen saver.

    Of course, before that, I copied the file to another directory.
    Last edited by transcendental; Sep 16th, 2002 at 09:25 PM.

  7. #7
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    You can choose not to ShowWindow with MFC. Look at the CYourApp::InitInstance method.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  8. #8
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    A screensaver is only an executable with the extension changed to .scr, which accepts a special set of parameters. You can look it up somewhere in the MSDN.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  9. #9

    Thread Starter
    Fanatic Member Mushroom Realm's Avatar
    Join Date
    Mar 2002
    Location
    Murrieta, California
    Posts
    650
    i want to draw to desktop (that looks like its drawing to a window). i was gonna use setpixel, will it still work right?

  10. #10
    Hyperactive Member
    Join Date
    Sep 2001
    Posts
    396
    Setpixel is extremely slow. Try to use Bitblt() if possble.

  11. #11
    Hyperactive Member
    Join Date
    Sep 2001
    Posts
    396
    Originally posted by CornedBee
    You can choose not to ShowWindow with MFC. Look at the CYourApp::InitInstance method.
    Thanks.

  12. #12
    Frenzied Member Zaei's Avatar
    Join Date
    Jul 2002
    Location
    My own little world...
    Posts
    1,710
    Use regions... =).

    Z.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width