⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 global.hpp

📁 使用BorlandC++4.5编译的一个MUD客户端程序
💻 HPP
字号:
head	2.2;access;symbols;locks; strict;comment	@// @;2.2date	95.10.27.20.05.26;	author tsurace;	state Release;branches;next	2.1;2.1date	95.10.24.15.52.51;	author tsurace;	state Exp;branches;next	1.3;1.3date	95.10.18.23.54.23;	author tsurace;	state Beta;branches;next	1.2;1.2date	95.10.18.22.13.15;	author tsurace;	state Beta;branches;next	1.1;1.1date	95.10.11.21.01.02;	author tsurace;	state Exp;branches;next	;desc@Header file for Global class and program-wide functions.@2.2log@Added GetchLoop to allow getch() simulation.Added accelerators.@text@#ifndef GLOBAL_HPP
#define GLOBAL_HPP

// This header file requires windows.h, of course
// $Id: global.hpp 2.1 1995/10/24 15:52:51 tsurace Exp tsurace $
// $Log: global.hpp $
// Revision 2.1  1995/10/24  15:52:51  tsurace
// Roll.
//
// Revision 1.3  1995/10/18  23:54:23  tsurace
// Added version string.
//
// Revision 1.2  1995/10/18  22:13:15  tsurace
// Added BlockingHook function so that the program won't suck when
// blocking calls are made.  :>
//
// Revision 1.1  1995/10/11  21:01:02  tsurace
// Initial revision
//
// (end of Log)

#include <stdlib.h>

// Global class
class Global
{
  public:
    static void        Init(HINSTANCE _hInstance, HINSTANCE _hPrevInstance);
    static HINSTANCE   Instance();
    static int         MessageLoop();
    static int         GetchLoop();
    static void        PostOutOfMemoryMessage();
    static HINSTANCE   PrevInstance();

    // Called as the wndproc for all windows
    static LRESULT CALLBACK _export
        WndProc(HWND hWnd, UINT iMessage, WPARAM wParam, LPARAM lParam);

    // Called during blocking sockets calls
    static BOOL CALLBACK BlockingHook();

  private:
    static HINSTANCE _hInstance;       // Application instance
    static HINSTANCE _hPrevInstance;
    static const char * VersionInfo;             // Class data
    static HACCEL _accelerators;
};

// >>>>> Inline functions <<<<<

inline HINSTANCE Global::Instance()
{
    return _hInstance;
};

inline HINSTANCE Global::PrevInstance()
{
    return _hPrevInstance;
};

// ------------------------------------
// General purpose functions and macros
// ------------------------------------

// ----------------------------------------------------------------------
// scream_and_die functions - send a message and abort
//
// Parameters:
//   class - the type of failure (IE, IDERR_WSAAsyncSelect)
//   string_id - the resource id of the message string
//
// Notes:
//   Both of these load the class string from a resource, which may fail
//   if the system is out of memory.
//
inline void scream_and_die(int msg_class, int string_id)
{
    char title[20];
    char message[256];
    if (LoadString(Global::Instance(), msg_class, title, 20)
        && LoadString(Global::Instance(), string_id, message, 256))
    {
        MessageBox(NULL,
                   message,
                   title,
                   MB_SYSTEMMODAL | MB_ICONHAND | MB_OK);
    };
    DebugBreak();
    exit(EXIT_FAILURE);
};

// scream_and_die for freeform messages
inline void scream_and_die(int msg_class, char * msg)
{
    char title[20];
    if (LoadString(Global::Instance(), msg_class, title, 20))
        MessageBox(NULL, msg, title, MB_SYSTEMMODAL | MB_ICONHAND | MB_OK);

    DebugBreak();
    exit(EXIT_FAILURE);
};

#endif // GLOBAL_HPP
@2.1log@Roll.@text@d5 4a8 4// $Id: global.hpp 1.3 1995/10/18 23:54:23 tsurace Beta tsurace $// $Log: global.hpp $// Revision 1.3  1995/10/18  23:54:23  tsurace// Added version string.d10 3d31 1d46 1@1.3log@Added version string.@text@d5 5a9 2// $Id: global.hpp 1.2 1995/10/18 22:13:15 tsurace Beta tsurace $// $Log: global.hpp $@1.2log@Added BlockingHook function so that the program won't suck whenblocking calls are made.  :>@text@d5 1a5 1// $Id: global.hpp 1.1 1995/10/11 21:01:02 tsurace Exp tsurace $d7 4d38 1@1.1log@Initial revision@text@d5 5a9 2// $Id$// $Log$d18 5a22 5    static void      Init(HINSTANCE _hInstance, HINSTANCE _hPrevInstance);    static HINSTANCE Instance();    static int       MessageLoop();    static void      PostOutOfMemoryMessage();    static HINSTANCE PrevInstance();d27 3@

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -