没有使用edit控件win32编程实现记事本


这个是没有使用edit控件win32编程实现记事本的程序,实现了打开文件,保存文件,复制 ,粘贴,剪切的一些基本功能,不过也还不是很完善,适合初学者。
资源截图
代码片段和文件信息
#include 
#include “Edit_fun.h“
#include “resource.h“
#include “test.h“
#include 
#include 
#include 
#include 
#include 
#include  
#include 
#include 
#include 
#pragma comment(lib“shlwapi.lib“)
#include 
/////////////////全局变量//////////////////////////////////////////////

#define MAX_LOADSTRING 100
#define FILENAMESIZE 100 //文件名的长度
#define FILEPATHSIZE 100 //文件路径的长度
#define MAX_STR_LENGTH 256
//#define MAXPOINTS 1000
TCHAR sztitle[]=TEXT(“记事本“);
TCHAR CurWndtitle[MAX_LOADSTRING]; 
HINSTANCE hInst;
bool IsSaved=false;
char *FileName;
char *FilePath;
HWND hwndEdithwnd ;//编辑区域的句柄
long int cxChar cyChar cxClient cyClient cxBuffer cyBuffer xCaret yCaret nxCaretnyCaret xFocu;
SIZE  ocaretncaret;
static DWORD   dwCharSet = DEFAULT_CHARSET ;
static TCHAR * pBuffer = NULL ;
static RowNode* PRow[ROWSMAX];
HDC   hdc ;
int   x=0 y=0 i=0 j=0iPaintBeg iPaintEnd  x1x2y2strlength=0;
int y1;
int lbdown=0drag=0sel=0;
char *cBuffer=NULL;
HFONT hFonthFontNew;
LOGFONT logFont;
int RectWidthRectHeight;
RECT rect;
PTSTR Text=NULL;

HWND  hDlgMode ;
TCHAR findtext[MAX_STR_LENGTH];
TCHAR replacetext[MAX_STR_LENGTH];
TCHAR strTemp[MAX_STR_LENGTH+1];
UINT messageFindReplace;

#ifdef UNICODE
#define CF_TCHAR CF_UNICODETEXT
#else
#define CF_TCHAR CF_TEXT
#endif

/////////////////函数声明/////////////////////////////////////////////
LRESULT CALLBACK WndProc(HWND UINT WPARAM LPARAM);
LRESULT CALLBACK TextEditProc(HWND UINT WPARAM LPARAM);
HWND TextEdit(HINSTANCE HWND);
void NewFile(HWND);
bool OpenFile(HWND);
bool OpenFileDlg(HWNDchar *char *);
int SaveFile(HWND);
int SaveAs(HWND);
LPSTR GetText(HWND);
void DrawBoxOutline (HWND hwndEdit POINT ptBeg POINT ptEnd);
BOOL CALLBACK AboutDlgProc (HWND UINTWPARAM LPARAM) ;

void Get_TimeDate(HWND);//显示时间和日期

bool find_text(HWNDint *LPFINDREPLACE );
bool findtext_next(HWND int *);
bool find_valid(void);
HWND FindTextDlg(HWND);

HWND ReplaceTextDlg(HWND);
bool replace_text(HWNDint *LPFINDREPLACE);

bool compareText();//判断打开的文件是否修改了

bool ChooseFontDlg(HWND);
///////////////////////////////////////////////////////////////////////
int WINAPI WinMain(HINSTANCE hInstance HINSTANCE hPrevInstance LPSTR lpCmdLine int iCmdShow)
{
    static TCHAR szAppName[] = TEXT(“test“) ;
    HWND         hwnd ;
    MSG          msg ;
    WNDCLASS     wndclass ;
    wndclass.style           = CS_HREDRAW | CS_VREDRAW ;
    wndclass.lpfnWndProc     = WndProc ;
    wndclass.cbClsExtra      = 0 ;
    wndclass.cbWndExtra      = 0 ;
    wndclass.hInstance       = hInstance ;
    wndclass.hIcon           = LoadIcon(hInstance (LPCTSTR)IDI_ICON1) ;
    wndclass.hCursor         = LoadCursor(NULL IDC_ARROW) ;
    wndclass.hbrBackground   = (HBRUSH) GetStockobject(WHITE_BRUSH) ;
    wndclass.lpszMenuName    = MAKEIN

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件       2755  2010-03-30 16:31  test(没有edit控件)Edit_fun.h

     文件        766  2010-03-26 16:56  test(没有edit控件)icon1.ico

     文件      45552  2010-04-01 08:47  test(没有edit控件)main.cpp

     文件       1251  2010-03-31 14:55  test(没有edit控件)
esource.h

     文件      34076  2010-03-31 14:55  test(没有edit控件)script1.aps

     文件       3808  2010-03-31 14:55  test(没有edit控件)script1.rc

     文件       4273  2010-03-29 17:06  test(没有edit控件) est.dsp

     文件        514  2010-03-23 08:15  test(没有edit控件) est.dsw

     文件        276  2010-03-24 11:28  test(没有edit控件) est.h

     文件      58368  2010-04-01 11:55  test(没有edit控件) est.ncb

     文件      49664  2010-04-01 11:55  test(没有edit控件) est.opt

     文件        763  2010-04-01 08:44  test(没有edit控件) est.plg

     文件      85016  2010-04-01 08:43  test(没有edit控件)Debugmain.obj

     文件    1065302  2010-03-23 11:18  test(没有edit控件)Debugmain.sbr

     文件       1460  2010-03-31 15:03  test(没有edit控件)Debugscript1.res

     文件    2237440  2010-03-23 10:54  test(没有edit控件)Debug est.bsc

     文件     233511  2010-04-01 08:44  test(没有edit控件)Debug est.exe

     文件     310648  2010-04-01 08:44  test(没有edit控件)Debug est.ilk

     文件       3275  2010-03-29 19:09  test(没有edit控件)Debug est.obj

     文件    3993628  2010-03-31 15:02  test(没有edit控件)Debug est.pch

     文件     599040  2010-04-01 08:44  test(没有edit控件)Debug est.pdb

     文件       3774  2010-03-26 16:52  test(没有edit控件)Debug test.ico

     文件     164864  2010-04-01 08:44  test(没有edit控件)Debugvc60.idb

     文件      86016  2010-04-01 08:43  test(没有edit控件)Debugvc60.pdb

     目录          0  2010-04-08 10:13  test(没有edit控件)Debug

     目录          0  2010-04-08 10:13  test(没有edit控件)

----------- ---------  ---------- -----  ----

              8986040                    26


版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件举报,一经查实,本站将立刻删除。

发表评论

评论列表(条)