本文整理汇总了C++中MAKEINTRESOURCE函数的典型用法代码示例。如果您正苦于以下问题:C++ MAKEINTRESOURCE函数的具体用法?C++ MAKEINTRESOURCE怎么用?C++ MAKEINTRESOURCE使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了MAKEINTRESOURCE函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: mainSetupAndRun
int mainSetupAndRun() {
try {
int colour_depth = GetOptionsDB().Get<int>("color-depth");
bool fullscreen = GetOptionsDB().Get<bool>("fullscreen");
bool fake_mode_change = GetOptionsDB().Get<bool>("fake-mode-change");
std::pair<int, int> width_height = HumanClientApp::GetWindowWidthHeight();
int width(width_height.first), height(width_height.second);
std::pair<int, int> left_top = HumanClientApp::GetWindowLeftTop();
int left(left_top.first), top(left_top.second);
int fullscreen_monitor_id = GetOptionsDB().Get<int>("fullscreen-monitor-id");
#ifdef FREEORION_WIN32
# ifdef IDI_ICON1
// set window icon to embedded application icon
HWND hwnd;
window->getCustomAttribute("WINDOW", &hwnd);
HINSTANCE hInst = (HINSTANCE)GetModuleHandle(NULL);
SetClassLong (hwnd, GCL_HICON,
(LONG)LoadIcon (hInst, MAKEINTRESOURCE (IDI_ICON1)));
# endif
#endif
parse::init();
HumanClientApp app(width_height.first, width_height.second, true, "FreeOrion " + FreeOrionVersionString(),
left, top, fullscreen, fake_mode_change);
if (GetOptionsDB().Get<bool>("quickstart")) {
// immediately start the server, establish network connections, and
// go into a single player game, using default universe options (a
// standard quickstart, without requiring the user to click the
// quickstart button).
app.NewSinglePlayerGame(true); // acceptable to call before app()
}
std::string load_filename = GetOptionsDB().Get<std::string>("load");
if (!load_filename.empty()) {
// immediately start the server, establish network connections, and
// go into a single player game, loading the indicated file
// (without requiring the user to click the load button).
app.LoadSinglePlayerGame(load_filename); // acceptable to call before app()
}
// run rendering loop
app(); // calls GUI::operator() which calls SDLGUI::Run() which starts rendering loop
} catch (const HumanClientApp::CleanQuit&) {
// do nothing
std::cout << "mainSetupAndRun caught CleanQuit" << std::endl;
} catch (const std::invalid_argument& e) {
ErrorLogger() << "main() caught exception(std::invalid_argument): " << e.what();
std::cerr << "main() caught exception(std::invalid_arg): " << e.what() << std::endl;
} catch (const std::runtime_error& e) {
ErrorLogger() << "main() caught exception(std::runtime_error): " << e.what();
std::cerr << "main() caught exception(std::runtime_error): " << e.what() << std::endl;
} catch (const boost::io::format_error& e) {
ErrorLogger() << "main() caught exception(boost::io::format_error): " << e.what();
std::cerr << "main() caught exception(boost::io::format_error): " << e.what() << std::endl;
} catch (const GG::ExceptionBase& e) {
ErrorLogger() << "main() caught exception(" << e.type() << "): " << e.what();
std::cerr << "main() caught exception(" << e.type() << "): " << e.what() << std::endl;
} catch (const std::exception& e) {
ErrorLogger() << "main() caught exception(std::exception): " << e.what();
std::cerr << "main() caught exception(std::exception): " << e.what() << std::endl;
} catch (...) {
ErrorLogger() << "main() caught unknown exception.";
std::cerr << "main() caught unknown exception." << std::endl;
}
return 0;
}
示例2: switch
INT_PTR CSettingsDialog::DlgProc(HWND hDlg,UINT uMsg,WPARAM wParam,LPARAM lParam)
{
switch (uMsg) {
case WM_INITDIALOG:
{
::SetWindowText(hDlg,GetTitle());
DeleteAllPages();
for (int i=0;;i++) {
CPage *pPage=CreatePage(i);
if (pPage==nullptr)
break;
m_PageList.push_back(pPage);
::SendDlgItemMessage(hDlg,IDC_SETTINGS_LIST,LB_ADDSTRING,0,i);
}
int Page=0;
if (m_StartPage>=0 && m_StartPage<(int)m_PageList.size())
Page=m_StartPage;
else if (m_CurrentPage>=0 && m_CurrentPage<(int)m_PageList.size())
Page=m_CurrentPage;
m_CurrentPage=-1;
if (SetPage(Page)) {
::SendDlgItemMessage(hDlg,IDC_SETTINGS_LIST,LB_SETCURSEL,Page,0);
}
m_himlIcons=::ImageList_LoadImage(m_hinst,MAKEINTRESOURCE(IDB_SETTINGS),16,1,
CLR_NONE,IMAGE_BITMAP,LR_CREATEDIBSECTION);
LRESULT ItemHeight=::SendDlgItemMessage(hDlg,IDC_SETTINGS_LIST,LB_GETITEMHEIGHT,0,0);
if (ItemHeight<16+8)
::SendDlgItemMessage(hDlg,IDC_SETTINGS_LIST,LB_SETITEMHEIGHT,0,16+8);
AdjustPos();
}
return TRUE;
case WM_DRAWITEM:
{
LPDRAWITEMSTRUCT pdis=reinterpret_cast<LPDRAWITEMSTRUCT>(lParam);
if (wParam==IDC_SETTINGS_LIST) {
if (pdis->itemData>=m_PageList.size())
break;
const CPage *pPage=m_PageList[pdis->itemData];
const bool fSelected=(pdis->itemState&ODS_SELECTED)!=0;
COLORREF crText,crOldText;
int OldBkMode;
RECT rcBack,rcText;
rcBack=pdis->rcItem;
rcBack.left+=4+16+4;
if (fSelected) {
RECT rc=pdis->rcItem;
rc.right=rcBack.left;
::FillRect(pdis->hDC,&rc,
reinterpret_cast<HBRUSH>(COLOR_WINDOW+1));
FillGradient(pdis->hDC,rcBack,
RGB(0,0,0),pPage->GetTitleColor());
crText=RGB(255,255,255);
} else {
::FillRect(pdis->hDC,&pdis->rcItem,
reinterpret_cast<HBRUSH>(COLOR_WINDOW+1));
crText=::GetSysColor(COLOR_WINDOWTEXT);
}
::ImageList_Draw(m_himlIcons,pPage->GetIcon(),pdis->hDC,
pdis->rcItem.left+4,
rcBack.top+((rcBack.bottom-rcBack.top)-16)/2,
ILD_TRANSPARENT);
rcText=rcBack;
rcText.left+=4;
rcText.right-=4;
crOldText=::SetTextColor(pdis->hDC,crText);
OldBkMode=::SetBkMode(pdis->hDC,TRANSPARENT);
::DrawText(pdis->hDC,pPage->GetTitle(),-1,
&rcText,DT_LEFT | DT_SINGLELINE | DT_VCENTER | DT_NOPREFIX);
::SetTextColor(pdis->hDC,crOldText);
::SetBkMode(pdis->hDC,OldBkMode);
if ((pdis->itemState & (ODS_FOCUS | ODS_NOFOCUSRECT))==ODS_FOCUS) {
::DrawFocusRect(pdis->hDC,&rcBack);
}
} else if (wParam==IDC_SETTINGS_TITLE) {
if (m_CurrentPage<0 || (size_t)m_CurrentPage>=m_PageList.size())
break;
CPage *pPage=m_PageList[m_CurrentPage];
RECT rc;
FillGradient(pdis->hDC,pdis->rcItem,
RGB(0,0,0),pPage->GetTitleColor());
LOGFONT lf;
::GetObject(reinterpret_cast<HFONT>(::SendMessage(hDlg,WM_GETFONT,0,0)),sizeof(lf),&lf);
lf.lfWeight=FW_BOLD;
HFONT hfont=::CreateFontIndirect(&lf);
HFONT hfontOld=SelectFont(pdis->hDC,hfont);
COLORREF crOldText=::SetTextColor(pdis->hDC,RGB(255,255,255));
//.........这里部分代码省略.........
示例3: WinMain
int APIENTRY
WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine,
int nCmdShow)
{
INITCOMMONCONTROLSEX InitCtrls;
int argc;
char *argv[MAX_CMDLINE_PARAM];
size_t len;
TCHAR *p;
TCHAR wbuf[BUFSZ];
char buf[BUFSZ];
DWORD major, minor;
boolean resuming;
/* OSVERSIONINFO osvi; */
UNREFERENCED_PARAMETER(hPrevInstance);
UNREFERENCED_PARAMETER(lpCmdLine);
UNREFERENCED_PARAMETER(nCmdShow);
sys_early_init();
/* ensure that we don't access violate on a panic() */
windowprocs.win_raw_print = mswin_raw_print;
windowprocs.win_raw_print_bold = mswin_raw_print_bold;
/* init applicatio structure */
_nethack_app.hApp = hInstance;
_nethack_app.hAccelTable =
LoadAccelerators(hInstance, (LPCTSTR) IDC_NETHACKW);
_nethack_app.hMainWnd = NULL;
_nethack_app.hPopupWnd = NULL;
_nethack_app.bmpTiles = LoadBitmap(hInstance, MAKEINTRESOURCE(IDB_TILES));
if (_nethack_app.bmpTiles == NULL)
panic("cannot load tiles bitmap");
_nethack_app.bmpPetMark =
LoadBitmap(hInstance, MAKEINTRESOURCE(IDB_PETMARK));
if (_nethack_app.bmpPetMark == NULL)
panic("cannot load pet mark bitmap");
#ifdef USE_PILEMARK
_nethack_app.bmpPileMark =
LoadBitmap(hInstance, MAKEINTRESOURCE(IDB_PILEMARK));
if (_nethack_app.bmpPileMark == NULL)
panic("cannot load pile mark bitmap");
#endif
_nethack_app.bmpRip = LoadBitmap(hInstance, MAKEINTRESOURCE(IDB_RIP));
if (_nethack_app.bmpRip == NULL)
panic("cannot load rip bitmap");
_nethack_app.bmpSplash =
LoadBitmap(hInstance, MAKEINTRESOURCE(IDB_SPLASH));
if (_nethack_app.bmpSplash == NULL)
panic("cannot load splash bitmap");
_nethack_app.bmpMapTiles = _nethack_app.bmpTiles;
_nethack_app.mapTile_X = TILE_X;
_nethack_app.mapTile_Y = TILE_Y;
_nethack_app.mapTilesPerLine = TILES_PER_LINE;
_nethack_app.bNoHScroll = FALSE;
_nethack_app.bNoVScroll = FALSE;
_nethack_app.saved_text = strdup("");
_nethack_app.bAutoLayout = TRUE;
_nethack_app.bWindowsLocked = TRUE;
_nethack_app.bNoSounds = FALSE;
#if 0 /* GdiTransparentBlt does not render spash bitmap for whatever reason */
/* use system-provided TransparentBlt for Win2k+ */
ZeroMemory(&osvi, sizeof(OSVERSIONINFO));
osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
GetVersionEx(&osvi);
if (osvi.dwMajorVersion >= 5)
_nethack_app.lpfnTransparentBlt = GdiTransparentBlt;
else
#endif
_nethack_app.lpfnTransparentBlt = _nhapply_image_transparent;
// init controls
if (FAILED(GetComCtlVersion(&major, &minor))) {
char buf[TBUFSZ];
Sprintf(buf, "Cannot load common control library.\n%s\n%s",
"For further information, refer to the installation notes at",
INSTALL_NOTES);
panic(buf);
}
if (major < MIN_COMCTLMAJOR
|| (major == MIN_COMCTLMAJOR && minor < MIN_COMCTLMINOR)) {
char buf[TBUFSZ];
Sprintf(buf, "Common control library is outdated.\n%s %d.%d\n%s\n%s",
"NetHack requires at least version ", MIN_COMCTLMAJOR,
MIN_COMCTLMINOR,
"For further information, refer to the installation notes at",
INSTALL_NOTES);
panic(buf);
}
ZeroMemory(&InitCtrls, sizeof(InitCtrls));
InitCtrls.dwSize = sizeof(InitCtrls);
InitCtrls.dwICC = ICC_LISTVIEW_CLASSES;
InitCommonControlsEx(&InitCtrls);
/* get command line parameters */
//.........这里部分代码省略.........
示例4: UpdateData
void CSetBugTraqAdv::OnOK()
{
UpdateData();
if (m_sPath.IsEmpty() || !PathIsDirectory(m_sPath) || PathIsRelative(m_sPath))
{
ShowEditBalloon(IDC_BUGTRAQPATH, (LPCTSTR)CFormatMessageWrapper(ERROR_PATH_NOT_FOUND), CString(MAKEINTRESOURCE(IDS_ERR_ERROR)), TTI_ERROR);
return;
}
m_provider_clsid = GUID_NULL;
int index = m_cProviderCombo.GetCurSel();
if (index != CB_ERR)
{
CBugTraqProvider *provider = (CBugTraqProvider *)m_cProviderCombo.GetItemDataPtr(index);
m_provider_clsid = provider->clsid;
}
CComPtr<IBugTraqProvider> pProvider;
HRESULT hr = pProvider.CoCreateInstance(m_provider_clsid);
if (FAILED(hr))
{
m_tooltips.ShowBalloon(IDC_BUGTRAQPROVIDERCOMBO, IDS_ERR_MISSING_PROVIDER, IDS_ERR_ERROR, TTI_ERROR);
return;
}
VARIANT_BOOL valid;
ATL::CComBSTR parameters(m_sParameters);
hr = pProvider->ValidateParameters(GetSafeHwnd(), parameters, &valid);
if (FAILED(hr))
{
ShowEditBalloon(IDC_BUGTRAQPARAMETERS, IDS_ERR_PROVIDER_VALIDATE_FAILED, IDS_ERR_ERROR, TTI_ERROR);
return;
}
if (valid != VARIANT_TRUE)
return; // It's assumed that the provider will have done this.
CResizableStandAloneDialog::OnOK();
}
示例5: OnInitDialog
static int OnInitDialog(HWND hDlg, LPARAM lParam)
{
TFileTestData * pData;
PROPSHEETPAGE * pPage = (PROPSHEETPAGE *)lParam;
HWND hCombo = GetDlgItem(hDlg, IDC_CREATE_DISPOSITION);
SetDialogData(hDlg, pPage->lParam);
pData = (TFileTestData *)pPage->lParam;
// Configure dialog resizing
if(pData->bEnableResizing)
{
pAnchors = new TAnchors();
pAnchors->AddAnchor(hDlg, IDC_MAIN_FRAME, akAll);
pAnchors->AddAnchor(hDlg, IDC_DIRECTORY_NAME, akLeft | akTop | akRight);
pAnchors->AddAnchor(hDlg, IDC_DIRECTORY_NAME_BROWSE, akTop | akRight);
pAnchors->AddAnchor(hDlg, IDC_FILE_NAME, akLeft | akTop | akRight);
pAnchors->AddAnchor(hDlg, IDC_FILE_NAME_BROWSE, akTop | akRight);
pAnchors->AddAnchor(hDlg, IDC_OBJ_ATTR_FLAGS, akLeft | akTop | akRight);
pAnchors->AddAnchor(hDlg, IDC_OBJ_ATTR_FLAGS_BROWSE, akTop | akRight);
pAnchors->AddAnchor(hDlg, IDC_DESIRED_ACCESS, akLeft | akTop | akRight);
pAnchors->AddAnchor(hDlg, IDC_DESIRED_ACCESS_BROWSE, akTop | akRight);
pAnchors->AddAnchor(hDlg, IDC_ALLOCATION_SIZE, akLeft | akTop | akRight);
pAnchors->AddAnchor(hDlg, IDC_ALLOCATION_SIZE_UPDOWN, akTop | akRight);
pAnchors->AddAnchor(hDlg, IDC_FILE_ATTRIBUTES, akLeft | akTop | akRight);
pAnchors->AddAnchor(hDlg, IDC_FILE_ATTRIBUTES_BROWSE, akTop | akRight);
pAnchors->AddAnchor(hDlg, IDC_SHARE_ACCESS, akLeft | akTop | akRight);
pAnchors->AddAnchor(hDlg, IDC_SHARE_ACCESS_BROWSE, akTop | akRight);
pAnchors->AddAnchor(hDlg, IDC_CREATE_DISPOSITION, akLeft | akTop | akRight);
pAnchors->AddAnchor(hDlg, IDC_CREATE_OPTIONS, akLeft | akTop | akRight);
pAnchors->AddAnchor(hDlg, IDC_CREATE_OPTIONS_BROWSE, akTop | akRight);
pAnchors->AddAnchor(hDlg, IDC_EXTENDED_ATTRIBUTES, akLeft | akTop | akRight);
pAnchors->AddAnchor(hDlg, IDC_EXTENDED_ATTRIBUTES_EDIT, akTop | akRight);
pAnchors->AddAnchor(hDlg, IDC_TRANSACTED, akLeft | akRight | akBottom);
pAnchors->AddAnchor(hDlg, IDC_VIRTUALIZATION, akLeft | akRight | akBottom);
pAnchors->AddAnchor(hDlg, IDC_BREAKPOINT, akLeft | akRight | akBottom);
pAnchors->AddAnchor(hDlg, IDC_PRIVILEGES, akLeft | akBottom);
pAnchors->AddAnchor(hDlg, IDC_MAKE_DIRECTORY, akLeft | akBottom);
pAnchors->AddAnchor(hDlg, IDC_CREATE_FILE, akRight | akBottom);
pAnchors->AddAnchor(hDlg, IDC_CLOSE_HANDLE, akRight | akBottom);
pAnchors->AddAnchor(hDlg, IDC_RESULT_FRAME, akLeft | akRight | akBottom);
pAnchors->AddAnchor(hDlg, IDC_RESULT_STATUS_TITLE, akLeft | akBottom);
pAnchors->AddAnchor(hDlg, IDC_RESULT_STATUS, akLeft | akRight | akBottom);
pAnchors->AddAnchor(hDlg, IDC_HANDLE_TITLE, akLeft | akBottom);
pAnchors->AddAnchor(hDlg, IDC_HANDLE, akLeft | akRight | akBottom);
pAnchors->AddAnchor(hDlg, IDC_NTCREATE_RESULT_TITLE, akLeft | akBottom);
pAnchors->AddAnchor(hDlg, IDC_NTCREATE_RESULT, akLeft | akRight | akBottom);
}
// Initialize the "Relative File" hyperlink
InitURLButton(hDlg, IDC_RELATIVE_FILE_HELP, FALSE);
// Initialize the combo box
InitDialogControls(hDlg, MAKEINTRESOURCE(IDD_PAGE02_NTCREATE));
if(hCombo != NULL)
ComboBox_SetCurSel(hCombo, pData->dwCreateDisposition2);
// If we have a tooltip window, init tooltips
g_Tooltip.AddToolTip(hDlg, IDC_OBJ_ATTR_FLAGS, ObjAttrFlagsValues);
g_Tooltip.AddToolTip(hDlg, IDC_DESIRED_ACCESS, DesiredAccessValues);
g_Tooltip.AddToolTip(hDlg, IDC_FILE_ATTRIBUTES, FileAttributesValues);
g_Tooltip.AddToolTip(hDlg, IDC_SHARE_ACCESS, ShareAccessValues);
g_Tooltip.AddToolTip(hDlg, IDC_CREATE_OPTIONS, CreateOptionsValues);
// On pre-Vista, disable the virtualization button
if(g_dwWinVer < 0x0600)
EnableDlgItems(hDlg, FALSE, IDC_VIRTUALIZATION, 0);
return TRUE;
}
示例6: AddCustomFileDialogProc
intptr_t CALLBACK AddCustomFileDialogProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch (uMsg)
{
case WM_INITDIALOG:
{
CenterWindow(hDlg);
hIcon = LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_MAMEUI_ICON));
SendMessage(hDlg, WM_SETICON, ICON_SMALL, (LPARAM)hIcon);
hBrush = CreateSolidBrush(RGB(240, 240, 240));
if (IsWindowsSevenOrHigher())
SendMessage(GetDlgItem(hDlg, IDC_CUSTOM_TREE), TVM_SETEXTENDEDSTYLE, TVS_EX_DOUBLEBUFFER, TVS_EX_DOUBLEBUFFER);
SetWindowTheme(GetDlgItem(hDlg, IDC_CUSTOM_TREE), L"Explorer", NULL);
TREEFOLDER **folders;
int num_folders = 0;
TVINSERTSTRUCT tvis;
TVITEM tvi;
bool first_entry = true;
HIMAGELIST treeview_icons = GetTreeViewIconList();
// current game passed in using DialogBoxParam()
driver_index = lParam;
(void)TreeView_SetImageList(GetDlgItem(hDlg, IDC_CUSTOM_TREE), treeview_icons, LVSIL_NORMAL);
GetFolders(&folders, &num_folders);
// insert custom folders into our tree view
for (int i = 0; i < num_folders; i++)
{
if (folders[i]->m_dwFlags & F_CUSTOM)
{
HTREEITEM hti;
if (folders[i]->m_nParent == -1)
{
memset(&tvi, 0, sizeof(TVITEM));
tvis.hParent = TVI_ROOT;
tvis.hInsertAfter = TVI_SORT;
tvi.mask = TVIF_TEXT | TVIF_PARAM | TVIF_IMAGE | TVIF_SELECTEDIMAGE;
tvi.pszText = folders[i]->m_lptTitle;
tvi.lParam = (LPARAM)folders[i];
tvi.iImage = GetTreeViewIconIndex(folders[i]->m_nIconId);
tvi.iSelectedImage = 0;
tvis.item = tvi;
hti = TreeView_InsertItem(GetDlgItem(hDlg, IDC_CUSTOM_TREE), &tvis);
/* look for children of this custom folder */
for (int jj = 0; jj < num_folders; jj++)
{
if (folders[jj]->m_nParent == i)
{
HTREEITEM hti_child;
tvis.hParent = hti;
tvis.hInsertAfter = TVI_SORT;
tvi.mask = TVIF_TEXT | TVIF_PARAM | TVIF_IMAGE | TVIF_SELECTEDIMAGE;
tvi.pszText = folders[jj]->m_lptTitle;
tvi.lParam = (LPARAM)folders[jj];
tvi.iImage = GetTreeViewIconIndex(folders[jj]->m_nIconId);
tvi.iSelectedImage = 0;
tvis.item = tvi;
hti_child = TreeView_InsertItem(GetDlgItem(hDlg, IDC_CUSTOM_TREE), &tvis);
if (folders[jj] == default_selection)
(void)TreeView_SelectItem(GetDlgItem(hDlg, IDC_CUSTOM_TREE), hti_child);
}
}
/*TreeView_Expand(GetDlgItem(hDlg,IDC_CUSTOM_TREE),hti,TVE_EXPAND);*/
if (first_entry || folders[i] == default_selection)
{
(void)TreeView_SelectItem(GetDlgItem(hDlg, IDC_CUSTOM_TREE),hti);
first_entry = false;
}
}
}
}
winui_set_window_text_utf8(GetDlgItem(hDlg, IDC_CUSTOMFILE_GAME), GetDriverGameTitle(driver_index));
return true;
}
case WM_CTLCOLORDLG:
return (LRESULT) hBrush;
case WM_CTLCOLORSTATIC:
case WM_CTLCOLORBTN:
hDC = (HDC)wParam;
SetBkMode(hDC, TRANSPARENT);
SetTextColor(hDC, GetSysColor(COLOR_WINDOWTEXT));
return (LRESULT) hBrush;
case WM_COMMAND:
switch (GET_WM_COMMAND_ID(wParam, lParam))
{
case IDOK:
{
//.........这里部分代码省略.........
示例7: DialogBoxParam
/////////////////////////////////////////////////////////////////////////////
// ULONG CS3Dialog::Display
//
/////////////////////////////////////////////////////////////////////////////
INT_PTR CS3Dialog::Display()
{
//Create a modal dialog box
return DialogBoxParam(m_hInst, MAKEINTRESOURCE(IDD_TO_INFO), NULL, (DLGPROC)DlgProc, (LPARAM)this);
}
示例8:
#include "menu.h"
#include "np2class.h"
#include "dialog.h"
#include "dialogs.h"
#include "pccore.h"
#include "iocore.h"
#include "sound.h"
#include "fmboard.h"
#include "s98.h"
#include "tms3631.h"
#include "dipswbmp.h"
#include "recvideo.h"
static const CBPARAM cpIO26[] =
{
{MAKEINTRESOURCE(IDS_0088), 0x00},
{MAKEINTRESOURCE(IDS_0188), 0x10},
};
static const CBPARAM cpIO86[] =
{
{MAKEINTRESOURCE(IDS_0188), 0x01},
{MAKEINTRESOURCE(IDS_0288), 0x00},
};
static const CBPARAM cpInt26[] =
{
{MAKEINTRESOURCE(IDS_INT0), 0x00},
{MAKEINTRESOURCE(IDS_INT41), 0x80},
{MAKEINTRESOURCE(IDS_INT5), 0xc0},
{MAKEINTRESOURCE(IDS_INT6), 0x40},
示例9: setupResources
bool BaseManager::create()
{
Ogre::String pluginsPath;
#ifndef OGRE_STATIC_LIB
pluginsPath = mResourcePath + mPluginCfgName;
#endif
mRoot = new Ogre::Root(pluginsPath, mResourcePath + "ogre.cfg", mResourcePath + "Ogre.log");
setupResources();
// попробуем завестись на дефолтных
if (!mRoot->restoreConfig())
{
// ничего не получилось, покажем диалог
if (!mRoot->showConfigDialog()) return false;
}
mWindow = mRoot->initialise(true);
#if MYGUI_PLATFORM == MYGUI_PLATFORM_WIN32
// вытаскиваем дискриптор окна
size_t hWnd = 0;
mWindow->getCustomAttribute("WINDOW", &hWnd);
// берем имя нашего экзешника
char buf[MAX_PATH];
::GetModuleFileNameA(0, (LPCH)&buf, MAX_PATH);
// берем инстанс нашего модуля
HINSTANCE instance = ::GetModuleHandleA(buf);
// побыстрому грузим иконку
HICON hIcon = ::LoadIcon(instance, MAKEINTRESOURCE(1001));
if (hIcon)
{
::SendMessageA((HWND)hWnd, WM_SETICON, 1, (LPARAM)hIcon);
::SendMessageA((HWND)hWnd, WM_SETICON, 0, (LPARAM)hIcon);
}
#endif
mSceneManager = mRoot->createSceneManager(Ogre::ST_GENERIC, "BaseSceneManager");
mCamera = mSceneManager->createCamera("BaseCamera");
mCamera->setNearClipDistance(5);
mCamera->setPosition(400, 400, 400);
mCamera->lookAt(0, 150, 0);
// Create one viewport, entire window
Ogre::Viewport* vp = mWindow->addViewport(mCamera);
// Alter the camera aspect ratio to match the viewport
mCamera->setAspectRatio((float)vp->getActualWidth() / (float)vp->getActualHeight());
// Set default mipmap level (NB some APIs ignore this)
Ogre::TextureManager::getSingleton().setDefaultNumMipmaps(5);
mSceneManager->setAmbientLight(Ogre::ColourValue::White);
Ogre::Light* light = mSceneManager->createLight("MainLight");
light->setType(Ogre::Light::LT_DIRECTIONAL);
Ogre::Vector3 vec(-0.3, -0.3, -0.3);
vec.normalise();
light->setDirection(vec);
// Load resources
Ogre::ResourceGroupManager::getSingleton().initialiseAllResourceGroups();
mRoot->addFrameListener(this);
Ogre::WindowEventUtilities::addWindowEventListener(mWindow, this);
size_t handle = 0;
mWindow->getCustomAttribute("WINDOW", &handle);
createGui();
createInput(handle);
createPointerManager(handle);
createScene();
windowResized(mWindow);
return true;
}
示例10: FontEditCommand
//.........这里部分代码省略.........
}
if (w < 0 || w >= wBoxLim) {
MessageBox(hBox,
(LPSTR)vszEdLimits0To64,
(LPSTR)szAppName,
MB_OK | MB_ICONASTERISK);
break; /* Out of range! quit */
}
if (w > (LONG) font.MaxWidth) {
if (IDOK == MessageBox(hBox,
(LPSTR)vszMaxWidthIncrease,
(LPSTR)szAppName,
MB_OKCANCEL | MB_ICONQUESTION))
font.MaxWidth = (WORD)w;
else
break;
}
BoxBackup(); /* In case we change our minds */
wBox = (WORD)w; /* Reset width */
fRepaint = TRUE; /* Signal redraw */
switch (id) {
case WIDER_LEFT:
#ifdef DBCS //DBCS_FIX
DupCol(0, kBoxLim - 1);
for (y = 0; y < kBoxLim; y++)
matBox[0][y] = FALSE; /* Clear left column */
break;
#endif
case WIDER_BOTH: /* Shift character one right */
DupCol(0, kBoxLim - 1);
for (y = 0; y < kBoxLim; y++)
matBox[wBox -1][y] = FALSE; /* Clear right column */
for (y = 0; y < kBoxLim; y++)
matBox[0][y] = FALSE; /* Clear left column */
break;
case NARROWER_LEFT:
case NARROWER_BOTH: /* Shift character one left */
if (wBox) { /* .. unless width is already 0 */
for (j = 0; j <= kBox - 1; j++)
for (i = 0; i <= wBox - 1; i++)
matBox[i][j] = matBox[i + 1][j];
break;
}
}
}
else {
MessageBox(hBox,
(LPSTR)vszCannotChangeWidth,
(LPSTR)szAppName,
MB_OK | MB_ICONASTERISK);
}
break;
case ROW_ADD:
case ROW_DEL:
case COL_ADD:
case COL_DEL:
/* set cursor to "+" shaped cursor */
SetCapture (hBox); /* so that cursor doesn't get restored
before we are done */
hOldCursor = SetCursor (LoadCursor (NULL, IDC_CROSS));
fCaptured = TRUE;
cursor = id;
break;
case BOX_CLEAR:
case BOX_FILL:
case BOX_INV:
case BOX_HATCH:
case BOX_LEFTRIGHT:
case BOX_TOPBOTTOM:
case BOX_COPY:
case BOX_PASTE:
/* Get one o' da funky cursors */
SetCapture(hBox);
hOldCursor = SetCursor(LoadCursor(hInst, MAKEINTRESOURCE(id)));
fStartRubberBand = TRUE;
CharRectDimensions((LPRECT)&FontRect);
cursor = id;
break;
case BOX_REFRESH: /* Go get old version of character */
BoxBackup(); /* In case we change our minds */
CharToBox(iChar);
hMenu = GetMenu(hBox);
EnableMenuItem(hMenu, BOX_UNDO, MF_ENABLED); /* Can Unrefresh! */
break;
case BOX_UNDO:
BoxRestore();
hMenu = GetMenu(hBox);
EnableMenuItem(hMenu, BOX_REFRESH, MF_ENABLED);
fRepaint = TRUE;
break;
}
if (fRepaint) {
fEdited = fChanged = TRUE;
InvalidateRect(hBox, (LPRECT)NULL, TRUE);
}
}
示例11: WndProc
//.........这里部分代码省略.........
break;
}
hPlay = CreateWindow(TEXT("BUTTON"), //PLAYボタンを子ウインドウとして作る
TEXT("PLAY"), WS_CHILD | WS_VISIBLE,
10, 10, 100, 30, hWnd, (HMENU)ID_PLAY, hInst, NULL);
hStop = CreateWindow(TEXT("BUTTON"), //STOPボタンを子ウインドウとして作る
TEXT("STOP"), WS_CHILD | WS_VISIBLE,
10, 50, 100, 30, hWnd, (HMENU)ID_STOP, hInst, NULL);
EnableWindow(hStop, FALSE);
break;
case WM_COMMAND:
wmId = LOWORD(wParam);
wmEvent = HIWORD(wParam);
// 選択されたメニューの解析:
switch (wmId)
{
case ID_PLAY: //PLAYボタンの処理
//CDの有無をチェック
sp.dwItem = MCI_STATUS_MEDIA_PRESENT;
err = mciSendCommand(op.wDeviceID,
MCI_STATUS, MCI_STATUS_ITEM | MCI_WAIT,
(DWORD_PTR)&sp);
if (err != 0){
mciGetErrorString(err, szErr, (UINT)sizeof(szErr));
MessageBox(hWnd, szErr, TEXT("エラー"), MB_OK);
break;
}
if (!sp.dwReturn) {
MessageBox(hWnd, TEXT("CDがセットされていません"), TEXT("エラー"), MB_OK);
break;
}
//CDを再生
err = mciSendCommand(op.wDeviceID, MCI_PLAY, 0, 0);
if (err != 0){
mciGetErrorString(err, szErr, (UINT)sizeof(szErr));
MessageBox(hWnd, szErr, TEXT("エラー"), MB_OK);
break;
}
EnableWindow(hPlay, FALSE);
EnableWindow(hStop, TRUE);
bPlay = TRUE;
break;
case ID_STOP: //STOPボタンの処理
//CDの再生を中止
err = mciSendCommand(op.wDeviceID, MCI_STOP, 0, 0);
if (err != 0){
mciGetErrorString(err, szErr, (UINT)sizeof(szErr));
MessageBox(hWnd, szErr, TEXT("エラー"), MB_OK);
break;
}
EnableWindow(hPlay, TRUE);
EnableWindow(hStop, FALSE);
bPlay = FALSE;
break;
case IDM_ABOUT:
DialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUTBOX), hWnd, About);
break;
case IDM_EXIT:
DestroyWindow(hWnd);
break;
default:
return DefWindowProc(hWnd, message, wParam, lParam);
}
break;
case WM_PAINT:
hdc = BeginPaint(hWnd, &ps);
// TODO: 描画コードをここに追加してください...
EndPaint(hWnd, &ps);
break;
case WM_CLOSE:
id = MessageBox(hWnd, TEXT("終了してよろしいですか"),
TEXT("終了確認"), MB_YESNO);
if (id == IDYES) {
if (bPlay) {
//再生中であれば再生を中止
mciSendCommand(op.wDeviceID, MCI_STOP, 0, 0);
}
//デバイスをクローズ
mciSendCommand(op.wDeviceID, MCI_CLOSE, 0, 0);
//リソースを開放
DestroyWindow(hPlay);
DestroyWindow(hStop);
DestroyWindow(hWnd);
}
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
return DefWindowProc(hWnd, message, wParam, lParam);
}
return 0;
}
示例12: InterfaceDialogProc
intptr_t CALLBACK InterfaceDialogProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch (uMsg)
{
case WM_INITDIALOG:
{
char buffer[200];
int value = 0;
CenterWindow(hDlg);
hIcon = LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_MAMEUI_ICON));
SendMessage(hDlg, WM_SETICON, ICON_SMALL, (LPARAM)hIcon);
hBrush = CreateSolidBrush(RGB(240, 240, 240));
DisableVisualStylesInterface(hDlg);
Button_SetCheck(GetDlgItem(hDlg, IDC_JOY_GUI), GetJoyGUI());
Button_SetCheck(GetDlgItem(hDlg, IDC_DISABLE_TRAY_ICON), GetMinimizeTrayIcon());
Button_SetCheck(GetDlgItem(hDlg, IDC_DISPLAY_NO_ROMS), GetDisplayNoRomsGames());
Button_SetCheck(GetDlgItem(hDlg, IDC_EXIT_DIALOG), GetExitDialog());
Button_SetCheck(GetDlgItem(hDlg, IDC_USE_BROKEN_ICON), GetUseBrokenIcon());
Button_SetCheck(GetDlgItem(hDlg, IDC_STRETCH_SCREENSHOT_LARGER), GetStretchScreenShotLarger());
Button_SetCheck(GetDlgItem(hDlg, IDC_FILTER_INHERIT), GetFilterInherit());
Button_SetCheck(GetDlgItem(hDlg, IDC_ENABLE_FASTAUDIT), GetEnableFastAudit());
Button_SetCheck(GetDlgItem(hDlg, IDC_ENABLE_SEVENZIP), GetEnableSevenZip());
// Get the current value of the control
SendMessage(GetDlgItem(hDlg, IDC_CYCLETIMESEC), TBM_SETRANGE, true, MAKELPARAM(0, 60)); /* [0, 60] */
SendMessage(GetDlgItem(hDlg, IDC_CYCLETIMESEC), TBM_SETTICFREQ, 5, 0);
value = GetCycleScreenshot();
SendMessage(GetDlgItem(hDlg, IDC_CYCLETIMESEC), TBM_SETPOS, true, value);
snprintf(buffer, WINUI_ARRAY_LENGTH(buffer), "%d", value);
winui_set_window_text_utf8(GetDlgItem(hDlg, IDC_CYCLETIMESECTXT), buffer);
for (int i = 0; i < NUMHISTORYTAB; i++)
{
(void)ComboBox_InsertString(GetDlgItem(hDlg, IDC_HISTORY_TAB), i, g_ComboBoxHistoryTab[i].m_pText);
(void)ComboBox_SetItemData(GetDlgItem(hDlg, IDC_HISTORY_TAB), i, g_ComboBoxHistoryTab[i].m_pData);
}
if (GetHistoryTab() < MAX_TAB_TYPES)
(void)ComboBox_SetCurSel(GetDlgItem(hDlg, IDC_HISTORY_TAB), GetHistoryTab());
else
(void)ComboBox_SetCurSel(GetDlgItem(hDlg, IDC_HISTORY_TAB), GetHistoryTab() - TAB_SUBTRACT);
SendMessage(GetDlgItem(hDlg, IDC_SCREENSHOT_BORDERSIZE), TBM_SETRANGE, true, MAKELPARAM(0, 50)); /* [0, 50] */
SendMessage(GetDlgItem(hDlg, IDC_SCREENSHOT_BORDERSIZE), TBM_SETTICFREQ, 5, 0);
value = GetScreenshotBorderSize();
SendMessage(GetDlgItem(hDlg, IDC_SCREENSHOT_BORDERSIZE), TBM_SETPOS, true, value);
snprintf(buffer, WINUI_ARRAY_LENGTH(buffer), "%d", value);
winui_set_window_text_utf8(GetDlgItem(hDlg, IDC_SCREENSHOT_BORDERSIZETXT), buffer);
EnableWindow(GetDlgItem(hDlg, IDC_ENABLE_SEVENZIP), GetEnableFastAudit() ? true : false);
break;
}
case WM_CTLCOLORDLG:
return (LRESULT) hBrush;
case WM_CTLCOLORSTATIC:
case WM_CTLCOLORBTN:
hDC = (HDC)wParam;
SetBkMode(hDC, TRANSPARENT);
SetTextColor(hDC, GetSysColor(COLOR_WINDOWTEXT));
return (LRESULT) hBrush;
case WM_HSCROLL:
HANDLE_WM_HSCROLL(hDlg, wParam, lParam, OnHScroll);
break;
case WM_COMMAND:
switch (GET_WM_COMMAND_ID(wParam, lParam))
{
case IDC_SCREENSHOT_BORDERCOLOR:
{
CHOOSECOLOR cc;
COLORREF choice_colors[16];
for (int i = 0; i < 16; i++)
choice_colors[i] = GetCustomColor(i);
cc.lStructSize = sizeof(CHOOSECOLOR);
cc.hwndOwner = hDlg;
cc.lpfnHook = &CCHookProc;
cc.rgbResult = GetScreenshotBorderColor();
cc.lpCustColors = choice_colors;
cc.Flags = CC_ANYCOLOR | CC_RGBINIT | CC_FULLOPEN | CC_ENABLEHOOK;
if (!ChooseColor(&cc))
return true;
for (int i = 0; i < 16; i++)
SetCustomColor(i,choice_colors[i]);
SetScreenshotBorderColor(cc.rgbResult);
UpdateScreenShot();
return true;
}
case IDC_ENABLE_FASTAUDIT:
{
bool enabled = Button_GetCheck(GetDlgItem(hDlg, IDC_ENABLE_FASTAUDIT));
EnableWindow(GetDlgItem(hDlg, IDC_ENABLE_SEVENZIP), enabled ? true : false);
return true;
//.........这里部分代码省略.........
示例13: WndProc
//
// FUNCIÓN: WndProc(HWND, UINT, WPARAM, LPARAM)
//
// PROPÓSITO: procesar mensajes de la ventana principal.
//
// WM_COMMAND : procesar el menú de aplicación
// WM_PAINT : pintar la ventana principal
// WM_DESTROY : enviar un mensaje de finalización y volver
//
//
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
int wmId, wmEvent;
PAINTSTRUCT ps;
HDC hdc;
switch (message)
{
case WM_COMMAND:
wmId = LOWORD(wParam);
wmEvent = HIWORD(wParam);
// Analizar las selecciones de menú:
switch (wmId)
{
case IDM_BLIST:
serverManager.ReadBlackList(BLISTFILE);
break;
case IDM_SLIST:
serverManager.ReadList(SLISTFILE);
break;
case IDM_ULIST:
serverManager.ReadUpdateConfig();
break;
case IDM_ABOUT:
DialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUTBOX), hWnd, About);
break;
case IDM_EXIT:
DestroyWindow(hWnd);
break;
default:
return DefWindowProc(hWnd, message, wParam, lParam);
}
break;
case WM_TIMER:
switch ( wParam )
{
case WM_LOG_PAINT:
{
RECT rect;
HDC hdc = GetDC(hWnd);
GetClientRect(hWnd, &rect);
FillRect(hdc, &rect, (HBRUSH)GetStockObject(0));
ReleaseDC(hWnd, hdc);
if ( LogTextPaint != NULL )
LogTextPaint(hWnd);
//g_ServerInfoDisplayer.Run(hWnd);
}
break;
case WM_LOG_DATE_CHANGE:
LogDateChange();
break;
case WM_SECONDPROC:
{
OBJSecondProc();
}break;
}
break;
//case WM_PAINT:
// hdc = BeginPaint(hWnd, &ps);
// // TODO: agregar código de dibujo aquí...
// EndPaint(hWnd, &ps);
// break;
case WM_DESTROY:
DestroyIocp();
PostQuitMessage(0);
break;
default:
return DefWindowProc(hWnd, message, wParam, lParam);
}
return 0;
}
示例14: FilterDialogProc
intptr_t CALLBACK FilterDialogProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch (uMsg)
{
case WM_INITDIALOG:
{
CenterWindow(hDlg);
hIcon = LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_MAMEUI_ICON));
SendMessage(hDlg, WM_SETICON, ICON_SMALL, (LPARAM)hIcon);
hBrush = CreateSolidBrush(RGB(240, 240, 240));
DisableVisualStylesFilters(hDlg);
LPTREEFOLDER folder = GetCurrentFolder();
LPTREEFOLDER lpParent = NULL;
LPCFILTER_ITEM g_lpFilterList = GetFilterList();
dwFilters = 0;
if (folder != NULL)
{
char tmp[80];
winui_set_window_text_utf8(GetDlgItem(hDlg, IDC_FILTER_EDIT), g_FilterText);
Edit_SetSel(GetDlgItem(hDlg, IDC_FILTER_EDIT), 0, -1);
// Mask out non filter flags
dwFilters = folder->m_dwFlags & F_MASK;
// Display current folder name in dialog titlebar
snprintf(tmp, WINUI_ARRAY_LENGTH(tmp), "Filters for %s folder", folder->m_lpTitle);
winui_set_window_text_utf8(hDlg, tmp);
if (GetFilterInherit())
{
lpParent = GetFolder(folder->m_nParent);
bool bShowExplanation = false;
if (lpParent)
{
char strText[24];
/* Check the Parent Filters and inherit them on child,
* No need to promote all games to parent folder, works as is */
dwpFilters = lpParent->m_dwFlags & F_MASK;
/*Check all possible Filters if inherited solely from parent, e.g. not being set explicitly on our folder*/
if ((dwpFilters & F_CLONES) && !(dwFilters & F_CLONES))
{
/*Add a Specifier to the Checkbox to show it was inherited from the parent*/
winui_get_window_text_utf8(GetDlgItem(hDlg, IDC_FILTER_CLONES), strText, 20);
strcat(strText, " (*)");
winui_set_window_text_utf8(GetDlgItem(hDlg, IDC_FILTER_CLONES), strText);
bShowExplanation = true;
}
if ((dwpFilters & F_NONWORKING) && !(dwFilters & F_NONWORKING))
{
/*Add a Specifier to the Checkbox to show it was inherited from the parent*/
winui_get_window_text_utf8(GetDlgItem(hDlg, IDC_FILTER_NONWORKING), strText, 20);
strcat(strText, " (*)");
winui_set_window_text_utf8(GetDlgItem(hDlg, IDC_FILTER_NONWORKING), strText);
bShowExplanation = true;
}
if ((dwpFilters & F_UNAVAILABLE) && !(dwFilters & F_UNAVAILABLE))
{
/*Add a Specifier to the Checkbox to show it was inherited from the parent*/
winui_get_window_text_utf8(GetDlgItem(hDlg, IDC_FILTER_UNAVAILABLE), strText, 20);
strcat(strText, " (*)");
winui_set_window_text_utf8(GetDlgItem(hDlg, IDC_FILTER_UNAVAILABLE), strText);
bShowExplanation = true;
}
if ((dwpFilters & F_VECTOR) && !(dwFilters & F_VECTOR))
{
/*Add a Specifier to the Checkbox to show it was inherited from the parent*/
winui_get_window_text_utf8(GetDlgItem(hDlg, IDC_FILTER_VECTOR), strText, 20);
strcat(strText, " (*)");
winui_set_window_text_utf8(GetDlgItem(hDlg, IDC_FILTER_VECTOR), strText);
bShowExplanation = true;
}
if ((dwpFilters & F_RASTER) && !(dwFilters & F_RASTER))
{
/*Add a Specifier to the Checkbox to show it was inherited from the parent*/
winui_get_window_text_utf8(GetDlgItem(hDlg, IDC_FILTER_RASTER), strText, 20);
strcat(strText, " (*)");
winui_set_window_text_utf8(GetDlgItem(hDlg, IDC_FILTER_RASTER), strText);
bShowExplanation = true;
}
if ((dwpFilters & F_ORIGINALS) && !(dwFilters & F_ORIGINALS))
{
/*Add a Specifier to the Checkbox to show it was inherited from the parent*/
winui_get_window_text_utf8(GetDlgItem(hDlg, IDC_FILTER_ORIGINALS), strText, 20);
strcat(strText, " (*)");
winui_set_window_text_utf8(GetDlgItem(hDlg, IDC_FILTER_ORIGINALS), strText);
bShowExplanation = true;
}
if ((dwpFilters & F_WORKING) && !(dwFilters & F_WORKING))
{
/*Add a Specifier to the Checkbox to show it was inherited from the parent*/
winui_get_window_text_utf8(GetDlgItem(hDlg, IDC_FILTER_WORKING), strText, 20);
strcat(strText, " (*)");
winui_set_window_text_utf8(GetDlgItem(hDlg, IDC_FILTER_WORKING), strText);
//.........这里部分代码省略.........
示例15: WinMain
//----------------------------------------------------------------------------
int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE, LPSTR acArgument, int)
{
FWinApplication* pkTheApp = FWinApplication::GetApplication();
assert( pkTheApp );
if ( !pkTheApp )
return -1;
gs_hInstance = hInstance;
if ( acArgument && strlen(acArgument) > 0 )
{
char* acProcessed = ProcessArgument(acArgument);
pkTheApp->SetCommand(new Command(acProcessed));
delete[] acProcessed;
}
if ( !pkTheApp->OnPrecreate() )
return -2;
// register the window class
WNDCLASS kWC;
kWC.style = CS_HREDRAW | CS_VREDRAW;
kWC.lpfnWndProc = WinProc;
kWC.cbClsExtra = 0;
kWC.cbWndExtra = 0;
kWC.hInstance = hInstance;
kWC.hIcon = LoadIcon(NULL,IDI_APPLICATION);
kWC.hCursor = LoadCursor(NULL,IDC_ARROW);
kWC.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
kWC.lpszClassName = gs_acWindowClassName;
if ( pkTheApp->GetMenuID() )
kWC.lpszMenuName = MAKEINTRESOURCE(pkTheApp->GetMenuID());
else
kWC.lpszMenuName = 0;
RegisterClass(&kWC);
// require the window to have the specified client area
RECT kRect = { 0, 0, pkTheApp->GetWidth()-1, pkTheApp->GetHeight()-1 };
AdjustWindowRect(&kRect,gs_dwWindowStyle,pkTheApp->GetMenuID());
// create the application window
int iXPos = CW_USEDEFAULT;
int iYPos = CW_USEDEFAULT;
int iXSize = kRect.right - kRect.left + 1;
int iYSize = kRect.bottom - kRect.top + 1;
HWND hWnd = CreateWindow(gs_acWindowClassName,pkTheApp->GetCaption(),
gs_dwWindowStyle,iXPos,iYPos,iXSize,iYSize,0,0,hInstance,0);
pkTheApp->SetWindowHandle(hWnd);
// create status window
if ( pkTheApp->GetStatusPaneQuantity() )
{
InitCommonControls();
HWND hStatusWnd = CreateWindow(STATUSCLASSNAME,"",
WS_CHILD | WS_VISIBLE,0,0,0,0,hWnd,0,hInstance,0);
pkTheApp->SetStatusWindowHandle(hStatusWnd);
}
// display the window
ShowWindow(hWnd,SW_SHOW);
UpdateWindow(hWnd);
// allow the application to initialize before starting the message pump
if ( !pkTheApp->OnInitialize() )
return -3;
MSG kMsg;
while ( true )
{
if ( PeekMessage(&kMsg,0,0,0,PM_REMOVE) )
{
if ( kMsg.message == WM_QUIT )
break;
HACCEL hAccel = 0;
if ( !TranslateAccelerator(hWnd,hAccel,&kMsg) )
{
TranslateMessage(&kMsg);
DispatchMessage(&kMsg);
}
}
else
{
pkTheApp->OnIdle();
}
}
pkTheApp->OnTerminate();
UnregisterClass(gs_acWindowClassName,hInstance);
return 0;
}