C++ Global Variable

Discussion in 'C++' started by watson, Jul 24, 2010.

  1. watson

    watson New Member

    Joined:
    Jul 24, 2010
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    0
    I'm working on the project (that I didn't write) and I'm stumped by the following.

    First off, there's a struct that contains names of API loaded dynamically. Something like this:
    Code:
    typedef struct _DYN_DLL_PROC{
    	FARPROC pfnDwmIsCompositionEnabled;
    	//And so on
    }DYN_DLL_PROC *LPDYN_DLL_PROC;
    
    Then there's a global variable declared in the cpp file where CWinApp-derived class resides (right next to where MFC puts declaration for its own theApp variable):
    Code:
    DYN_DLL_PROC fns;
    This struct is loaded from within the CWinApp-derived class constructor as such:
    Code:
    fns.pfnDwmIsCompositionEnabled = GetProcAddress(hDWMApi, "DwmIsCompositionEnabled");
    But what happens is that when that API is intended to be used later on from CDialog-derived class fns.pfnDwmIsCompositionEnabled still appears as NULL! I checked the loading process above and it does not return NULL. What can be the issue here?
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice