?? myapp.cpp
字號:
/****************************************************
Author: S. Senthil kumar
File: myapp.cpp
Purpose: Windows startup class
******************************************************/
#include "Global.h"
#include "OneMove.h"
#include "LastMove.h"
#include "myapp.h"
#include "myframe.h"
extern void AssignDefaults(int sndenable,int autoplay,CString deflevel,CString defdir,int whitesq,int blacksq);
extern COLORREF WHITESQUARE;
extern COLORREF BLACKSQUARE;
int myapp::InitInstance()
{
SetDialogBkColor(RGB(60,60,192),RGB(255,255,100));
myframe *p=new myframe;
p->ShowWindow(SW_MAXIMIZE);
m_pMainWnd=p;
//Loads user settings from Registry.
LoadDefaults();
return 1;
}
void myapp::LoadDefaults()
{
//Access Registry and use GetProfilexxx to get user settings.
SetRegistryKey("The Genius");
int sndenable=GetProfileInt("Options","SoundEnable",0);
CString deflevel=GetProfileString("Options","DefaultLevel","");
int autoplay=GetProfileInt("Options","AutoPlay",0);
char *buf=new char[100];
::GetCurrentDirectory(100,buf);
CString appdefault=(CString)buf+(CString)"\\Sounds";
delete [] buf;
CString defdir=GetProfileString("Options","MusicDir",appdefault);
COLORREF whitesquare=(COLORREF)GetProfileInt("Options","WhiteSquare",RGB(0,0,0));
COLORREF blacksquare=(COLORREF)GetProfileInt("Options","BlackSquare",RGB(100,100,115));
//Assign values to global variables
AssignDefaults(sndenable,autoplay,deflevel,defdir,whitesquare,blacksquare);
}
void myapp::StoreOptions(int autoplay,int sndenable,CString deflevel,CString defdir)
{
//Store Options using WriteProfileInt.
int errorval=0;
errorval=WriteProfileInt("Options","AutoPlay",autoplay);
if (errorval==0) MessageBox(NULL,"Autoplay Not assigned","",0);
errorval=WriteProfileInt("Options","SoundEnable",sndenable);
if (errorval==0) MessageBox(NULL,"SndEnable Not assigned","",0);
errorval=WriteProfileString("Options","DefaultLevel",deflevel);
if (errorval==0) MessageBox(NULL,"DefLevel Not assigned","",0);
errorval=WriteProfileString("Options","MusicDir",defdir);
if (errorval==0) MessageBox(NULL,"MusicDir Not assigned","",0);
WriteProfileInt("Options","WhiteSquare",WHITESQUARE);
WriteProfileInt("Options","BlackSquare",BLACKSQUARE);
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -