记事本的问题
int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstancem,LPSTR lpCmdLine,int iCmdShow)
WNDCLASS wndclass;
wndclass.style=CS_HREDRAW|CS_VREDRAW;
wndclass.lpfnWndProc=wndProc;
wndclass.cbClsExtra=0;
wndclass.cbWndExtra=0;
wndclass.hInstance=hInstance;
wndclass.hIcon=LoadIcon(NULL,IDI_APPLICATION);
wndclass.hCursor=LoadCursor(NULL,IDC_ARROW);
wndclass.hbrBackground=(HBRUSH) GetStockObject(WHITE_BRUSH);
wndclass.lpszMenuName=NULL;
wndclass.lpszClassName=wnd;
if(RegisterClass(&ass))
{
MessageBox(NULL,TEXT(("This program requires Windows NT!"),
szAppName, MB_ICONERROR) ;
return 0;
}
HWND hwnd;
MSG msg;
hwnd=CreatWindow(wnd,("Ends and Joins Demo"),
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT,
NULL, NULL, hInstance, NULL);
ShowWindow(hwnd,iCmdShow);
UpdateWindow(hwnd);
while(GetMessage(&msg,NULL,0,0))
{
TranslateMessage(&mag);
DispatchMessage(&mag);
}
return msg.wParam;
}
我只写了窗口剩下的不知道怎么写 我想问问要怎么实现在客户区文字的输入 求高人指点
#include <windows.h>
#include <stdio.h>
LRESULT CALLBACK WndProc (HWND, UINT, WPARAM, LPARAM) ;
int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,
PSTR szCmdLine, int iCmdShow)
{
static TCHAR szAppName[] = TEXT ("HelloWin") ;
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 (NULL, IDI_APPLICATION) ;
wndclass.hCursor = LoadCursor (NULL, IDC_ARROW) ;
wndclass.hbrBackground = (HBRUSH) GetStockObject (WHITE_BRUSH) ;
wndclass.lpszMenuName= NULL ;
wndclass.lpszClassName = szAppName ;
if (!RegisterClass (&wndclass))
{
MessageBox (NULL, TEXT ("This program requires Windows NT!"),
szAppName, MB_ICONERROR) ;
return 0 ;
}
hwnd = CreateWindow (szAppName, // window class name
TEXT ("The Hello Program"), // window caption
WS_OVERLAPPEDWINDOW, // window style
CW_USEDEFAULT, // initial x position
CW_USEDEFAULT, // initial y position
CW_USEDEFAULT, // initial x size
CW_USEDEFAULT, // initial y size
NULL, // parent window handle
NULL, // window menu handle
hInstance, // program instance handle
NULL) ; // creation parameters
ShowWindow (hwnd, iCmdShow) ;
UpdateWindow (hwnd) ;
while (GetMessage (&msg, NULL, 0, 0))
{
TranslateMessage (&msg) ;
DispatchMessage (&msg) ;
}
return msg.wParam ;
}
LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
HDC hdc ;
PAINTSTRUCT ps ;
RECT rect ;
static HWND h_edit;
switch (message)
{
case WM_CREATE:
h_edit = CreateWindow(
"EDIT", // predefined class
NULL, // no window title
WS_CHILD | WS_VISIBLE | WS_VSCROLL |
ES_LEFT | ES_MULTILINE | ES_AUTOVSCROLL,
0, 0, 0, 0, // set size in WM_SIZE message
hwnd, // parent window
(HMENU) 1, // edit control ID
(HINSTANCE) GetWindowLong(hwnd, GWL_HINSTANCE),
NULL); // pointer not needed
return 0 ;
case WM_SIZE:
{
int cx = LOWORD(lParam);
int cy = HIWORD(lParam);
MoveWindow( h_edit, 0, 0, cx, cy, TRUE );
return 0;
}
case WM_DESTROY:
PostQuitMessage (0) ;
return 0 ;
}
return DefWindowProc (hwnd, message, wParam, lParam) ;
} 自己写也是可以的,但是要处理很多东西,不合算,直接用多行的EDIT控件就OK了 仰望天上的光 发表于 2014-7-15 20:52
你这个代码好想只能实现输出不能输入我想问问实现输入输出要有那些功能呢 943566987 发表于 2014-7-19 11:50
你这个代码好想只能实现输出不能输入我想问问实现输入输出要有那些功能呢
请解释“输出”的含义,即要用什么形式输出?要用什么手段触发输出? 仰望天上的光 发表于 2014-7-19 12:34
请解释“输出”的含义,即要用什么形式输出?要用什么手段触发输出?
跟windows记事本那样 能以中文 英文 数字 符号形式输出
我记得好像是在消息体里面实现 我记得WNDLCASS和CREATEWINDOWS要改成 WNDLCASSEX CREATEWINDOWEX 弄一个控件有界面那么大不久能输入了吗。。。至于换行什么的问题邮考虑吧。。 {:7_146:}
页:
[1]