From b0d45c22d1ecede6c1903da7e668d26bfc0f7a34 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Mon, 16 Dec 2002 01:46:42 +0000 Subject: [PATCH] add (simple) archutils tree and AppInstance class --- stepmania/src/archutils/Win32/AppInstance.cpp | 24 +++++++++++++++++++ stepmania/src/archutils/Win32/AppInstance.h | 21 ++++++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 stepmania/src/archutils/Win32/AppInstance.cpp create mode 100644 stepmania/src/archutils/Win32/AppInstance.h diff --git a/stepmania/src/archutils/Win32/AppInstance.cpp b/stepmania/src/archutils/Win32/AppInstance.cpp new file mode 100644 index 0000000000..3273ebadfa --- /dev/null +++ b/stepmania/src/archutils/Win32/AppInstance.cpp @@ -0,0 +1,24 @@ +#include "../../../stdafx.h" +#include "AppInstance.h" + +AppInstance::AppInstance() +{ + /* Little trick to get an HINSTANCE of ourself without having access to the hwnd ... */ + TCHAR szFullAppPath[MAX_PATH]; + GetModuleFileName(NULL, szFullAppPath, MAX_PATH); + h = LoadLibrary(szFullAppPath); + /* h will be NULL if this fails. Most operations that take an HINSTANCE + * will still work without one (but may be missing graphics); that's OK. */ +} + +AppInstance::~AppInstance() +{ + if(h) + FreeLibrary(h); +} + +/* + * Copyright (c) 2002 by the person(s) listed below. All rights reserved. + * + * Glenn Maynard + */ diff --git a/stepmania/src/archutils/Win32/AppInstance.h b/stepmania/src/archutils/Win32/AppInstance.h new file mode 100644 index 0000000000..2fde54c53f --- /dev/null +++ b/stepmania/src/archutils/Win32/AppInstance.h @@ -0,0 +1,21 @@ +#ifndef APP_INSTANCE_H +#define APP_INSTANCE_H + +/* Win32 only: get an HINSTANCE; used for starting dialog boxes. */ +class AppInstance +{ + HINSTANCE h; + +public: + AppInstance(); + ~AppInstance(); + HINSTANCE Get() const { return h; } +}; + +#endif + +/* + * Copyright (c) 2002 by the person(s) listed below. All rights reserved. + * + * Glenn Maynard + */