1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

C++ Global Variable

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

  1. watson

    watson New Member

    Jul 24, 2010
    Likes Received:
    Trophy Points:
    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:
    typedef struct _DYN_DLL_PROC{
    	FARPROC pfnDwmIsCompositionEnabled;
    	//And so on
    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):
    DYN_DLL_PROC fns;
    This struct is loaded from within the CWinApp-derived class constructor as such:
    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