|
| 游客已登陆
(0)未知 |
| 笔行证 |
257310 |
| 昵称 |
kuan |
| 笔贝 |
Score1 |
| 加为好友 |
发送短信 |
- 就是可以查看颜色的。比如#FFCCFF你不知道是什么颜色。你就可以用它来查看。同样你看到你喜欢的颜色。可...
- 什么??晕死啊!!
- 好 啊
- 好东西。。等学完了再来看看。。。
- 学了点东西了。。呵呵
- 注意,上面代码,有一些显示不出来.过些天,哥德会把笔客完善一下.到时.所有代码就应该没错了.
- 这个函数是计算积分的.算法思想:求积分我们可以求他的面积,,沿X轴分成n份,计算n份的面积再相加.
f...
- float integral(float(*p)(float),float a,float b,int n)
{int i;
float x,h,s;
h=(b-a)/n;
x=a;
...
- ^_^ 好东西啊
- 阿宽又一新作
呵呵 厉害啊 说得很清楚了
- 厉害 呵呵 写得简单清晰
不错啊
- ^_^ 写得不错哦
支持下
访问计数:26967本文:240 今天:1 本月 100
|
|
|
|
| |
| 2007-06-28 晴 |
|
#include<windows.h>
#include<stdio.h>
//定义全局变量
HINSTANCE hInst;
HINSTANCE hInstance;
MSG msg;
char lpszClassName[]="窗口";
char *ShowText;
//函数声明
LRESULT CALLBACK WndProc(HWND,UINT,WPARAM,LPARAM);
//------------------窗口类----------------------------------
class CFrameWnd
{
public:
HWND hWnd;
public:
int RegisterWindow();
void Create(LPCTSTR lpClassName,
LPCTSTR lpWindowName
);
void ShowWindow(int mCmdShow);
void UpdateWindow();
};
//窗口类的成员函数
int CFrameWnd::RegisterWindow()
{
WNDCLASS wc;
wc.style=0;
wc.lpfnWndProc=WndProc;
wc.cbClsExtra=0;
wc.cbWndExtra=0;
wc.hInstance=hInstance;
wc.hIcon=LoadIcon(NULL,IDI_APPLICATION);
wc.hCursor=LoadCursor(NULL,IDC_ARROW);
wc.hbrBackground=(HBRUSH)GetStockObject(WHITE_BRUSH);
wc.lpszMenuName=NULL;
wc.lpszClassName=lpszClassName;
return RegisterClass(&wc);
}
void CFrameWnd::Create(LPCTSTR lpClassName,LPCTSTR lpWindowName)
{
RegisterWindow();
hInst=hInstance;
hWnd=CreateWindow(lpszClassName,
lpWindowName,
WS_OVERLAPPEDWINDOW,
120,50,800,600,
NULL,
NULL,
hInstance,
NULL);
}
void CFrameWnd::ShowWindow(int nCmdShow)
{
::ShowWindow(hWnd,nCmdShow);
}
void CFrameWnd::UpdateWindow()
{
::UpdateWindow(hWnd);
}
//-------------应用程序类----------------
//把主函数中的函数体看成一个对象,把它叫应用程序
class CWinApp
{
public:
CFrameWnd *m_pMainWnd;
public:
virtual BOOL InitInstance(int nCmdShow); //声明为虚函数---就改这里
int Run();
};
//应用程序成员函数
BOOL CWinApp::InitInstance(int nCmdShow)
{
m_pMainWnd= new CFrameWnd;
m_pMainWnd->Create(NULL,"封装的Windows程序");
m_pMainWnd->ShowWindow(nCmdShow);
m_pMainWnd->UpdateWindow();
return TRUE;
}
int CWinApp::Run()
{
while(GetMessage(&msg,NULL,0,0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return msg.wParam;
}
//-------由CwinApp类派生CMyApp类,加了这个
class CMyApp: public CWinApp
{
public:
BOOL InitInstance(int nCmdShow); //重新定义InitInstance函数
};//注意分号
//重新定义的成员函数InitInstance.加了这个
CMyApp::InitInstance(int nCmdShow)
{
m_pMainWnd= new CFrameWnd;
m_pMainWnd->Create(NULL,"用新的InitInstance函数的程序");
m_pMainWnd->ShowWindow(nCmdShow);
m_pMainWnd->UpdateWindow();
return TRUE;
}
//CWinApp theApp;
//这里要改一下
CMyApp theApp;
//主函数______________________________________________________
int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
int ResultCode=-1;
theApp.InitInstance(nCmdShow);
return ResultCode=theApp.Run();
}
//窗口函数--------------------------------------------
LRESULT CALLBACK WndProc(HWND hWnd,
UINT message,
WPARAM wParam,
LPARAM lParam)
{
PAINTSTRUCT ps;
HDC hdc;
switch(message)
{
case WM_LBUTTONDOWN:
ShowText="kuanlovefeng";
InvalidateRect(hWnd,NULL,1);
break;
case WM_PAINT:
hdc=BeginPaint(hWnd,&ps);
TextOut(hdc,50,50,ShowText,12);
EndPaint(hWnd,&ps);
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
return DefWindowProc(hWnd,message,wParam,lParam);
}
return 0;
}.
|
|
| # posted by kuan @ 2007-06-28 13:30:52 评论(0) |
|
|
|
|
|
|