資源簡(jiǎn)介
利用VC++實(shí)現(xiàn)了記事本的各種功能,用戶能通過(guò)這個(gè)程序?qū)W到很多VC++知識(shí),程序簡(jiǎn)單明了,易于分析掌握

代碼片段和文件信息
#include?“NoteBook.h“
#include?“Define.h“
#include?“File.h“
#include?“Edit.h“
#include?“Font.h“
int?APIENTRY?WinMain(HINSTANCE?hInstanceHINSTANCE?hPrevInstanceLPSTR?lpCmdLineint?nShowCmd)
{
MSG?msg;
HACCEL?hAccelTable;
LoadString(hInstanceIDS_WINDOW_titlestrWindowtitleSTRSIZE2);
LoadString(hInstanceIDS_WINDOW_CLASSstrWindowClassSTRSIZE2);
MyhInst=hInstance;
MyRegisterClass(hInstance);
if(!InitInstance(hInstancenShowCmdlpCmdLine))
return?FALSE;
hAccelTable?=?LoadAccelerators(hInstance?(LPCTSTR)IDR_NOTEPADACCELERATOR);
while(GetMessage(&msgNULL00))
{
if?(TranslateAccelerator(msg.hwnd?hAccelTable?&msg))?
{
HWND?hWndEdit;
hWndEdit=GetDlgItem(hWndMainIDC_EDIT1);
//設(shè)置快捷鍵
if(GetKeyState(VK_CONTROL)&0x80)
{
switch(msg.wParam)
{
case?‘N‘:
NewFileProc(hWndMain);
break;
case?‘O‘:
OpenFileProc(hWndMain);
break;
case?‘S‘:
SaveFileProc(hWndMain);
break;
case?‘F‘:
FindProc(hWndMain);
break;
case?‘H‘:
ReplaceProc(hWndMain);
break;
case?‘G‘:
DialogBox(MyhInst?(LPCTSTR)IDD_GOTO?hWndMain?(DLGPROC)GotoDlgProc);
break;
case?‘A‘:
SendMessage(hWndEditEM_SETSEL0SendMessage(hWndEditWM_GETTEXTLENGTH00));?
SendMessage(hWndEditEM_SCROLLCARET00);//讓光標(biāo)所在處顯現(xiàn)
break;
}
}
if(GetKeyState(VK_F3)&0x80)
{
FindNextProc(hWndMain);
}
else
if(GetKeyState(VK_F5)&0x80)
{
TimeAndDateProc(hWndMain);
}
if(!IsWindowVisible(hFTDlg)?&&?!IsWindowVisible(hRTDlg))
SetFocus(hWndEdit);
}
else
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
return?(int)msg.wParam;
}
ATOM?MyRegisterClass(HINSTANCE?hInstance)
{
WNDCLASS?MyWC;
MyWC.style=CS_OWNDC|CS_HREDRAW|CS_VREDRAW;?
????MyWC.lpfnWndProc=(WNDPROC)WndProc;?
????MyWC.cbClsExtra=0;?
????MyWC.cbWndExtra=0;?
????MyWC.hInstance=hInstance;
????MyWC.hIcon=LoadIcon(hInstanceIDI_APPLICATION);
????MyWC.hCursor=LoadCursor(NULL?IDC_ARROW);
????MyWC.hbrBackground=(HBRUSH)(COLOR_WINDOW+11);
????MyWC.lpszMenuName=(LPCTSTR)IDR_MENU1;?
????MyWC.lpszClassName=strWindowClass;
return?RegisterClass(&MyWC);
}
BOOL?InitInstance(HINSTANCE?hInstanceint?nCmdShowLPSTR?lpCmdLine)
{
HWND?hWnd;
RECT?rect;
HFONT?hFont;
int?RectWidthRectHeight;
strFileName=(char?*)calloc(FILENAMESIZEsizeof(char));
strFilePath=(char?*)calloc(FILEPATHSIZEsizeof(char));
memset(strCurWndtitle0STRSIZE1);
memset(strFilePath0FILEPATHSIZE);
memset(strFileName0FILENAMESIZE);
PathUnquoteSpaces(lpCmdLine);//去掉引號(hào)
if(PathFileExists(lpCmdLine))
{
strcpy(strFilePathlpCmdLine);
strcpy(strFileNamePathFindFileName(strFilePath));
}
else
{
strcpy(strFileName“無(wú)標(biāo)題“);
}
strcpy(strCurWndtitlestrFileName);
strcat(strCurWndtitle“?-?“);
strcat(strCurWndtitlestrWindowtitle
?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----
?????文件????2229248??2010-11-08?15:28??NoteBook\Debug\NoteBook.bsc
?????文件?????204866??2010-11-08?15:29??NoteBook\Debug\NoteBook.exe
?????文件?????256996??2010-11-08?15:29??NoteBook\Debug\NoteBook.ilk
?????文件??????78325??2010-11-08?15:28??NoteBook\Debug\NoteBook.obj
?????文件????5039148??2010-11-08?15:28??NoteBook\Debug\NoteBook.pch
?????文件?????549888??2010-11-08?15:29??NoteBook\Debug\NoteBook.pdb
?????文件??????????0??2010-11-08?15:28??NoteBook\Debug\NoteBook.sbr
?????文件???????2260??2010-11-08?15:29??NoteBook\Debug\Resource.res
?????文件?????164864??2010-11-08?15:29??NoteBook\Debug\vc60.idb
?????文件??????86016??2010-11-08?15:28??NoteBook\Debug\vc60.pdb
?????文件???????1729??2010-11-06?20:34??NoteBook\Define.h
?????文件??????19849??2010-11-08?15:15??NoteBook\Edit.h
?????文件???????5561??2010-11-08?15:28??NoteBook\File.h
?????文件????????437??2010-11-08?15:18??NoteBook\Font.h
?????文件??????17196??2010-11-08?15:27??NoteBook\NoteBook.cpp
?????文件???????4357??2010-11-07?21:46??NoteBook\NoteBook.dsp
?????文件????????522??2009-01-25?11:43??NoteBook\NoteBook.dsw
?????文件????????271??2010-11-07?21:23??NoteBook\NoteBook.h
?????文件??????58368??2010-11-22?15:45??NoteBook\NoteBook.ncb
?????文件??????54784??2010-11-22?15:45??NoteBook\NoteBook.opt
?????文件????????945??2010-11-08?15:29??NoteBook\NoteBook.plg
?????文件??????36072??2010-11-08?15:29??NoteBook\Resource.aps
?????文件???????1847??2010-11-07?21:53??NoteBook\resource.h
?????文件???????6357??2010-11-08?15:29??NoteBook\Resource.rc
?????目錄??????????0??2011-06-29?10:44??NoteBook\Debug
?????目錄??????????0??2011-06-29?10:44??NoteBook
-----------?---------??----------?-----??----
??????????????8819906????????????????????26
評(píng)論
共有 條評(píng)論