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
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Problems with LPRECT..

Problems with LPRECT..

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestion
4 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • _ Offline
    _ Offline
    __Cerb
    wrote on last edited by
    #1

    LPRECT rect; rect->left = 100; rect->right = 200; rect->top = 100; rect->bottom = 300; This is the code that should be executed when i click a button. However, when I click it, I get an error, it terminates my process. Why?

    B M L 3 Replies Last reply
    0
    • _ __Cerb

      LPRECT rect; rect->left = 100; rect->right = 200; rect->top = 100; rect->bottom = 300; This is the code that should be executed when i click a button. However, when I click it, I get an error, it terminates my process. Why?

      B Offline
      B Offline
      Bo Hunter
      wrote on last edited by
      #2

      LPRECT rect = new RECT; rect->left = 100; rect->right = 200; rect->top = 100; rect->bottom = 300; //must delete rect later; Thank You Bo Hunter

      1 Reply Last reply
      0
      • _ __Cerb

        LPRECT rect; rect->left = 100; rect->right = 200; rect->top = 100; rect->bottom = 300; This is the code that should be executed when i click a button. However, when I click it, I get an error, it terminates my process. Why?

        M Offline
        M Offline
        Michael Dunn
        wrote on last edited by
        #3

        LPRECT is a pointer to a RECT, so your code dereferences an uninitialized pointer. --Mike-- Ericahist | CP SearchBar v2.0.2 | Homepage | RightClick-Encrypt | 1ClickPicGrabber "That probably would've sounded more commanding if I wasn't wearing my yummy sushi pajamas."   -- Buffy

        1 Reply Last reply
        0
        • _ __Cerb

          LPRECT rect; rect->left = 100; rect->right = 200; rect->top = 100; rect->bottom = 300; This is the code that should be executed when i click a button. However, when I click it, I get an error, it terminates my process. Why?

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          Don't use LPRECT. Basically that means CRect *pRect, which is probably not what you really want. Use RECT instead. Then you can create an object just like something else. MFC uses CRect which can implicitly cast to RECT. This class contains some really handy methods. For instance Width() and Height().

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

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