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. AfxGetApp()->m_pMainWnd in a DLL? [Edit]

AfxGetApp()->m_pMainWnd in a DLL? [Edit]

Scheduled Pinned Locked Moved C / C++ / MFC
helpcsharpc++htmlcom
3 Posts 3 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.
  • M Offline
    M Offline
    Mitch F
    wrote on last edited by
    #1

    Hello, I am currently writing a wrapper DLL in VC++ 6 so that I can use specific SDK functions from VB .Net. (VB .Net can access the function through "Private Declare Function GetDuration Lib "Path\Wrapper.dll" (parameters)") In my C++ DLL I need to pass an "HWND" value to an SDK function; however, when I use "AfxGetApp()->m_pMainWnd" the compiler returns two errors: 'AfxGetApp' undeclared identifier left of '->m_pMainWnd' must point to struct/class/union Am I trying to retrieve my DLL's "HWND" correctly or is there a better function than "AfxGetApp()" to use in a DLL? [Edit] If I use "AfxGetMainWnd()" instead, I only get one error: 'AfxGetMainWnd' undeclared identifier I am unsure why it says that "AfxGetMainWnd" is an undeclared identifier. [/Edit] Any help would be greatly appreciated, Mitch My sig: "And it is a professional faux pas to pay someone else to destroy your computer when you are perfectly capable of destroying it yourself." - Roger Wright Get Perpendicular! (Hitachi Storage) My CodeProject Blog Most recent blog post: April 11

    PJ ArendsP T 2 Replies Last reply
    0
    • M Mitch F

      Hello, I am currently writing a wrapper DLL in VC++ 6 so that I can use specific SDK functions from VB .Net. (VB .Net can access the function through "Private Declare Function GetDuration Lib "Path\Wrapper.dll" (parameters)") In my C++ DLL I need to pass an "HWND" value to an SDK function; however, when I use "AfxGetApp()->m_pMainWnd" the compiler returns two errors: 'AfxGetApp' undeclared identifier left of '->m_pMainWnd' must point to struct/class/union Am I trying to retrieve my DLL's "HWND" correctly or is there a better function than "AfxGetApp()" to use in a DLL? [Edit] If I use "AfxGetMainWnd()" instead, I only get one error: 'AfxGetMainWnd' undeclared identifier I am unsure why it says that "AfxGetMainWnd" is an undeclared identifier. [/Edit] Any help would be greatly appreciated, Mitch My sig: "And it is a professional faux pas to pay someone else to destroy your computer when you are perfectly capable of destroying it yourself." - Roger Wright Get Perpendicular! (Hitachi Storage) My CodeProject Blog Most recent blog post: April 11

      PJ ArendsP Offline
      PJ ArendsP Offline
      PJ Arends
      wrote on last edited by
      #2

      Afx... functions are MFC functions. Add MFC support to your dll and they should work.


      "You're obviously a superstar." - Christian Graus about me - 12 Feb '03 "Obviously ???  You're definitely a superstar!!!" mYkel - 21 Jun '04 Within you lies the power for good - Use it!


      Honoured as one of The Most Helpful Members of 2004

      Within you lies the power for good; Use it!

      1 Reply Last reply
      0
      • M Mitch F

        Hello, I am currently writing a wrapper DLL in VC++ 6 so that I can use specific SDK functions from VB .Net. (VB .Net can access the function through "Private Declare Function GetDuration Lib "Path\Wrapper.dll" (parameters)") In my C++ DLL I need to pass an "HWND" value to an SDK function; however, when I use "AfxGetApp()->m_pMainWnd" the compiler returns two errors: 'AfxGetApp' undeclared identifier left of '->m_pMainWnd' must point to struct/class/union Am I trying to retrieve my DLL's "HWND" correctly or is there a better function than "AfxGetApp()" to use in a DLL? [Edit] If I use "AfxGetMainWnd()" instead, I only get one error: 'AfxGetMainWnd' undeclared identifier I am unsure why it says that "AfxGetMainWnd" is an undeclared identifier. [/Edit] Any help would be greatly appreciated, Mitch My sig: "And it is a professional faux pas to pay someone else to destroy your computer when you are perfectly capable of destroying it yourself." - Roger Wright Get Perpendicular! (Hitachi Storage) My CodeProject Blog Most recent blog post: April 11

        T Offline
        T Offline
        ThatsAlok
        wrote on last edited by
        #3

        Mitch (Programmer2k4) wrote: In my C++ DLL I need to pass an "HWND" value to an SDK function; however, when I use "AfxGetApp()->m_pMainWnd" the compiler returns two errors: In Continuation With Mr Arend, you need a window in DLL too, as there by default no window present in DLL, So AfxGetApp() function is of no use!

        "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow

        cheers, Alok Gupta

        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