#include<windows.h>
#include<math.h>
#include"dan.h"
#include<string.h>
#include<stdlib.h>
#include<stdio.h>
//#include "wingdi.h"
#define IDM_READ 400
#define IDM_ITEM 401
LRESULT CALLBACK WndProc(HWND,UINT,WPARAM,LPARAM);
BOOL CALLBACK DlgProc(HWND hdlg,UINT message,WPARAM wParam,LPARAM lParam);
double a=0.0;//夹角弧度数
double g=9.8;//重力加速度
double t=0.0;
double nAddItem=0.0;
double pi=3.1415926;
double M=0.0;//小球的质量
double L=1.0;//摆长
double start=0.0;//初速度
double k1=0.0,k2=0.0,k3=0.0,k4=0.0;
int aa=0;
int kk=1;
int nMax=1;
int r=20;//小球的半径
int R=160;//摆线长
int lock;
int all=0;
int rr=0;
int num=0;
int number=1;
int control1=0,control2=0,control3=0,control4=0,control6=0,control7=0;
int control11=0,control22=0,control33=0,control44=0;
int i=0;
int count1=0,count2=0,count3=0,count4=0;
int w1=0;
int w2=0;
int w3=0;
int w4=0;
char lpszAddItem[]="";
char lpszResult[]="";
char * stop;
POINT points1[57];
POINT points2[57];
POINT points3[57];
POINT points4[57];
HWND hStaticl1,hStaticl2,hStaticl3,hStaticl4,hStaticl5,hStaticl6,hStaticl7;//静态文本句柄
HWND hEditItem1,hEditItem2,hEditItem3;
HWND hEditresult1,hEditresult2,hEditresult3,hEditresult4;
HWND hwndgroup1,hwndgroup2,hwndgroup3,hwndgroup4,hwndgroup5,hwndgroup6,hwndgroup7;
HWND hButton1,hButton2,hButton3,hButton4,hButton5,hButton6,hButton7,hButton8,hButton9;
HINSTANCE hInst;
//************************************************************//
int WINAPI WinMain
(
HINSTANCE hInstance,
HINSTANCE hPrevInst,
LPSTR lpszCmdLine,
int nCmdShow
)
{
HWND hwnd;
MSG Msg;
WNDCLASS wndclass;
char lpszClassName[]="单摆";
char lpszTitle[]="信号与系统";
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.hIcon=LoadIcon(hInstance,"DE");
wndclass.hCursor=LoadCursor(NULL,IDC_ARROW);
wndclass.hbrBackground=(HBRUSH)GetStockObject(DKGRAY_BRUSH);
//wndclass.hbrBackground=(HBRUSH)GetStockObject(WHITE_BRUSH);
wndclass.lpszMenuName="Menu";
wndclass.lpszClassName=lpszClassName;
if(!RegisterClass(&wndclass))
{
MessageBeep(0);
return FALSE;
}
hwnd=CreateWindow
(
lpszClassName,
lpszTitle,
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT,
CW_USEDEFAULT,
CW_USEDEFAULT,
CW_USEDEFAULT,
NULL,
NULL,
hInstance,
NULL);
for(i=0;i<57;i++)
{
points1[i].x=580+i*5;
points2[i].x=580+i*5;
points3[i].x=580+i*5;
points4[i].x=580+i*5;
if(i%8==0)
{
rr=rr+1.7;
}
points1[i].y=120-((10-rr)*5*sin((5*pi/56)*i))*0.5;
points2[i].y=290-((10-rr)*5*sin((5*pi/56)*i))*0.3;
points3[i].y=460-((10-rr)*5*sin((5*pi/56)*i))*0.3;
points4[i].y=630-(50*(1-cos((5*pi/56)*i)))*0.4;
}
ShowWindow(hwnd,nCmdShow);
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
)
{
RECT rectware={100,40,500,450};
RECT rectware1={580,50,880,180};/////////////////////////////////
RECT rectware2={580,220,880,350};
RECT rectware3={580,390,880,520};
RECT rectware4={580,560,880,690};
PAINTSTRUCT ps;
HBRUSH hB;
HPEN hP;
TEXTMETRIC tm;
char lp1[]="a";
char lp2[]="t";
switch(message)
{
case WM_CREATE:
SetTimer(hwnd,1,5,NULL); //建立计时器,每1毫秒乘以5等于0.005秒发出WM_TIMER消息.
//SetTimer(hwnd,1,10,NULL);
//**************************************
hwndgroup1=CreateWindow(//设值框外围的框
"BUTTON",
NULL,
BS_GROUPBOX|WS_CHILD|WS_VISIBLE,
98,455,
405,110,
hwnd,
(HMENU)IDB_GROUPBOX1,
hInst,
NULL,
);
hwndgroup2=CreateWindow(//单摆外围的框
"BUTTON",
NULL,
BS_GROUPBOX|WS_CHILD|WS_VISIBLE,
98,30,
405,425,
hwnd,
(HMENU)IDB_GROUPBOX2,
hInst,
NULL,
);
hwndgroup3=CreateWindow(//按钮外围的框
"BUTTON",
NULL,
BS_GROUPBOX|WS_CHILD|WS_VISIBLE,
98,555,
405,150,
hwnd,
(HMENU)IDB_GROUPBOX2,
hInst,
NULL,
);
hwndgroup4=CreateWindow(//零输入曲线外围的框
"BUTTON",
"零输入响应曲线",
BS_GROUPBOX|WS_CHILD|WS_VISIBLE,
550,30,
360,160,
hwnd,
(HMENU)IDB_GROUPBOX3,
hInst,
NULL,
);
hwndgroup5=CreateWindow(//零状态响应曲线外围的框
"BUTTON",
"零状态响应曲线",
BS_GROUPBOX|WS_CHILD|WS_VISIBLE,
550,180+20,
360,160,
hwnd,
(HMENU)IDB_GROUPBOX4,
hInst,
NULL,
);
hwndgroup6=CreateWindow(//冲激响应曲线外围的框
"BUTTON",
"冲激响应曲线",
BS_GROUPBOX|WS_CHILD|WS_VISIBLE,
550,330+40,
360,160,
hwnd,
(HMENU)IDB_GROUPBOX5,
hInst,
NULL,
);
hwndgroup7=CreateWindow(//阶越响应曲线外围的框
"BUTTON",
"阶越响应曲线",
BS_GROUPBOX|WS_CHILD|WS_VISIBLE,
550,480+60,
360,160,
hwnd,
(HMENU)IDB_GROUPBOX6,
hInst,
NULL,
);
//*************************************
hStaticl1=CreateWindow(
"STATIC",
"球质量M:",
WS_CHILD|WS_VISIBLE,
110,493,
65,18,
hwnd,
(HMENU)IDS_1,
hInst,
NULL,
);
hStaticl2=CreateWindow(
"STATIC",
"摆长L:",
WS_CHILD|WS_VISIBLE,
110,470,
65,18,
hwnd,
(HMENU)IDS_2,
hInst,
NULL,
);
hStaticl3=CreateWindow(
"STATIC",
"初速:",
WS_CHILD|WS_VISIBLE,
110,516,
65,18,
hwnd,
(HMENU)IDS_3,
hInst,
NULL,
);
hStaticl4=CreateWindow(
"STATIC",
"零输入响应角度:",
WS_CHILD|WS_VISIBLE,
282,470,
120,18,
hwnd,
(HMENU)IDS_4,
hInst,
NULL,
);
hStaticl5=CreateWindow(
"STATIC",
"零状态响应角度:",
WS_CHILD|WS_VISIBLE,
282,493,
120,18,
hwnd,
(HMENU)IDS_5,
hInst,
NULL,
);
hStaticl6=CreateWindow(
"STATIC",
"冲激响应角度:",
WS_CHILD|WS_VISIBLE,
282,516,
120,18,
hwnd,
(HMENU)IDS_6,
hInst,
NULL,
);
hStaticl7=CreateWindow(
"STATIC",
"阶越响应角度:",
WS_CHILD|WS_VISIBLE,
282,539,
120,18,
hwnd,
(HMENU)IDS_7,
hInst,
NULL,
);
//**************************************
hEditItem1=CreateWindow( //质量M
"EDIT",
NULL,
WS_CHILD|WS_VISIBLE|ES_LEFT|WS_BORDER,
177,493,
100,18,
hwnd,
(HMENU)IDE_RESULT1,
hInst,
NULL
);
hEditItem2=CreateWindow( //摆长L
"EDIT",
NULL,
WS_CHILD|WS_VISIBLE|ES_LEFT|WS_BORDER,
177,470,
100,18,
hwnd,
(HMENU)IDE_RESULT2,
hInst,
NULL
);
hEditItem3=CreateWindow( //初速
"EDIT",
NULL,
WS_CHILD|WS_VISIBLE|ES_LEFT|WS_BORDER,
177,516,
100,18,
hwnd,
(HMENU)IDE_RESULT3,
hInst,
NULL
);
hEditresult1=CreateWindow(//零输入响应角度
"EDIT",
NULL,
WS_CHILD|WS_VISIBLE|ES_LEFT|WS_BORDER|ES_READONLY,
405,470,
90,18,
hwnd,
(HMENU)IDE_RESULT4,
hInst,
NULL
);
SetWindowText(hEditresult1,"0.0");
hEditresult2=CreateWindow(//零状态响应角度
"EDIT",
NULL,
WS_CHILD|WS_VISIBLE|ES_LEFT|WS_BORDER|ES_READONLY,
405,493,
90,18,
hwnd,
(HMENU)IDE_RESULT5,
hInst,
NULL
);
SetWindowText(hEditresult2,"0.0");
hEditresult3=CreateWindow(//冲激响应角度
"EDIT",
NULL,
WS_CHILD|WS_VISIBLE|ES_LEFT|WS_BORDER|ES_READONLY,
405,516,
90,18,
hwnd,
(HMENU)IDE_RESULT6,
hInst,
NULL
);
SetWindowText(hEditresult3,"0.0");
hEditresult4=CreateWindow(//阶越响应角度
"EDIT",
NULL,
WS_CHILD|WS_VISIBLE|ES_LEFT|WS_BORDER|ES_READONLY,
405,539,
90,18,
hwnd,
(HMENU)IDE_RESULT7,
hInst,
NULL
);
SetWindowText(hEditresult4,
局外狗
- 粉丝: 80
- 资源: 1万+
最新资源
- java毕设项目之毕业生学历证明系统+vue(完整前后端+说明文档+mysql+lw).zip
- 高校学术交流平台_g75441il_233-QQ.zip
- 个性化智能学习系统(编号:22575176).zip
- 共享经济背景下校园闲置物品交易平台(编号:33061160).zip
- java毕设项目之个性化旅游攻略定制系统设计与实现+jsp(完整前后端+说明文档+mysql+lw).zip
- 基于MATLAB的导航科学计算库
- 基于JavaScript的在线考试系统(编号:65965158)(1).zip
- 湖南交通工程学院学生就业信息系统_u26ajz8t_205-wx.zip
- 基于Java WEB旅游门票信息系统设计与实现_70rn7486_206-wx.zip
- 基于javaweb宿舍管理系统(编号:18018175).zip
- 基于JavaWeb的教务管理系统(编号:75778125).zip
- Python结合Pygame库实现圣诞主题动画和音乐效果的代码示例
- 基于JavaWeb的毕业季旅游一站式定制服务平台_88z1j4jp_208-wx-(1).zip
- RGMII delay问题
- java毕设项目之基于JSP的网络游戏交易系统的设计与实现+jsp(完整前后端+说明文档+mysql+lw).zip
- 国际象棋检测2-YOLO(v5至v9)、COCO、CreateML、Darknet、Paligemma、TFRecord数据集合集.rar
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈