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

📄 hiddenwindow.cpp

📁 fax engine 传真引擎 relay fax 的开源项目 商业软件使用 高质量 高可靠
💻 CPP
字号:
/*****************************************************************************
* RelayFax Open Source Project
* Copyright 1996-2004 Alt-N Technologies, Ltd.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted only as authorized by the RelayFax Open 
* Source License.  A copy of this license is available in file LICENSE 
* in the top-level directory of the distribution.
*
* RelayFax is a registered trademark of Alt-N Technologies, Ltd.
*
* Individual files and/or contributed packages may be copyright by
* other parties and subject to additional restrictions.
*****************************************************************************/

#include "stdafx.h"
#include "HiddenWindow.h"
#include "excepthandler.h"


ATOM CHiddenWindow::s_WindowClassAtom = 0;
char* CHiddenWindow::s_WindowClass = "RelayFax Hidden Window";
HINSTANCE CHiddenWindow::s_hInstance = NULL;


//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

CHiddenWindow::CHiddenWindow()
{

}

CHiddenWindow::~CHiddenWindow()
{

}

//////////////////////////////////////////////////////////////////////
// RegisterWindowClass
//////////////////////////////////////////////////////////////////////
void CHiddenWindow::RegisterWindowClass( HINSTANCE hInstance )
{
	WNDCLASS   wc;

	ZeroMemory( &wc, sizeof(wc) );
	
	wc.hCursor        = NULL;    // this window never shown, so no
	wc.hIcon          = NULL;    // cursor or icon are necessary
	wc.lpszMenuName   = NULL;
	wc.lpszClassName  = s_WindowClass;
	wc.hbrBackground  = (HBRUSH)(COLOR_WINDOW + 1);
	wc.hInstance      = hInstance;
	wc.style          = CS_GLOBALCLASS;
	wc.lpfnWndProc    = WndProc;
	wc.cbWndExtra     = sizeof(CHiddenWindow*);
	wc.cbClsExtra     = 0;

	s_WindowClassAtom = RegisterClass( &wc );

	s_hInstance = hInstance;
}

//////////////////////////////////////////////////////////////////////
// UnRegisterWindowClass
//////////////////////////////////////////////////////////////////////
void CHiddenWindow::UnRegisterWindowClass( void )
{
	UnregisterClass( s_WindowClass, s_hInstance );
}


//////////////////////////////////////////////////////////////////////
// Hidden Window Procedure
//////////////////////////////////////////////////////////////////////
LRESULT CALLBACK CHiddenWindow::WndProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam )
{
	CHiddenWindow* pWnd = (CHiddenWindow*) GetWindowLong( hwnd, 0 );

//	char szMsg[80];
//	wsprintf( szMsg, "CHiddenWindow::WndProc: 0x%x\n", msg ); 
//	OutputDebugString( szMsg );

//	__try
	{
		if( pWnd )
		{
			return pWnd->HandleMsg( msg, wParam, lParam );
		}

	}
//	__except ( ExceptionHandler( GetExceptionInformation(), "Any", "HandleMsg" ) )
	{
		//LOG( LOG_SYSTEM, "%s: Unhandled exception in OnStartup()", m_sThreadName.c_str() );
	}

	return TRUE;
}



//////////////////////////////////////////////////////////////////////
// InitWindow
//////////////////////////////////////////////////////////////////////
void CHiddenWindow::InitWindow(void)
{
	
	m_hwnd = CreateWindow( s_WindowClass, s_WindowClass, 0, 
						   CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, 
		                   NULL, NULL, s_hInstance, NULL );

	DWORD dwError = GetLastError();

	SetWindowLong( m_hwnd, 0, (LONG)this ); 
}

//////////////////////////////////////////////////////////////////////
// ShutdownWindow
//////////////////////////////////////////////////////////////////////
void CHiddenWindow::ShutdownWindow(void)
{
	DestroyWindow( m_hwnd );
}


//////////////////////////////////////////////////////////////////////
// HandleMsg
//////////////////////////////////////////////////////////////////////
LRESULT CHiddenWindow::HandleMsg( UINT msg, WPARAM wParam, LPARAM lParam )
{
	return DefWindowProc( m_hwnd, msg, wParam, lParam );
}


void CHiddenWindow::PostMessage( UINT msg, WPARAM wParam, LPARAM lParam )
{
	::PostMessage( m_hwnd, msg, wParam, lParam );
}

⌨️ 快捷键说明

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