Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

panda/src/windisplay/winGraphicsPipe.cxx

Go to the documentation of this file.
00001 // Filename: winGraphicsPipe.cxx
00002 // Created by:  drose (20Dec02)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) 2001, Disney Enterprises, Inc.  All rights reserved
00008 //
00009 // All use of this software is subject to the terms of the Panda 3d
00010 // Software license.  You should have received a copy of this license
00011 // along with this source code; you will also find a current copy of
00012 // the license at http://www.panda3d.org/license.txt .
00013 //
00014 // To contact the maintainers of this program write to
00015 // panda3d@yahoogroups.com .
00016 //
00017 ////////////////////////////////////////////////////////////////////
00018 
00019 #include "winGraphicsPipe.h"
00020 #include "config_windisplay.h"
00021 
00022 TypeHandle WinGraphicsPipe::_type_handle;
00023 
00024 ////////////////////////////////////////////////////////////////////
00025 //     Function: WinGraphicsPipe::Constructor
00026 //       Access: Public
00027 //  Description: 
00028 ////////////////////////////////////////////////////////////////////
00029 WinGraphicsPipe::
00030 WinGraphicsPipe() {
00031   // these fns arent defined on win95, so get dynamic ptrs to them
00032   // to avoid ugly DLL loader failures on w95
00033   _pfnTrackMouseEvent = NULL;
00034 
00035   _hUser32 = (HINSTANCE)LoadLibrary("user32.dll");
00036   if (_hUser32 != NULL) {
00037     _pfnTrackMouseEvent = 
00038       (PFN_TRACKMOUSEEVENT)GetProcAddress(_hUser32, "TrackMouseEvent");
00039   }
00040 }
00041 
00042 ////////////////////////////////////////////////////////////////////
00043 //     Function: WinGraphicsPipe::Destructor
00044 //       Access: Public, Virtual
00045 //  Description: 
00046 ////////////////////////////////////////////////////////////////////
00047 WinGraphicsPipe::
00048 ~WinGraphicsPipe() {
00049   if (_hUser32 != NULL) {
00050     FreeLibrary(_hUser32);
00051     _hUser32 = NULL;
00052   }
00053 }
00054 
00055 bool MyGetProcAddr(HINSTANCE hDLL, FARPROC *pFn, const char *szExportedFnName) {
00056   *pFn = (FARPROC) GetProcAddress(hDLL, szExportedFnName);
00057   if (*pFn == NULL) {
00058     windisplay_cat.error() << "GetProcAddr failed for " << szExportedFnName << ", error=" << GetLastError() <<endl;
00059     return false;
00060   }
00061   return true;
00062 }
00063 
00064 bool MyLoadLib(HINSTANCE &hDLL, const char *DLLname) {
00065   hDLL = LoadLibrary(DLLname);
00066   if(hDLL == NULL) {
00067     windisplay_cat.error() << "LoadLibrary failed for " << DLLname << ", error=" << GetLastError() <<endl;
00068     return false;
00069   }
00070   return true;
00071 }

Generated on Fri May 2 00:44:46 2003 for Panda by doxygen1.3