English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

please suggest me some address where i could find source code in c++ for a simple text editor ... i need to submit it for my project .. please help me

2007-03-21 06:16:39 · 4 answers · asked by Anonymous in Computers & Internet Programming & Design

4 answers

just dial 040-39999999 and u will get the info from them.

2007-03-21 06:41:01 · answer #1 · answered by skhr 3 · 0 0

I wrote a "simple" text editor some years ago... and, believe me, it was not that simple if you want to use only c++ and not the help of other components... I guess it will be done for windows, won't it (mine was for DOS). If you're going to use it in windows, I can give you this code:
(it's a really simple text editor, only contextual menu is available).

#include "windows.h"
#define x 10
#define y 10
#define CLASS_NAME "Win32AppDemo"

/////////////////////////////////////////////////////////////////////
HWND This=0;
void SetWndRect(HWND c,int wx,int wy,int px,int py)
{
MoveWindow(c,px,py,wx,wy,1);
}
HWND CreateCtrl(char*clase,int subcl,HINSTANCE inst,HWND owner)
{ return CreateWindowEx(
WS_EX_TRANSPARENT,
clase,"",subcl|WS_CHILD|
WS_VISIBLE,
0,0,0,0,owner,NULL,inst,NULL);
}
RECT getRect(HWND c)
{
RECT r;
GetWindowRect(c,&r);
r.left-=3;r.right-=3;
r.top-=22;r.bottom-=22;
return r;
}
int ToRGB(int r,int g,int b)
{return RGB(r,g,b);}

/////////////////////////////////////////////////////////////////////

RECT FRect={0,0,0,0};
int colorAct=ToRGB(128,128,128);
HWND wcombo=0;
HWND wtext=0;
HWND wprobar=0;

void MsgError(char* s )
{
MessageBox(This,s, CLASS_NAME, MB_APPLMODAL|MB_ICONERROR);
}


void OnPaint(HDC g, HWND w)
{
RECT r1;
GetClientRect(w,&r1);
r1.left += x ;r1.top +=y ;
r1.right -=x; r1.bottom -= y;
HBRUSH b1=
CreateSolidBrush(
ToRGB(0,0,255)
);
HBRUSH b2=
CreateSolidBrush(colorAct);
FrameRect(g,&r1,b1);
FillRect(g,&FRect,b2);
DeleteObject(b1);
DeleteObject(b2);
}

void OnCommand(HWND hwnd)
{
//Handle here commands:
}

void CreateForm(HINSTANCE hThisInstance, HWND This)
{
HWND tTarget=CreateCtrl("EDIT",
WS_BORDER |ES_MULTILINE|
WS_HSCROLL|
WS_VSCROLL,
hThisInstance,This);
SetClassLong (tTarget, GCL_HBRBACKGROUND, (long) GetStockObject(WHITE_BRUSH));
SetWindowText(tTarget,""),
SetParent(tTarget,This);
SetWndRect(
tTarget, 340,140,20,20
);
wtext=tTarget;

SetClassLong (This,
GCL_HBRBACKGROUND, (long)
GetStockObject(LTGRAY_BRUSH));
SetWindowText(This,"Text Editor");
SetWindowLong(This, GWL_STYLE, WS_CAPTION|WS_SYSMENU);
SendMessage(This,WM_SETICON, ICON_BIG,
(LPARAM)
LoadIcon(0,IDI_EXCLAMATION)
);
MoveWindow(This,0,0, 380,200,0);
ShowWindow(This,SW_SHOW);
}


/////////////////////////////////////////////////////////////////////
LRESULT CALLBACK WinProc(HWND hwnd, UINT msg,WPARAM wP, LPARAM lP)
{
HDC dc=0;

switch (msg)
{
case WM_COMMAND:
{
OnCommand((HWND)lP);
break;
}
case WM_PAINT:
{
DefWindowProc(hwnd, msg, wP, lP);
dc=GetDC(hwnd);
OnPaint(dc,hwnd);
ReleaseDC(hwnd,dc);
break;
}
case WM_DESTROY:
{
PostQuitMessage(0);
break;
}
default: return DefWindowProc(hwnd, msg, wP, lP);
}
return 0;
}

int WINAPI WinMain(HINSTANCE hThisInstance, HINSTANCE hPrevInstance, LPSTR lpszArgument, int nFunsterStil)
{
WNDCLASS wincl; MSG messages;
wincl.hInstance = hThisInstance;
wincl.lpszClassName = CLASS_NAME;
wincl.lpfnWndProc = WinProc;
wincl.style = CS_DBLCLKS;
wincl.hIcon = LoadIcon(NULL, IDI_APPLICATION);
wincl.hCursor = LoadCursor(NULL, IDC_ARROW);
wincl.lpszMenuName = NULL;
wincl.cbClsExtra = 0;
wincl.cbWndExtra = 0;
wincl.hbrBackground = (HBRUSH) GetStockObject(LTGRAY_BRUSH);

if(!RegisterClass(&wincl)) return 0;

This=CreateWindow(
CLASS_NAME, // Classname
CLASS_NAME, // Title Text
WS_DLGFRAME |DS_MODALFRAME|DS_CENTER|
DS_3DLOOK|
WS_MINIMIZEBOX | WS_MAXIMIZEBOX |
WS_POPUP | WS_CAPTION | WS_SYSMENU,
CW_USEDEFAULT, // Windows decides the position
CW_USEDEFAULT, // where the window ends up on the screen
10, // The programs width
10 , // and height in pixels
HWND_DESKTOP, // The window is a child-window to desktop
NULL, // No menu
hThisInstance, // Program Instance handler
NULL // No Window Creation data
);

CreateForm(hThisInstance,
This);

while(GetMessage(&messages, NULL, 0, 0))
{
TranslateMessage(&messages);
DispatchMessage(&messages);
}
return messages.wParam;
}

2007-03-21 08:00:37 · answer #2 · answered by Anonymous · 0 0

dont knw about cpp, here's a link to a code in vc++ - should give you an idea
http://www.codeproject.com/useritems/texti.asp

hope this helps

2007-03-21 06:25:35 · answer #3 · answered by maverick_youth 4 · 0 0

#contain iostream #contain fstream utilising namespace std; int substantial() { char filename[80 one]; char input_line[80 one]; // enter line for textual content textile get admission to cout << "enter a record call and press enter: "; cin.getline(filename, 80); ofstream file_out(filename); if (! file_out) { cout << "record " << filename << " ought to no longer be opened."; //if record commencing fails return -a million; } cout << "record " << filename << " grow to be opened." << endl; return -a million; }

2016-10-02 12:37:27 · answer #4 · answered by ulberg 4 · 0 0

fedest.com, questions and answers