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. Dynamic creating a Object

Dynamic creating a Object

Scheduled Pinned Locked Moved C / C++ / MFC
question
2 Posts 2 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.
  • R Offline
    R Offline
    RuiSantiago
    wrote on last edited by
    #1

    Hi! I'm trying to create a static box into a FormView derived class, i tryed like this: void CUnits_Sold::OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint) { //This lines had the propose of initialize the pointer, i could not find another way to do it! CStatic estatico; CStatic* estatico2; estatico2=&estatico; estatico2->Create("Olá", WS_CHILD|WS_VISIBLE|SS_NOPREFIX|SS_LEFTNOWORDWRAP, CRect(30, 30, 100, 100), this); estatico2->ShowWindow(SW_SHOW); } Anyone have a clue why this isn't working? Thank you

    M 1 Reply Last reply
    0
    • R RuiSantiago

      Hi! I'm trying to create a static box into a FormView derived class, i tryed like this: void CUnits_Sold::OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint) { //This lines had the propose of initialize the pointer, i could not find another way to do it! CStatic estatico; CStatic* estatico2; estatico2=&estatico; estatico2->Create("Olá", WS_CHILD|WS_VISIBLE|SS_NOPREFIX|SS_LEFTNOWORDWRAP, CRect(30, 30, 100, 100), this); estatico2->ShowWindow(SW_SHOW); } Anyone have a clue why this isn't working? Thank you

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

      When the estatico variable goes out of scope, it destroys the window too. --Mike-- Just released - RightClick-Encrypt - Adds fast & easy file encryption to Explorer My really out-of-date homepage Sonork-100.19012 Acid_Helm

      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