1 数据库语句:
2 CREATE DATABASE---创建新数据库
3 ALTER DATABASE-----修改数据库
4 CREATE TABLE -—-- -创建新表
5 ALTER TABLE - -------变更(改变)数据库表
6 DROP TABLE ---------删除表
7 CREATE INDEX - -----创建索引(搜索键)
8 DROP INDEX -------- 删除索引
9 ———————————————————————————————
10 //插入字段信息的方法 ----(数据库初始化)----
11 execsql_str = "INSERT INTO name(表名字) (id_name,data,start,end) VALUES('"+newname+"', '"+input+"' ,'"+start+"', '"+end+"' );";
12 ———————————————————————————————
13 //更新数据库数据的方法
14 UPDATE
15 oprater_tab //表格
16 SET
17 department='财务部'
18 WHERE
19 name='张三';
20
21 //删除数据库的方法
22 delete from name where id_name ='"+table_name+"';
23
24 delete
25 from
26 employee_tab //表格名字
27 where
28 name='"王6"'; //需要删除的数据
29
30 //做删除数据的代码
31 //数据库初始化==========================================================
32
33 CString execsql_str;
34 execsql_str = "DELETE FROM employee_tab WHERE name='"+name_str+"';";
35 strcpy_s(execsql,execsql_str.GetBuffer(execsql_str.GetLength()));
36 if(mysql_real_query(ssock,execsql,strlen(execsql))!=0)
37 {
38 AfxMessageBox("删除 employee_tab 数据库中 内容 出错!");
39 }
40
41 mysql_close(ssock); //关闭数据库
42
43 return true;
44 ———————————————————————————————
45 //查询你想查询部门的名字
46 execsql_str="SELECT name FROM login_tab WHERE department='中单区';";
47
48 ———————————————————————————————
49 1、文件名的属性,C/C++ 里的 附加包含目录 添加文件名(下载的数据库)到 include。
50 2、链接器里,添加 附加库目录,添加文件名(下载的数据库)lib/debug3、将 libmysql.dll 放入到建的项目里面。
51 4.添加一个数据库的函数 bool 类型的 public 类型
52 5.在函数里添加代码
53 6.最后调用这个函数。
54 ———————————————————————————————
55 //在stdafx.h中加入以下行:
56
57 #include <winsock.h>
58 #include "mysql.h "
59 #pragma comment(lib,"libmySQL.lib")
60 ———————————————————————————————
61 //连接数据库的数据
62 bool Ctest_dlgDlg::load_mysql_db(void)
63 {
64 //数据库的初始化============================================
65
66 unsigned short Port = 3306;
67 char *IPAddress = "localhost";
68 char *UserName = "root";
69 char *Password = "love00"; //数据库密码
70 char *DBName = "test1_db"; //数据库名称
71
72 MYSQL *ssock;
73 char execsql[1500];
74 ssock = (MYSQL *)malloc(sizeof(MYSQL));
75
76 mysql_init(ssock);
77 if(ssock == NULL)
78 {
79 printf_s("ERROR: MySQL ssock init error. ");
80 return FALSE;
81 }
82
83 //连接到指定的数据库
84
85 mysql_options(ssock, MYSQL_SET_CHARSET_NAME, "gb2312");
86
87 ssock = mysql_real_connect(ssock, IPAddress, UserName, Password, NULL, Port, NULL, 0);
88 if(!ssock)
89 {
90 printf_s("conn fail... ");
91 unsigned int mtint = mysql_errno(ssock);
92 return FALSE;
93 }
94
95 if(mysql_select_db(ssock, DBName) != 0)
96 {
97 printf_s("select db error. ");
98 return FALSE;
99 }
100
101 //数据库初始化==========================================================
102
103 mysql_close(ssock); //关闭数据库
104
105 return true;
106 }
107 ____________________________________________________________________________
108 //查询不重复的数据 用关键词 DISTINCT
109 select DISTINCT * from warehouse_table;
110 ———————————————————————————————
111 //判断数据是存在
112 strcpy_s(execsql,execsql_str.GetBuffer(execsql_str.GetLength()));
113 if(mysql_real_query(ssock,execsql,strlen(execsql))!=0)
114 {
115 AfxMessageBox("查询 数据库中 内容是否存在 出错");
116 }
117 MYSQL_RES *result0;
118 MYSQL_ROW row0;
119 if(!(result0=mysql_use_result(ssock)))
120 {
121 AfxMessageBox("检查 数据集 是否存在 失败!");
122 }
123 if(row0=mysql_fetch_row(result0))
124 {
125 //数据已经存在
126
127 }
128 else
129 {
130 //数据不存在
131
132 }
133 mysql_free_result(result0);
134 ———————————————————————————————
135 //在 下拉框添加数据 连接数据库
136 //新建函数
137 bool Ctest_dlgDlg::load_department(void)
138 {
139 //数据库的初始化============================================
140
141 unsigned short Port = 3306;
142 char *IPAddress = "localhost";
143 char *UserName = "root";
144 char *Password = "love00"; //数据库密码
145 char *DBName = "test1_db"; //数据库名称
146
147 MYSQL *ssock;
148 char execsql[1500];
149 ssock = (MYSQL *)malloc(sizeof(MYSQL));
150
151 mysql_init(ssock);
152 if(ssock == NULL)
153 {
154 printf_s("ERROR: MySQL ssock init error. ");
155 return FALSE;
156 }
157
158 //连接到指定的数据库
159
160 mysql_options(ssock, MYSQL_SET_CHARSET_NAME, "gb2312");
161
162 ssock = mysql_real_connect(ssock, IPAddress, UserName, Password, NULL, Port, NULL, 0);
163 if(!ssock)
164 {
165 printf_s("conn fail... ");
166 unsigned int mtint = mysql_errno(ssock);
167 return FALSE;
168 }
169
170 if(mysql_select_db(ssock, DBName) != 0)
171 {
172 printf_s("select db error. ");
173 return FALSE;
174 }
175
176 //数据库初始化==========================================================
177
178 CString execsql_str;
179
180 execsql_str="SELECT DISTINCT department FROM oprater_tab;";
181 strcpy_s(execsql,execsql_str.GetBuffer(execsql_str.GetLength()));
182 if(mysql_real_query(ssock,execsql,strlen(execsql))!=0)
183 {
184 AfxMessageBox("查询 oprater_tab 数据库中表格 department 出错1!");
185 }
186 MYSQL_RES *result2;
187 MYSQL_ROW row2;
188 if(!(result2=mysql_use_result(ssock)))
189 {
190 AfxMessageBox("读取 oprater_tab 数据集 department 失败1!");
191 }
192 else
193 {
194 CString str2;
195 ((CComboBox*)GetDlgItem(IDC_COMBO_DEPARTMENT))->ResetContent();
196 while(row2=mysql_fetch_row(result2))
197 {
198 str2.Format("%s",row2[0]);
199 m_Combo_Department.AddString(str2);
200 }
201 }
202 mysql_free_result(result2);
203
204 mysql_close(ssock); //关闭数据库
205
206 return true;
207 }
208 ———————————————————————————————
209 //查询名字是否存在
210 //((CComboBox*)GetDlgItem(IDC_COMBO_Name))->GetWindowText(name_str);————查询的东西必须在控件里显示出来,就是将查询的数据添加到控件里。
211 bool Ctest_dlgDlg::check_name(void)
212 {
213 //数据库的初始化============================================
214
215 unsigned short Port = 3306;
216 char *IPAddress = "localhost";
217 char *UserName = "root";
218 char *Password = "love00"; //数据库密码
219 char *DBName = "test1_db"; //数据库名称
220
221 MYSQL *ssock;
222 char execsql[1500];
223 ssock = (MYSQL *)malloc(sizeof(MYSQL));
224
225 mysql_init(ssock);
226 if(ssock == NULL)
227 {
228 printf_s("ERROR: MySQL ssock init error. ");
229 return FALSE;
230 }
231
232 //连接到指定的数据库
233
234 mysql_options(ssock, MYSQL_SET_CHARSET_NAME, "gb2312");
235
236 ssock = mysql_real_connect(ssock, IPAddress, UserName, Password, NULL, Port, NULL, 0);
237 if(!ssock)
238 {
239 printf_s("conn fail... ");
240 unsigned int mtint = mysql_errno(ssock);
241 return FALSE;
242 }
243
244 if(mysql_select_db(ssock, DBName) != 0)
245 {
246 printf_s("select db error. ");
247 return FALSE;
248 }
249
250 //数据库初始化==========================================================
251
252 CString execsql_str;
253 execsql_str="SELECT name FROM oprater_tab WHERE name='"+name_str+"';";
254 strcpy_s(execsql,execsql_str.GetBuffer(execsql_str.GetLength()));
255 if(mysql_real_query(ssock,execsql,strlen(execsql))!=0)
256 {
257 AfxMessageBox("查询 oprater_tab 数据库中 name 是否存在 出错3!");
258 }
259 MYSQL_RES *result0;
260 MYSQL_ROW row0;
261 if(!(result0=mysql_use_result(ssock)))
262 {
263 AfxMessageBox("检查 oprater_tab 数据集 name 是否存在 失败3!");
264 }
265 if(row0=mysql_fetch_row(result0))
266 {
267 //数据已经存在
268
269 name_flag=true;
270 AfxMessageBox("查有此人!");
271 }
272 else
273 {
274 //数据不存在
275
276 name_flag=false;
277
278 AfxMessageBox("查无此人!");
279 }
280 mysql_free_result(result0);
281
282 mysql_close(ssock); //关闭数据库
283
284 return true;
285 }
286
287 ———————————————————————————————
288 //获得记录数量操作
289 execsql_str="SELECT count(*) FROM table ;";
290 strcpy_s(execsql,execsql_str.GetBuffer(execsql_str.GetLength()));
291 if(mysql_real_query(ssock,execsql,strlen(execsql))!=0)
292 {
293 AfxMessageBox("查询数据库中table内容出错");
294 }
295
296 MYSQL_RES *result;
297 MYSQL_ROW row;
298 if(!(result=mysql_use_result(ssock)))
299 {
300 AfxMessageBox("读取table中内容失败");
301 return false;
302 }
303 else
304 {
305 CString str;
306 int i=0;
307 while(row=mysql_fetch_row(result))
308 {
309 str.Format("%s",row[0]);
310 AfxMessageBox(str); //显示记录数量
311 i++;
312 }
313 }
314 mysql_free_result(result);
315
316 ———————————————————————————————
317
318 最终的代码
319 ———————————————————————————————
320 bool Ctest_dlgDlg::load_mysql_db(void)
321 {
322 //数据库的初始化============================================
323
324 unsigned short Port = 3306;
325 char *IPAddress = "localhost";
326 char *UserName = "root";
327 char *Password = "love00"; //数据库密码
328 char *DBName = "test1_db"; //数据库名称
329
330 MYSQL *ssock;
331 char execsql[1500];
332 ssock = (MYSQL *)malloc(sizeof(MYSQL));
333
334 mysql_init(ssock);
335 if(ssock == NULL)
336 {
337 printf_s("ERROR: MySQL ssock init error. ");
338 return FALSE;
339 }
340
341 //连接到指定的数据库
342
343 mysql_options(ssock, MYSQL_SET_CHARSET_NAME, "gb2312");
344
345 ssock = mysql_real_connect(ssock, IPAddress, UserName, Password, NULL, Port, NULL, 0);
346 if(!ssock)
347 {
348 printf_s("conn fail... ");
349 unsigned int mtint = mysql_errno(ssock);
350 return FALSE;
351 }
352
353 if(mysql_select_db(ssock, DBName) != 0)
354 {
355 printf_s("select db error. ");
356 return FALSE;
357 }
358
359 //数据库初始化==========================================================
360
361 CString execsql_str;
362
363 execsql_str="SELECT name FROM oprater_tab;";
364 strcpy_s(execsql,execsql_str.GetBuffer(execsql_str.GetLength()));
365 if(mysql_real_query(ssock,execsql,strlen(execsql))!=0)
366 {
367 AfxMessageBox("查询 oprater_tab 数据库中表格 name 出错1!");
368 }
369 MYSQL_RES *result1;
370 MYSQL_ROW row1;
371 if(!(result1=mysql_use_result(ssock)))
372 {
373 AfxMessageBox("读取 oprater_tab 数据集 name 失败1!");
374 }
375 else
376 {
377 CString str1;
378 m_List_Setup.DeleteAllItems();
379 while(row1=mysql_fetch_row(result1))
380 {
381 str1.Format("%s",row1[0]);
382 m_List_Setup.InsertItem(0,str1);
383 }
384 }
385 mysql_free_result(result1);
386
387 mysql_close(ssock); //关闭数据库
388
389 return true;
390 }
391 ___________________________________________________________________________
392 //查询不重复的数据 用关键词 DISTINCT
393
394 select DISTINCT * from warehouse_table;
395
396 ———————————————————————————————
397 //判断数据是否存在
398 strcpy_s(execsql,execsql_str.GetBuffer(execsql_str.GetLength()));
399 if(mysql_real_query(ssock,execsql,strlen(execsql))!=0)
400 {
401 AfxMessageBox("查询 数据库中 内容是否存在 出错");
402 }
403 MYSQL_RES *result0;
404 MYSQL_ROW row0;
405 if(!(result0=mysql_use_result(ssock)))
406 {
407 AfxMessageBox("检查 数据集 是否存在 失败!");
408 }
409 if(row0=mysql_fetch_row(result0))
410 {
411 //数据已经存在
412
413 }
414 else
415 {
416 //数据不存在
417
418 }
419 mysql_free_result(result0);
420 ———————————————————————————————
421 //获得ComboBox内的数据:
422
423 ((CComboBox*)GetDlgItem(IDC_COMBO_INPUT))->GetWindowText(input_str);
424
425 //对话框屏蔽回车的方法:
426 BOOL CDialog_Run::PreTranslateMessage(MSG* pMsg)
427 {
428 // TODO: Add your specialized code here and/or call the base class
429
430 if(pMsg->message == WM_KEYDOWN)
431 {
432 switch(pMsg->wParam)
433 {
434 case VK_RETURN: // 屏蔽回车
435 {
436
437 }
438 return true;
439 }
440 }
441 return CDialog::PreTranslateMessage(pMsg);
442 }
443
444 //俩个COMBOX的值相加 还有定义成员变量
445 BOOL CText2Dlg::PreTranslateMessage(MSG* pMsg)
446 {
447 // TODO: 在此添加专用代码和/或调用基类
448
449 // TODO: Add your specialized code here and/or call the base class
450
451 if(pMsg->message == WM_KEYDOWN)
452 {
453 switch(pMsg->wParam)
454 {
455 case VK_RETURN: // 屏蔽回车
456 {
457 ((CComboBox*)GetDlgItem(IDC_COMBO_X))->GetWindowText(x_str);
458 ((CComboBox*)GetDlgItem(IDC_COMBO_Y))->GetWindowText(y_str);
459
460
461 int z_int;
462
463 z_int=atoi(x_str)+atoi(y_str);
464 z_str.Format("%d",z_int);
465
466 m_Combo_Z.SetWindowTextA(z_str);
467
468 }
469 return true;
470 }
471 }
472
473 return CDialogEx::PreTranslateMessage(pMsg);
474 }
475 ———————————————————————————————
476
477 //数据库初始化(添加数据库的所有信息)==========================================================
478
479 CString execsql_str;
480
481 //execsql_str="SELECT id,number,name,department FROM employee_tab;";
482 execsql_str="SELECT * FROM employee_tab;";
483 strcpy_s(execsql,execsql_str.GetBuffer(execsql_str.GetLength()));
484 if(mysql_real_query(ssock,execsql,strlen(execsql))!=0)
485 {
486 AfxMessageBox("查询 employee_tab 数据库中表格 name 出错1!");
487 }
488 MYSQL_RES *result;
489 MYSQL_ROW row;
490 if(!(result=mysql_use_result(ssock)))
491 {
492 AfxMessageBox("读取 employee_tab 数据集 name 失败1!");
493 }
494 else
495 {
496 CString str;
497 m_List_Setup2.DeleteAllItems();
498 while(row=mysql_fetch_row(result))
499 {
500 str.Format("%s",row[0]);
501 m_List_Setup2.InsertItem(0,str);
502
503 str.Format("%s",row[1]);
504 m_List_Setup2.SetItemText(0,1,str);
505
506 str.Format("%s",row[2]);
507 m_List_Setup2.SetItemText(0,2,str);
508 str.Format("%s",row[3]);
509 m_List_Setup2.SetItemText(0,3,str);
510 }
511 }
512 mysql_free_result(result);
513
514
515 mysql_close(ssock); //关闭数据库
516
517 return true;
518
519 }
520
521
522
523 //俩个str 的变量相加
524 ((CComboBox*)GetDlgItem(IDC_COMBO_X))->GetWindowText(x_str);
525 ((CComboBox*)GetDlgItem(IDC_COMBO_Y))->GetWindowText(y_str);
526 ::AfxMessageBox("X="+x_str+" Y="+y_str);
527
528
529 //获得系统日期和时间的方法:
530
531 CTime t = CTime::GetCurrentTime();
532 int y=t.GetYear();
533 int m=t.GetMonth();
534 int d=t.GetDay();
535 int hh=t.GetHour();
536 int mm=t.GetMinute();
537 int ss=t.GetSecond();
538
539 year_str.Format("%d",y);
540
541 if(m<10)
542 {
543 month_str.Format("0%d",m);
544 }
545 else
546 {
547 month_str.Format("%d",m);
548 }
549 if(d<10)
550 {
551 day_str.Format("0%d",d);
552 }
553 else
554 {
555 day_str.Format("%d",d);
556 }
557 if(hh<10)
558 {
559 hour_str.Format("0%d",hh);
560 }
561 else
562 {
563 hour_str.Format("%d",hh);
564 }
565 if(mm<10)
566 {
567 minute_str.Format("0%d",mm);
568 }
569 else
570 {
571 minute_str.Format("%d",mm);
572 }
573 if(ss<10)
574 {
575 second_str.Format("0%d",ss);
576 }
577 else
578 {
579 second_str.Format("%d",ss);
580 }
581
582 m_Combo_Year.SetWindowTextA(year_str);
583 m_Combo_Month.SetWindowTextA(month_str);
584 m_Combo_Day.SetWindowTextA(day_str);
585
586
587 //初始化数据:
588 void Ctest_dlgDlg::clear_all()
589 {
590 x_str="100";
591 y_str="200";
592
593 m_Combo_X.SetWindowTextA(x_str);
594 m_Combo_Y.SetWindowTextA(y_str);
595 }
596
597 //新增下拉数据方式
598
599 m_Combo_Department.AddString("技术部");
600 m_Combo_Department.AddString("业务部");
601 m_Combo_Department.AddString("行政部");
602
603
604 //下拉框数据清空方式: ResetContent();
605
606 ((CComboBox*)GetDlgItem(IDC_COMBO_CLASS1))->ResetContent();
607
608 //下拉框显示选择的内容用 SelectString :
609
610 m_Combo_Qty_Unit.SelectString(0,qty_unit_str(“数据”));
611
612
613 //--显示提示信息,弹出对话框
614 void Ctest_dlgDlg::OnCbnSelendokComboDepartment()
615 {
616 // TODO: 在此添加控件通知处理程序代码
617
618 CComboBox* combo1= ( CComboBox*)GetDlgItem(IDC_COMBO_DEPARTMENT);
619 int nIndex = combo1->GetCurSel();
620 if(nIndex>=0)
621 {
622 combo1->GetLBText( nIndex, department_str);
623
624 AfxMessageBox(department_str);
625 }
626 }
627
628 //数据格式的互相转换
629
630 (1)字符串转整形
631 CString str;
632 int i;
633 i=atoi(str); //短整型
634
635
636 (2)整形转字符串
637 str.Format( "%d ",i);
638
639
640 //文本编辑框里面设置为CString属性后
641
642 SetDlgItemText(IDC_EDIT_PROBLEM1,"str");
643 //设置 文本编辑框 IDC_EDIT_PROBLEM1==》"str"
644
645 ((CComboBox*)GetDlgItem(IDC_EDIT_PROBLEM1))->GetWindowText(problem1_str);
646 //获得 文本编辑框 IDC_EDIT_PROBLEM1==》"str"
647 //一个数据在 插件 里 显示
648 m_Edit_Rceive.SetWindowTextA(input_str);
649
650 //关于 enter 的显示数据
651 BOOL CText2Dlg::PreTranslateMessage(MSG* pMsg)
652 {
653 // TODO: 在此添加专用代码和/或调用基类
654
655 // TODO: Add your specialized code here and/or call the base class
656
657 if(pMsg->message == WM_KEYDOWN)
658 {
659 switch(pMsg->wParam)
660 {
661 case VK_RETURN: // 屏蔽回车
662 {
663 ((CComboBox*)GetDlgItem(IDC_COMBO_X))->GetWindowText(x_str);
664 ((CComboBox*)GetDlgItem(IDC_COMBO_Y))->GetWindowText(y_str);
665
666
667 int z_int;
668
669 z_int=atoi(x_str)+atoi(y_str);
670 z_str.Format("%d",z_int);
671
672 m_Combo_Z.SetWindowTextA(z_str);
673
674
675 //----显示时间日期
676 CTime t = CTime::GetCurrentTime();
677 int y=t.GetYear();
678 int m=t.GetMonth();
679 int d=t.GetDay();
680 int hh=t.GetHour();
681 int mm=t.GetMinute();
682 int ss=t.GetSecond();
683
684 year_str.Format("%d",y);
685
686 if(m<10)
687 {
688 month_str.Format("0%d",m);
689 }
690 else
691 {
692 month_str.Format("%d",m);
693 }
694 if(d<10)
695 {
696 day_str.Format("0%d",d);
697 }
698 else
699 {
700 day_str.Format("%d",d);
701 }
702 if(hh<10)
703 {
704 hour_str.Format("0%d",hh);
705 }
706 else
707 {
708 hour_str.Format("%d",hh);
709 }
710 if(mm<10)
711 {
712 minute_str.Format("0%d",mm);
713 }
714 else
715 {
716 minute_str.Format("%d",mm);
717 }
718 if(ss<10)
719 {
720 second_str.Format("0%d",ss);
721 }
722 else
723 {
724 second_str.Format("%d",ss);
725 }
726
727 m_Combo_Year.SetWindowTextA(year_str);
728 m_Combo_Month.SetWindowTextA(month_str);
729 m_Combo_Day.SetWindowTextA(day_str);
730
731 m_Combo_Hour.SetWindowTextA(hour_str);
732 m_Combo_Minute.SetWindowTextA(minute_str);
733 m_Combo_Second.SetWindowTextA(second_str);
734
735
736
737 }
738 return true;
739 }
740 }
741
742 return CDialogEx::PreTranslateMessage(pMsg);
743 }
744
745
746
747 //设置CtrlList内的数据:
748
749 m_List_Test.ModifyStyle( 0L, LVS_SHOWSELALWAYS );
750 m_List_Test.SetExtendedStyle( LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES | LVS_EX_CHECKBOXES );//item前生成checkbox控件
751
752 CRect linshi_rect;
753 int linshi_nWidth;
754
755 m_List_Test.GetClientRect(linshi_rect);
756 linshi_nWidth = linshi_rect.Width();
757 m_List_Test.InsertColumn(1,"段号",LVCFMT_CENTER,linshi_nWidth*1/12,0);
758 m_List_Test.InsertColumn(2,"加工方式",LVCFMT_CENTER,linshi_nWidth*4/12,0);
759 m_List_Test.InsertColumn(3,"宽度",LVCFMT_CENTER,linshi_nWidth*1/12,0);
760 m_List_Test.InsertColumn(4,"单位",LVCFMT_CENTER,linshi_nWidth*1/12,0);
761 m_List_Test.InsertColumn(5,"米数",LVCFMT_CENTER,linshi_nWidth*1/12,0);
762 m_List_Test.InsertColumn(6,"排产数量",LVCFMT_CENTER,linshi_nWidth*2/12,0);
763 m_List_Test.InsertColumn(7,"完成数量",LVCFMT_CENTER,linshi_nWidth*2/12,0);
764
765
766 //设置CtrlList内的数据:
767 m_List_Setup.ModifyStyle( 0L, LVS_SHOWSELALWAYS );
768 m_List_Setup.SetExtendedStyle( LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES | LVS_EX_CHECKBOXES );//item前生成checkbox控件
769
770 CRect linshi_rect;
771 int linshi_nWidth;
772
773 m_List_Setup.GetClientRect(linshi_rect);
774 linshi_nWidth = linshi_rect.Width();
775 m_List_Setup.InsertColumn(1,"序号",LVCFMT_CENTER,linshi_nWidth*1/8,0);
776 m_List_Setup.InsertColumn(2,"X",LVCFMT_CENTER,linshi_nWidth*2/8,0);
777 m_List_Setup.InsertColumn(3,"Y",LVCFMT_CENTER,linshi_nWidth*3/8,0);
778 m_List_Setup.InsertColumn(4,"Z",LVCFMT_CENTER,linshi_nWidth*2/8,0);
779
780
781 for(int i=0;i<3;i++)
782 {
783 CString sn_str;
784 sn_str.Format("%d",i);
785
786 m_List_Setup.InsertItem(i,sn_str);
787 m_List_Setup.SetItemText(i,1,"345");
788 m_List_Setup.SetItemText(i,2,"567");
789 m_List_Setup.SetItemText(i,3,"789");
790 }
791
792
793
794 //被选中的数据
795 CString str;
796 int Row=m_List_Setup.GetSelectionMark();
797 if(Row>=0)
798 {
799 str=m_List_Setup.GetItemText(Row,1);
800
801 AfxMessageBox(str);
802 }
803
804
805 //checkbox的数据选中
806 if( m_List_Order.GetCheck(Row)!=0)
807 {
808 AfxMessageBox("checkbox被选中!");
809 }
810 else
811 {
812 AfxMessageBox("checkbox没有被选中!");
813 }
814
815
816
817 //字符串比较的方法:
818 if(strcmp(cmp1_str,cmp2_str)==0)
819 {
820 //字符串相等
821 }
822 else
823 {
824 //字符串不相等
825 }
826 ___________________________________________________________________________
827 //串口
828 1.添加串口 Active X 插件
829 2、添加 串口的变量名 m_mscom
830 3.添加函数
831 //串口打开
832 void Ctest_dlgDlg::open_com(void)
833 {
834 if(m_mscomm.get_PortOpen()) //如果串口是打开的,则行关闭串口
835 {
836 m_mscomm.put_PortOpen(FALSE);
837 }
838 m_mscomm.put_CommPort(7); //选择COM7
839 m_mscomm.put_InBufferSize(4096); //接收缓冲区
840 m_mscomm.put_OutBufferSize(4096); //发送缓冲区
841 m_mscomm.put_InputLen(0); //设置当前接收区数据长度为0,表示全部读取
842 m_mscomm.put_InputMode(1); //以二进制方式读写数据
843 m_mscomm.put_RThreshold(1); //接收缓冲区有1个及1个以上字符时,将引发接收数据的OnComm事件
844 m_mscomm.put_Settings("115200,n,8,1"); //波特率115200无检验位,8个数据位,1个停止位
845
846 if(!m_mscomm.get_PortOpen()) //如果串口没有打开则打开
847 {
848 m_mscomm.put_PortOpen(TRUE); //打开串口
849 }
850 else
851 {
852 m_mscomm.put_OutBufferCount(0);
853 AfxMessageBox("串口7打开失败");
854 }
855 }
856 //接受数据
857 //添加事件
858 void Ctest_dlgDlg::OnCommMscomm1()
859 {
860 // TODO: 在此处添加消息处理程序代码
861
862 VARIANT variant_inp;
863 COleSafeArray safearray_inp;
864 LONG len,k;
865 BYTE rxdata[4096]; //设置BYTE数组 An 8-bit integerthat is not signed.
866 CString strtemp;
867 if(m_mscomm.get_CommEvent()==2) //值为 2 表示接收缓冲区内有字符
868 {
869 variant_inp=m_mscomm.get_Input(); //读缓冲区消息
870 safearray_inp=variant_inp; //变量转换
871 len=safearray_inp.GetOneDimSize(); //得到有效的数据长度
872
873 for(k=0;k<len;k++)
874 {
875 safearray_inp.GetElement(&k,rxdata+k); //转换为BYTE型数组
876 }
877 for(k=0;k<len;k++) //将数组转换为 CString 型变量
878 {
879 BYTE bt=*(char*)(rxdata+k); //字符型
880 if(bt==0x0A)
881 {
882 }
883 else if(bt==0x0D)
884 {
885 input();
886
887 input_str="";
888 strtemp="";
889 }
890 else
891 {
892 strtemp.Format("%c",bt);
893 input_str+=strtemp;
894 }
895 }
896 }
897 }
898
899 //发送数据
900 tx_str=x_str; m_mscomm2.put_Output(COleVariant(tx_str));//发送数据
901 //(这是在屏蔽回车里添加的)
902
903
904 //串口关闭
905 if(m_mscomm.get_PortOpen()) //如果串口打开则关闭
906 {
907 m_mscomm.put_PortOpen(FALSE); //关闭串口
908 }
909
910
911 //在文本框中发送数据(事件)
912 // TODO: 在此添加控件通知处理程序代码
913 //发送数据
914 open_com2(); //调用
915
916 CString senddata_st;
917
918 ((CComboBox*)GetDlgItem(IDC_EDIT_SEND))->GetWindowText(senddata_str);
919
920 m_mscomm2.put_Output(COleVariant(senddata_str));//发送数据
921
922 //CLEAR
923 senddata_str="";
924 m_Edit_Send.SetWindowTextA(senddata_str);
925
926 // tx_str=x_str;
927 // m_mscomm2.put_Output(COleVariant(tx_str));//发送数据
928 //_________________________________________________________________________
929 //信息框多全化
930 MessageBox(department_str,"部门提示",0);//4
931 ———————————————————————————————
932
933
934 对话框的触发调用:
935 #include "Dialog9.h"
936
937 void CDaewooBarcodePrintView::OnMenuitem1()
938 {
939 // TODO: Add your command handler code here
940 CDialog9 dlg;
941 int nRet=dlg.DoModal();
942 }
943
944 // MainFrm.cpp : CMainFrame 类的实现
945 //
946
947 #include "stdafx.h"
948 #include "SBVP.h"
949
950 #include "MainFrm.h"
951 #include "Dialog_L.h"
952 #include "Dialog_C.h"
953 #include "Dialog_R.h"
954 #include "Dialog_O.h"
955 #include "Dialog_S.h"
956 #include "Dialog_B.h"
957
958 #ifdef _DEBUG
959 #define new DEBUG_NEW
960 #endif
961 //_________________________________________________________________________
962 对话框对应的编程尺寸:
963
964 1920*1080
965 =1088*574
966
967 1600*900
968 =906*470 =1056*508
969
970 1440*900
971 =814*470
972
973 1366*768
974 =770*395 =900*426 tabctrl 890X380
975
976 1024*768
977 =576*395 =672*426
978
979 ———————————————————————————————
980 读取文件名
981 获得目录中指定文件名的方法:
982
983 m_List_Btw.DeleteAllItems(); //清空标签打印格式列表数据
984
985 CFileFind finder;
986 CString strWildcard;
987 CString str;
988 strWildcard = "B:\\PV\\QR\\OIQC\\fksb_box\\*.btw ";
989 BOOL bWorking = finder.FindFile(strWildcard);
990 int j=0;
991 while(bWorking!=0)
992 {
993 bWorking = finder.FindNextFile();
994 if(bWorking!=0)
995 {
996 str= finder.GetFileName();
997 m_List_Btw.InsertItem(j,str);
998 j++;
999 }
1000 else
1001 {
1002 str= finder.GetFileName();
1003 m_List_Btw.InsertItem(j,str);
1004 j++;
1005 }
1006 }
1007 finder.Close();
1008
1009 ———————————————————————————————
1010 //获得文件里的数据
1011 load_mac_no
1012 {
1013 bool file_found_flag=false;
1014 CFileFind finder;
1015 CString strWildcard;
1016 strWildcard = "C:\\POF\\POF_MAC.TXT";
1017 BOOL bWorking = finder.FindFile(strWildcard);
1018 if(bWorking!=0)
1019 {
1020 bWorking = finder.FindNextFile();
1021 file_found_flag = true;
1022 }
1023 finder.Close();
1024
1025 if(file_found_flag)
1026 {
1027 file_found_flag = false;
1028
1029 CString fileName="C:\\POF\\POF_MAC.TXT";
1030 CStdioFile file;
1031
1032 file.Open(fileName,CFile::modeRead,0);
1033
1034 CString read_str;
1035 while(file.ReadString(read_str))
1036 {
1037 mac_no_str=read_str;
1038 m_Combo_Mac_No.SetWindowTextA(mac_no_str);
1039 //AfxMessageBox(read_str);
1040 }
1041 file.Close();
1042 }
1043 else
1044 {
1045 AfxMessageBox("mac_no临时数据文件不存在!");
1046 }
1047 }
1048
1049 //__________________________________________________________________________
1050
1051 CString str;
1052 str="123456;789067;";
1053 unsigned int pos_int;
1054 pos_int=str.Find(";");
1055 AfxMessageBox(str);
1056
1057 ———————————————————————————————
1058
1059 CString str1,str3;
1060 str3="123456;ABCD1234;7890;1234";
1061
1062 unsigned int pos_int;
1063 pos_int=str3.Find(";");
1064 str1=str3.Left(pos_int);
1065 AfxMessageBox(str1);
1066
1067 str3=str3.Right(str3.GetLength()-1-pos_int);
1068 pos_int=str3.Find(";");
1069 str1=str3.Left(pos_int);
1070 AfxMessageBox(str1);
1071
1072 str3=str3.Right(str3.GetLength()-1-pos_int);
1073 pos_int=str3.Find(";");
1074 str1=str3.Left(pos_int);
1075 AfxMessageBox(str1);
1076
1077
1078 //换算____________________________________________________________________
1079
1080
1081 char buffer[4];
1082
1083 char a,b,c,d;
1084
1085 for(int s=0;s<=atoi(print_qty_str);s++)
1086
1087 {
1088
1089 strncpy(buffer,(LPCTSTR)add_lsh,sizeof(buffer));
1090
1091 a=buffer[0];
1092
1093 b=buffer[1];
1094
1095 c=buffer[2];
1096
1097 d=buffer[3];
1098
1099
1100 if(d==max)
1101
1102 {
1103
1104 d=min;
1105
1106
1107 if(c==max)
1108
1109 {
1110
1111 c=min;
1112
1113
1114
1115 if(b==max)
1116
1117 {
1118
1119 b=min;
1120
1121
1122 if(a==max)
1123
1124 {
1125
1126 a=min;
1127
1128 b=min;
1129
1130 c=min;
1131
1132 d=min;
1133
1134 }
1135
1136 else
1137
1138 {
1139
1140 add=a;
1141
1142 add_1();
1143
1144 a=add;
1145
1146 }
1147
1148 }
1149
1150 else
1151
1152 {
1153
1154 add=b;
1155
1156 add_1();
1157 b=add;
1158
1159 }
1160
1161 }
1162
1163 else
1164
1165 {
1166
1167 add=c;
1168
1169 add_1();
1170
1171 c=add;
1172
1173 }
1174
1175 }
1176
1177 else
1178
1179 {
1180
1181 add=d;
1182
1183 add_1();
1184
1185 d=add;
1186
1187 }
1188
1189
1190 add_lsh=a;
1191
1192 add_lsh+=b;
1193
1194 add_lsh+=c;
1195
1196 add_lsh+=d;
1197
1198 sn_array.Add(add_lsh);
1199
1200 //那个换算—————————————————————————
1201 void CBVP(防重码打印模块V_100)Dlg::get_dell_4_sn(void)
1202 {
1203 ((CComboBox*)GetDlgItem(IDC_COMBO_PRINT_QTY))->GetWindowText(print_qty_str);
1204 ((CComboBox*)GetDlgItem(IDC_COMBO_SN_START))->GetWindowText(sn_start_str);
1205
1206 sn_start_str="A123";
1207
1208 unsigned int sn_start_int;
1209
1210 if(sn_start_str=="")
1211 {
1212 //======意味着从0001开始计算序列号======//
1213
1214 sn_start_int=1;
1215 }
1216 else
1217 {
1218 char buffer[4];
1219 char a,b,c,d;
1220
1221 strncpy(buffer,(LPCTSTR)sn_start_str,sizeof(buffer));
1222 a=buffer[0];
1223 b=buffer[1];
1224 c=buffer[2];
1225 d=buffer[3];
1226
1227 //======计算出起始序列号对应的10进制数据是多少?======//
1228
1229 if(a>9)
1230 {
1231 //======数据区位于10000-24999区间======//
1232
1233 if(a=='A')
1234 {
1235 sn_start_int=atoi(sn_start_str.Right(3))+10000;
1236 }
1237 else if(a=='B')
1238 {
1239 sn_start_int=atoi(sn_start_str.Right(3))+11000;
1240 }
1241 else if(a=='C')
1242 {
1243 sn_start_int=atoi(sn_start_str.Right(3))+12000;
1244 }
1245 else if(a=='D')
1246 {
1247 sn_start_int=atoi(sn_start_str.Right(3))+13000;
1248 }
1249 else if(a=='E')
1250 {
1251 sn_start_int=atoi(sn_start_str.Right(3))+14000;
1252 }
1253 else if(a=='F')
1254 {
1255 sn_start_int=atoi(sn_start_str.Right(3))+15000;
1256 }
1257 else if(a=='G')
1258 {
1259 sn_start_int=atoi(sn_start_str.Right(3))+16000;
1260 }
1261 else if(a=='H')
1262 {
1263 sn_start_int=atoi(sn_start_str.Right(3))+17000;
1264 }
1265 else if(a=='I')
1266 {
1267 sn_start_int=atoi(sn_start_str.Right(3))+18000;
1268 }
1269 else if(a=='J')
1270 {
1271 sn_start_int=atoi(sn_start_str.Right(3))+19000;
1272 }
1273 else if(a=='K')
1274 {
1275 sn_start_int=atoi(sn_start_str.Right(3))+20000;
1276 }
1277 else if(a=='L')
1278 {
1279 sn_start_int=atoi(sn_start_str.Right(3))+21000;
1280 }
1281 else if(a=='M')
1282 {
1283 sn_start_int=atoi(sn_start_str.Right(3))+22000;
1284 }
1285 else if(a=='N')
1286 {
1287 sn_start_int=atoi(sn_start_str.Right(3))+23000;
1288 }
1289 else if(a=='O')
1290 {
1291 sn_start_int=atoi(sn_start_str.Right(3))+24000;
1292 }
1293 }
1294 else if(d>9)
1295 {
1296 //======数据区位于25000-50999区间======//
1297
1298 if(d=='A')
1299 {
1300 sn_start_int=atoi(sn_start_str.Left(3))+25000;
1301 }
1302 else if(d=='B')
1303 {
1304 sn_start_int=atoi(sn_start_str.Left(3))+26000;
1305 }
1306 else if(d=='C')
1307 {
1308 sn_start_int=atoi(sn_start_str.Left(3))+27000;
1309 }
1310 else if(d=='D')
1311 {
1312 sn_start_int=atoi(sn_start_str.Left(3))+28000;
1313 }
1314 else if(d=='E')
1315 {
1316 sn_start_int=atoi(sn_start_str.Left(3))+29000;
1317 }
1318 else if(d=='F')
1319 {
1320 sn_start_int=atoi(sn_start_str.Left(3))+30000;
1321 }
1322 else if(d=='G')
1323 {
1324 sn_start_int=atoi(sn_start_str.Left(3))+31000;
1325 }
1326 else if(d=='H')
1327 {
1328 sn_start_int=atoi(sn_start_str.Left(3))+32000;
1329 }
1330 else if(d=='I')
1331 {
1332 sn_start_int=atoi(sn_start_str.Left(3))+33000;
1333 }
1334 else if(d=='J')
1335 {
1336 sn_start_int=atoi(sn_start_str.Left(3))+34000;
1337 }
1338 else if(d=='K')
1339 {
1340 sn_start_int=atoi(sn_start_str.Left(3))+35000;
1341 }
1342 else if(d=='L')
1343 {
1344 sn_start_int=atoi(sn_start_str.Left(3))+36000;
1345 }
1346 else if(d=='M')
1347 {
1348 sn_start_int=atoi(sn_start_str.Left(3))+37000;
1349 }
1350 else if(d=='N')
1351 {
1352 sn_start_int=atoi(sn_start_str.Left(3))+38000;
1353 }
1354 else if(d=='O')
1355 {
1356 sn_start_int=atoi(sn_start_str.Left(3))+39000;
1357 }
1358 else if(d=='P')
1359 {
1360 sn_start_int=atoi(sn_start_str.Left(3))+40000;
1361 }
1362 else if(d=='Q')
1363 {
1364 sn_start_int=atoi(sn_start_str.Left(3))+41000;
1365 }
1366 else if(d=='R')
1367 {
1368 sn_start_int=atoi(sn_start_str.Left(3))+42000;
1369 }
1370 else if(d=='S')
1371 {
1372 sn_start_int=atoi(sn_start_str.Left(3))+43000;
1373 }
1374 else if(d=='T')
1375 {
1376 sn_start_int=atoi(sn_start_str.Left(3))+44000;
1377 }
1378 else if(d=='U')
1379 {
1380 sn_start_int=atoi(sn_start_str.Left(3))+45000;
1381 }
1382 else if(d=='V')
1383 {
1384 sn_start_int=atoi(sn_start_str.Left(3))+46000;
1385 }
1386 else if(d=='W')
1387 {
1388 sn_start_int=atoi(sn_start_str.Left(3))+47000;
1389 }
1390 else if(d=='X')
1391 {
1392 sn_start_int=atoi(sn_start_str.Left(3))+48000;
1393 }
1394 else if(d=='Y')
1395 {
1396 sn_start_int=atoi(sn_start_str.Left(3))+49000;
1397 }
1398 else if(d=='Z')
1399 {
1400 sn_start_int=atoi(sn_start_str.Left(3))+50000;
1401 }
1402 }
1403 }
1404
1405 unsigned int temp_max_sn_int;
1406 temp_max_sn_int=sn_start_int+atoi(print_qty_str);
1407 if(temp_max_sn_int>50999)
1408 {
1409 AfxMessageBox("超过整个序列号范围,无法生成序列号!!!");
1410 }
1411
1412 else
1413 {
1414 sn_array.RemoveAll();
1415
1416 for(int i=0;i<atoi(print_qty_str);i++)
1417 {
1418 sn_start_int++;
1419
1420 CString temp_sn_str;
1421 unsigned int temp_sn1_int,temp_sn3_int;
1422 CString temp_sn3_str;
1423 if(sn_start_int<10)
1424 {
1425 temp_sn_str.Format("000%d",sn_start_int);
1426 }
1427 else if((sn_start_int>9)&&(sn_start_int<100))
1428 {
1429 temp_sn_str.Format("00%d",sn_start_int);
1430 }
1431 else if((sn_start_int>99)&&(sn_start_int<1000))
1432 {
1433 temp_sn_str.Format("0%d",sn_start_int);
1434 }
1435 else if((sn_start_int>999)&&(sn_start_int<10000))
1436 {
1437 temp_sn_str.Format("%d",sn_start_int);
1438 }
1439 else if((sn_start_int>10000)&&(sn_start_int<25000))
1440 {
1441 temp_sn3_int=sn_start_int%1000;
1442 if(temp_sn3_int<10)
1443 {
1444 temp_sn3_str.Format("00%d",temp_sn3_int);
1445 }
1446 else if((temp_sn3_int>9)&&(temp_sn3_int<100))
1447 {
1448 temp_sn3_str.Format("0%d",temp_sn3_int);
1449 }
1450 else if((temp_sn3_int>99)&&(temp_sn3_int<1000))
1451 {
1452 temp_sn3_str.Format("%d",temp_sn3_int);
1453 }
1454
1455 temp_sn1_int=sn_start_int/1000;
1456 if(temp_sn1_int==10)
1457 {
1458 temp_sn_str="A"+temp_sn3_str;
1459 }
1460 else if(temp_sn1_int==11)
1461 {
1462 temp_sn_str="B"+temp_sn3_str;
1463 }
1464 else if(temp_sn1_int==12)
1465 {
1466 temp_sn_str="C"+temp_sn3_str;
1467 }
1468 else if(temp_sn1_int==13)
1469 {
1470 temp_sn_str="D"+temp_sn3_str;
1471 }
1472 else if(temp_sn1_int==14)
1473 {
1474 temp_sn_str="E"+temp_sn3_str;
1475 }
1476 else if(temp_sn1_int==15)
1477 {
1478 temp_sn_str="F"+temp_sn3_str;
1479 }
1480 else if(temp_sn1_int==16)
1481 {
1482 temp_sn_str="G"+temp_sn3_str;
1483 }
1484 else if(temp_sn1_int==17)
1485 {
1486 temp_sn_str="H"+temp_sn3_str;
1487 }
1488 else if(temp_sn1_int==18)
1489 {
1490 temp_sn_str="I"+temp_sn3_str;
1491 }
1492 else if(temp_sn1_int==19)
1493 {
1494 temp_sn_str="J"+temp_sn3_str;
1495 }
1496 else if(temp_sn1_int==20)
1497 {
1498 temp_sn_str="K"+temp_sn3_str;
1499 }
1500 else if(temp_sn1_int==21)
1501 {
1502 temp_sn_str="L"+temp_sn3_str;
1503 }
1504 else if(temp_sn1_int==22)
1505 {
1506 temp_sn_str="M"+temp_sn3_str;
1507 }
1508 else if(temp_sn1_int==23)
1509 {
1510 temp_sn_str="N"+temp_sn3_str;
1511 }
1512 else if(temp_sn1_int==24)
1513 {
1514 temp_sn_str="O"+temp_sn3_str;
1515 }
1516 }
1517 else if(sn_start_int>=25000)
1518 {
1519 temp_sn3_int=sn_start_int%1000;
1520 if(temp_sn3_int<10)
1521 {
1522 temp_sn3_str.Format("00%d",temp_sn3_int);
1523 }
1524 else if((temp_sn3_int>9)&&(temp_sn3_int<100))
1525 {
1526 temp_sn3_str.Format("0%d",temp_sn3_int);
1527 }
1528 else if((temp_sn3_int>99)&&(temp_sn3_int<1000))
1529 {
1530 temp_sn3_str.Format("%d",temp_sn3_int);
1531 }
1532
1533 temp_sn1_int=sn_start_int/1000;
1534 if(temp_sn1_int==25)
1535 {
1536 temp_sn_str=temp_sn3_str+"A";
1537 }
1538 else if(temp_sn1_int==26)
1539 {
1540 temp_sn_str=temp_sn3_str+"B";
1541 }
1542 else if(temp_sn1_int==27)
1543 {
1544 temp_sn_str=temp_sn3_str+"C";
1545 }
1546 else if(temp_sn1_int==28)
1547 {
1548 temp_sn_str=temp_sn3_str+"D";
1549 }
1550 else if(temp_sn1_int==29)
1551 {
1552 temp_sn_str=temp_sn3_str+"E";
1553 }
1554 else if(temp_sn1_int==30)
1555 {
1556 temp_sn_str=temp_sn3_str+"F";
1557 }
1558 else if(temp_sn1_int==31)
1559 {
1560 temp_sn_str=temp_sn3_str+"G";
1561 }
1562 else if(temp_sn1_int==32)
1563 {
1564 temp_sn_str=temp_sn3_str+"H";
1565 }
1566 else if(temp_sn1_int==33)
1567 {
1568 temp_sn_str=temp_sn3_str+"I";
1569 }
1570 else if(temp_sn1_int==34)
1571 {
1572 temp_sn_str=temp_sn3_str+"J";
1573 }
1574 else if(temp_sn1_int==35)
1575 {
1576 temp_sn_str=temp_sn3_str+"K";
1577 }
1578 else if(temp_sn1_int==36)
1579 {
1580 temp_sn_str=temp_sn3_str+"L";
1581 }
1582 else if(temp_sn1_int==37)
1583 {
1584 temp_sn_str=temp_sn3_str+"M";
1585 }
1586 else if(temp_sn1_int==38)
1587 {
1588 temp_sn_str=temp_sn3_str+"N";
1589 }
1590 else if(temp_sn1_int==39)
1591 {
1592 temp_sn_str=temp_sn3_str+"O";
1593 }
1594 else if(temp_sn1_int==40)
1595 {
1596 temp_sn_str=temp_sn3_str+"P";
1597 }
1598 else if(temp_sn1_int==41)
1599 {
1600 temp_sn_str=temp_sn3_str+"Q";
1601 }
1602 else if(temp_sn1_int==42)
1603 {
1604 temp_sn_str=temp_sn3_str+"R";
1605 }
1606 else if(temp_sn1_int==43)
1607 {
1608 temp_sn_str=temp_sn3_str+"S";
1609 }
1610 else if(temp_sn1_int==44)
1611 {
1612 temp_sn_str=temp_sn3_str+"T";
1613 }
1614 else if(temp_sn1_int==45)
1615 {
1616 temp_sn_str=temp_sn3_str+"U";
1617 }
1618 else if(temp_sn1_int==46)
1619 {
1620 temp_sn_str=temp_sn3_str+"V";
1621 }
1622 else if(temp_sn1_int==47)
1623 {
1624 temp_sn_str=temp_sn3_str+"W";
1625 }
1626 else if(temp_sn1_int==48)
1627 {
1628 temp_sn_str=temp_sn3_str+"X";
1629 }
1630 else if(temp_sn1_int==49)
1631 {
1632 temp_sn_str=temp_sn3_str+"Y";
1633 }
1634 else if(temp_sn1_int==50)
1635 {
1636 temp_sn_str=temp_sn3_str+"Z";
1637 }
1638 }
1639 sn_array.Add(temp_sn_str);
1640 }

VC-MFC(1) 随笔笔记+连接数据库的更多相关文章

  1. VC++/MFC(VC6)开发技术精品学习资料下载汇总

    工欲善其事,必先利其器,VC开发MFC Windows程序,Visual C++或Visual Studio是必须的,恩,这里都给你总结好了,拿去吧:VC/MFC开发必备Visual C++.Visu ...

  2. VC ++ MFC activex 控件获取连接的VPN 信息

    vc++  MFC 进行activex  控件的开发步骤就不用多写了,只是简单的说明一下方法,以及具体的代码: 使用的类库是 windows 系统的 rasapi32.dll 记住需要添加的头文件如下 ...

  3. vc/mfc获取rgb图像数据后动态显示及保存图片的方法

    vc/mfc获取rgb图像数据后动态显示及保存图片的方法 该情况可用于视频通信中获取的位图数据回放显示或显示摄像头捕获的本地图像 第一种方法 #include<vfw.h> 加载 vfw3 ...

  4. VC/MFC 当鼠标移到控件上时显示提示信息

    VC/MFC 当鼠标移到控件上时显示提示信息 ToolTip是Win32中一个通用控件,MFC中为其生成了一个类CToolTipCtrl,总的说来其使用方法是较简单的,下面讲一下它的一般用法和高级用法 ...

  5. vc++MFC开发上位机程序

    用vc++MFC开发过不少跟单片机通讯的上位机程序了.搞懂了MFC架构,开发还是很快的,与底层单片机程序通讯,可以用串口.usb.网络.短信形式.串口现在用的越来越少了,一般电脑跟单片机在一块,使用串 ...

  6. vc MFC 通过IDispatch调用默认成员函数

    CComPtr<IDispatch> spDisp(IDispatch *); if(!spDisp) return; DISPPARAMS dispParam={0}; //没有参数 V ...

  7. 基于VC++ Win32+CUDA+OpenGL组合与VC++ MFC SDI+CUDA+OpenGL组合两种方案的遥感影像显示:获得的重要结论!

    1.基于VC++ Win32+CUDA+OpenGL组合的遥感影像显示 在该组合方案下,初始化时将OpenGL设置为下面两种方式,效果一样 //设置方式1 glutInitDisplayMode (G ...

  8. VC++ MFC单文档应用程序SDI下调用glGenBuffersARB(1, &pbo)方法编译通过但执行时出错原因分析及解决办法:glewInit()初始化的错误

    1.问题症状 在VC++环境下,利用MFC单文档应用程序SDI下开发OpenGL程序,当调用glGenBuffersARB(1, &pbo)方法编译通过但执行时出错,出错代码如下: OpenG ...

  9. 一些非常好的VC++/MFC开源项目链接

    Introduction List of some of the best Open Source projects written in VC++/MFC. Background Codeproje ...

  10. VC++ MFC SDI/MDI Ribbon程序的停靠窗格被关闭后如何再次显示

    VC++ 创建基于MFC的SDI应用程序,Visual Studio风格的主界面如下图所示,在该主界面上的视图菜单下包含有队对各个可停靠窗格显示或隐藏的控制菜单项.而基于Ribbon风格的应用程序,所 ...

随机推荐

  1. Prompt learning 教学[案例篇]:文生文案例设定汇总,你可以扮演任意角色进行专业分析

    Prompt learning 教学[案例篇]:文生文案例设定汇总,你可以扮演任意角色进行专业分析 1.角色扮演 行为 Prompt写法 "牙医" ""我想让你 ...

  2. PicGo + Gitee 实现 Markdown 图床

    最近再研究图床,注册的阿里云域名备案还在审批,所以七牛云图床暂时没用,所以试下用PicGo+ Gitee PicGo - 基于 electron-vue 开发的图床工具 PicGo目前支持了微博图床, ...

  3. 小知识:RMAN基于某个具体时间点的恢复示例

    最近帮忙基于某个时间点恢复一个库,说是备份和归档是全的. 好多年没做过这类事情了,不过这算是最基本的DBA技能,下面给出RMAN基于某个具体时间点的恢复示例脚本: run{ allocate chan ...

  4. Linux-MySQL导入示例数据库employees

    1. 下载employees示例数据库employees是一个官方提供的简单数据库,在mysql的官方找到employees的说明页面,通过github下载该数据库. https://github.c ...

  5. [SpringBoot][Maven]关于maven pom文件的packaging属性

    关于maven pom文件的packaging属性 前几天在调试源码运行程序的时候,因为将项目中pom文件的packaging属性用错导致源码包无法引入使用而报Bean注入错误,在此进行总结整理记录. ...

  6. 永久解决 WSL vm.max_map_count 65530 is too low 的问题

    问题 在使用基于 WSL 的 Docker 的时候,启动 ES 总是会出现 vm.max_map_count 65530 is too low 问题,导致容器无法启动,网上答案基本就两种,例如 sta ...

  7. CF131D Subway 题解

    题目传送门 前置知识 强连通分量 | 最短路 解法 考虑用 Tarjan 进行缩点,然后跑最短路. 缩点:本题的缩点有些特殊,基于有向图缩点修改而得,因为是无向图,所以在 Tarjan 过程中要额外记 ...

  8. MFC-ODBC API动态连接配置数据库

    一.ODBC管理器介绍 在Window中,ODBC数据远管理器有6个标签:用户DSN.系统DSN.文件DSN.驱动程序.跟踪.连接池,通常情况下,使用用户DSN或者系统DSN,这里主要了解用户DSN和 ...

  9. Spring Boot整合Postgres实现轻量级全文搜索

    有这样一个带有搜索功能的用户界面需求: 搜索流程如下所示: 这个需求涉及两个实体: "评分(Rating).用户名(Username)"数据与User实体相关 "创建日期 ...

  10. Shiro 框架的MD5加密算法实现原理

    直接上代码:该代码可以直接用于项目中做MD5加密,加盐加密,多层散列加密 import java.io.UnsupportedEncodingException; import java.securi ...