CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    Nov 2007
    Posts
    93

    Strange problem!!

    I use the function:

    pdc->LPtoHIMETRIC(&size);

    where pdc is a CDC object : pdc = pView->GetDC()

    During a long time this function returns the correct values, but now when my routines call that function the pdc fails.
    I can´t understand why it fails. Can anyone help me , please.

  2. #2
    Join Date
    Apr 1999
    Posts
    27,449

    Re: Strange problem!!

    Quote Originally Posted by pererm View Post
    I use the function:

    pdc->LPtoHIMETRIC(&size);

    where pdc is a CDC object : pdc = pView->GetDC()

    During a long time this function returns the correct values, but now when my routines call that function the pdc fails.
    I can´t understand why it fails. Can anyone help me , please.
    And the value of pView is...?

    Also, please define what you mean by "pdc fails". Is it NULL? It isn't NULL but doesn't "work" correctly? Etc...

    Regards,

    Paul McKenzie

  3. #3
    2kaud's Avatar
    2kaud is online now Super Moderator Power Poster
    Join Date
    Dec 2012
    Location
    England
    Posts
    7,825

    Re: Strange problem!!

    I can´t understand why it fails.
    What's the debugger saying?
    All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!

    C++23 Compiler: Microsoft VS2022 (17.6.5)

  4. #4
    Join Date
    Feb 2003
    Location
    Iasi - Romania
    Posts
    8,234

    Re: Strange problem!!

    How do you know it fails, as long as CDC::LPtoHIMETRIC returns void?
    Ovidiu
    "When in Rome, do as Romans do."
    My latest articles: https://codexpertro.wordpress.com/

  5. #5
    Join Date
    Feb 2003
    Location
    Iasi - Romania
    Posts
    8,234

    Re: Strange problem!!

    ...anyway, the most common cause of GDI malfunction after a while, is having GDI leaks. That means, creating GDI objects (brushes, pens, fonts, etc) without destroying them when they are no more necessary. Also, you must take care of releasing GDI objects from DC before destroying them.
    Ovidiu
    "When in Rome, do as Romans do."
    My latest articles: https://codexpertro.wordpress.com/

  6. #6
    Join Date
    Apr 2000
    Location
    Belgium (Europe)
    Posts
    4,626

    Re: Strange problem!!

    Quote Originally Posted by 2kaud View Post
    What's the debugger saying?
    Ring ding dingeding ding ding ?

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

Featured