-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathfrmMain.frm
3580 lines (3189 loc) · 208 KB
/
frmMain.frm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
VERSION 5.00
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
Object = "{945E8FCC-830E-45CC-AF00-A012D5AE7451}#15.3#0"; "CO7FCA~1.OCX"
Begin VB.MDIForm frmMain
BackColor = &H8000000C&
Caption = "新工程 - 拖控件大法"
ClientHeight = 9165
ClientLeft = 18540
ClientTop = 2715
ClientWidth = 15960
LinkTopic = "MDIForm1"
OLEDropMode = 1 'Manual
StartUpPosition = 2 'CenterScreen
Begin MSComDlg.CommonDialog CDL
Left = 14640
Top = 6960
_ExtentX = 847
_ExtentY = 847
_Version = 393216
CancelError = -1 'True
End
Begin VB.Timer tmrCheckToolsAvailable
Interval = 100
Left = 12240
Top = 7080
End
Begin VB.Timer tmrCheckProcess
Enabled = 0 'False
Interval = 10
Left = 12840
Top = 7080
End
Begin VB.Timer tmrGetWindow
Enabled = 0 'False
Interval = 10
Left = 13440
Top = 7080
End
Begin XtremeDockingPane.DockingPane DockingPaneManager
Left = 14040
Top = 7080
_Version = 983043
_ExtentX = 635
_ExtentY = 635
_StockProps = 0
End
Begin VB.Menu mnuFile
Caption = "文件(&F)"
Begin VB.Menu mnuNew
Caption = "新建(&N)"
Shortcut = ^N
End
Begin VB.Menu mnuOpen
Caption = "加载(&O)"
Shortcut = ^O
End
Begin VB.Menu mnuSave
Caption = "保存(&S)"
Shortcut = ^S
End
Begin VB.Menu mnuSaveAs
Caption = "另存为(&A)"
End
Begin VB.Menu mnuSplit1
Caption = "-"
End
Begin VB.Menu mnuExit
Caption = "退出(&E)"
End
End
Begin VB.Menu mnuEdit
Caption = "编辑(&E)"
Begin VB.Menu mnuUndo
Caption = "撤销(&U)"
Shortcut = ^Z
End
Begin VB.Menu mnuRedo
Caption = "重复(&R)"
Shortcut = ^Y
End
Begin VB.Menu mnuSplit4
Caption = "-"
End
Begin VB.Menu mnuCut
Caption = "剪切(&T)"
Shortcut = ^X
End
Begin VB.Menu mnuCopy
Caption = "复制(&C)"
Shortcut = ^C
End
Begin VB.Menu mnuPaste
Caption = "粘贴(&P)"
Shortcut = ^V
End
Begin VB.Menu mnuSelectAll
Caption = "全选(&A)"
Shortcut = ^A
End
Begin VB.Menu mnuRemoveLine
Caption = "删除行(&L)"
Shortcut = ^L
End
Begin VB.Menu mnuSplit5
Caption = "-"
End
Begin VB.Menu mnuFind
Caption = "查找(&F)"
Shortcut = ^F
End
Begin VB.Menu mnuReplace
Caption = "替换(&R)"
Shortcut = ^H
End
Begin VB.Menu mnuSplit6
Caption = "-"
End
Begin VB.Menu mnuIndent
Caption = "向外缩进(&O)"
End
Begin VB.Menu mnuUnindent
Caption = "向内缩进(&I)"
End
Begin VB.Menu mnuSplit7
Caption = "-"
End
Begin VB.Menu mnuAddRemoveBreakpoint
Caption = "添加/移除断点(&B)"
Shortcut = {F9}
End
Begin VB.Menu mnuClearAllBreakpoints
Caption = "清除所有断点(&E)"
End
Begin VB.Menu mnuSplit8
Caption = "-"
End
Begin VB.Menu mnuAddWatch
Caption = "添加监视(&W)"
Shortcut = {F2}
End
Begin VB.Menu mnuDeleteAllWatches
Caption = "移除所有监视(&D)"
End
Begin VB.Menu mnuSplit9
Caption = "-"
End
Begin VB.Menu mnuGotoLine
Caption = "跳转到行(&G)..."
Shortcut = ^G
End
End
Begin VB.Menu mnuViews
Caption = "视图(&V)"
Begin VB.Menu mnuShowWindowTarget
Caption = "窗体对象(&W)"
Checked = -1 'True
End
Begin VB.Menu mnuShowToolbar
Caption = "工具栏(&T)"
End
Begin VB.Menu mnuShowControls
Caption = "控件箱(&C)"
End
Begin VB.Menu mnuShowProperties
Caption = "属性表(&P)"
End
Begin VB.Menu mnuShowMessages
Caption = "消息拦截面板(&M)"
End
Begin VB.Menu mnuShowErrOutput
Caption = "输出面板(&E)"
End
Begin VB.Menu mnuShowTimerList
Caption = "计时器列表面板(&I)"
End
Begin VB.Menu mnuShowBreakpointList
Caption = "断点列表面板(&B)"
End
Begin VB.Menu mnuShowWatchList
Caption = "监视列表面板(&W)"
End
End
Begin VB.Menu mnuMake
Caption = "生成(&M)"
Begin VB.Menu mnuViewProgram
Caption = "预览(&P)"
Shortcut = {F5}
End
Begin VB.Menu mnuBreak
Caption = "中断(&B)"
Enabled = 0 'False
End
Begin VB.Menu mnuStopProgram
Caption = "停止预览(&S) "
Enabled = 0 'False
End
Begin VB.Menu mnuSplit2
Caption = "-"
End
Begin VB.Menu mnuView
Caption = "仅预览窗体(&V)"
Shortcut = ^T
End
Begin VB.Menu mnuStopPreview
Caption = "停止预览窗体"
Enabled = 0 'False
End
Begin VB.Menu mnuSplit3
Caption = "-"
End
Begin VB.Menu mnuMakeCPP
Caption = "生成代码文件(&C)"
End
Begin VB.Menu mnuMakeEXE
Caption = "生成可执行文件(&E)"
End
End
Begin VB.Menu mnuSetting
Caption = "设置(&S)"
Begin VB.Menu mnuOptions
Caption = "选项(&O)"
End
End
Begin VB.Menu mnuAbout
Caption = "关于(&A)"
End
Begin VB.Menu mnuControlPopup
Caption = "Control"
Visible = 0 'False
Begin VB.Menu mnuViewCtlCode
Caption = "查看代码(&C)"
End
Begin VB.Menu mnuDelete
Caption = "删除(&D)"
End
Begin VB.Menu mnuTopmost
Caption = "置顶(&T)"
End
Begin VB.Menu mnuHorizontallyCenter
Caption = "水平居中(&H)"
End
Begin VB.Menu mnuVerticallyCenter
Caption = "垂直居中(&V)"
End
End
Begin VB.Menu mnuMessagePopup
Caption = "Message"
Visible = 0 'False
Begin VB.Menu mnuAllMessages
Caption = "拦截所有消息(&L)"
End
Begin VB.Menu mnuAddProc
Caption = "添加消息拦截...(&A)"
End
Begin VB.Menu mnuClearAll
Caption = "清空(&C)"
End
End
Begin VB.Menu mnuHideToolbarPopup
Caption = "HideToolBar"
Visible = 0 'False
Begin VB.Menu mnuHideToolbar
Caption = "隐藏工具栏(&H)"
End
End
Begin VB.Menu mnuTimerListPopup
Caption = "TimerList"
Visible = 0 'False
Begin VB.Menu mnuAddTimer
Caption = "添加计时器(&N)"
End
Begin VB.Menu mnuModifyTimer
Caption = "更改计时器(&C)"
End
Begin VB.Menu mnuToCode
Caption = "转到对应代码(&O)"
End
Begin VB.Menu mnuDeleteTimer
Caption = "删除计时器(&D)"
End
End
Begin VB.Menu mnuWatchListPopup
Caption = "Watch"
Visible = 0 'False
Begin VB.Menu mnuAddWatchPopup
Caption = "添加监视(&W)"
End
Begin VB.Menu mnuRemoveWatch
Caption = "移除监视(&R)"
End
Begin VB.Menu mnuChangeWatch
Caption = "更改监视(&C)"
End
Begin VB.Menu mnuSplit10
Caption = "-"
End
Begin VB.Menu mnuWatchToLine
Caption = "转到对应行(&L)"
End
Begin VB.Menu mnuWatchMore
Caption = "查看更多信息(&M)"
End
End
Begin VB.Menu mnuBreakpointListPopup
Caption = "Breakpoint"
Visible = 0 'False
Begin VB.Menu mnuRemoveBreakpointPopup
Caption = "移除断点(&R)"
End
Begin VB.Menu mnuBreakpointToLine
Caption = "转到对应行(&L)"
End
End
Begin VB.Menu mnuErrListPopup
Caption = "ErrList"
Visible = 0 'False
Begin VB.Menu mnuErrToLine
Caption = "跳转到对应代码行(&L)"
End
Begin VB.Menu mnuCopyErr
Caption = "复制选定的项目(&C)"
End
Begin VB.Menu mnuClearErrList
Caption = "清空(&E)"
End
End
Begin VB.Menu mnuTargetWindowPopup
Caption = "TargetWindow"
Visible = 0 'False
Begin VB.Menu mnuViewCode
Caption = "查看代码(&C)"
End
Begin VB.Menu mnuAutoAlignControls
Caption = "自动控件对齐(&A)"
Checked = -1 'True
End
Begin VB.Menu mnuUseGrid
Caption = "对齐到网格(&G)"
Checked = -1 'True
End
Begin VB.Menu mnuLockControls
Caption = "锁定控件(&L)"
End
End
End
Attribute VB_Name = "frmMain"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Public IsExiting As Boolean '程序是否正在退出
Public RunningClassName As String '当前运行中的窗体的类名
Public AutoAlignCtl As Boolean '是否自动对齐控件
Public UseGrid As Boolean '是否对齐到网格
Public IsCtlLocked As Boolean '控件是否被锁定
'更新“视图”菜单里面的菜单项
' 描述:根据窗体里的各种面板的状态更新“视图”菜单里面的菜单项
'必选参数:无
'可选参数:无
' 返回值:无
Private Sub RefreshViewMenu()
On Error Resume Next
Dim i As Integer
Dim IsShown As Boolean '指定的面板是否可视
For i = 1 To 8
IsShown = Not Me.DockingPaneManager.FindPane(i).Closed '获取指定的面板的可视状态
Select Case i
Case 1 '控件面板
Me.mnuShowControls.Checked = IsShown
Case 2 '属性面板
Me.mnuShowProperties.Checked = IsShown
Case 3 '消息拦截面板
Me.mnuShowMessages.Checked = IsShown
Case 4 '工具栏面板
Me.mnuShowToolbar.Checked = IsShown
Case 5 '输出面板
Me.mnuShowErrOutput.Checked = IsShown
Case 6 '计时器面板
Me.mnuShowTimerList.Checked = IsShown
Case 7 '断点列表面板
Me.mnuShowBreakpointList.Checked = IsShown
Case 8 '监视列表面板
Me.mnuShowWatchList.Checked = IsShown
End Select
Next i
End Sub
'读取指定的控件和指定的事件读取对应的代码模板
' 描述:指定控件类型和模板的名字,然后通过变量返回模板的内容
'必选参数:CtlType:控件类型;ModelName:模板的名字;OutString:用来接收模板内容的字符串
'可选参数:无
' 返回值:函数是否执行成功
Private Function LoadCodeModel(ctlType As Integer, ModelName As String, ByRef OutString As String) As Boolean
On Error Resume Next
Dim tmp As String
Dim strModel As String
Open CurrAppPath & "Coding\" & CStr(ctlType) & "\" & ModelName & ".txt" For Input As #2
If Err.Number <> 0 Then
MsgBox "文件访问错误:" & CurrAppPath & "Coding\" & CStr(ctlType) & "\" & ModelName & ".txt,文件生成失败。", vbExclamation, "错误"
Close
LoadCodeModel = False
Exit Function
End If
'------------------------------
Do While Not EOF(2)
Line Input #2, tmp
strModel = strModel & tmp & vbCrLf
Loop
Close #2
OutString = strModel
LoadCodeModel = True
End Function
'根据指定的表达式判断是否在指定的字符串后添加指定的常数名
' 描述:指定一个布尔型表达式,当其为True时往字符串的末尾添加指定的常数名
'必选参数:bExpression:布尔型表达式;ConstantName:常数的名字;StyleString:需要添加名字在末尾的字符串
'可选参数:无
' 返回值:无
Private Sub InsertConstant(bExpression As Boolean, ConstantName As String, ByRef StyleString As String)
If bExpression = True Then '布尔型表达式必须为True才添加字符串
If StyleString <> "" Then '如果字符串不为空
StyleString = StyleString & " | " & ConstantName '则在末尾添加或运算符“|”再添加常数名
Else
StyleString = StyleString & ConstantName '否则直接添加常数名
End If
End If
End Sub
'生成C++的头文件
' 描述:在指定目录生成经过更改的Controls.h和未经修改的StdAfx.cpp、StdAfx.h
'必选参数:sDirPath:指定需要放置头文件的目录路径
'可选参数:bRelease:是否为非调试模式
' 返回值:文件是否生成成功
Private Function MakeHeaderFile(sDirPath As String, Optional bRelease As Boolean = False) As Boolean
On Error Resume Next
Dim TargetPath As String
'规范化路径
TargetPath = IIf(Right(sDirPath, 1) = "\", sDirPath, sDirPath & "\")
'复制Controls.h
If bRelease Then '为非调试模式
FileCopy CurrAppPath & "Coding\Main\Controls_Release.h", sDirPath & "Controls.h"
Else '为调试模式
FileCopy CurrAppPath & "Coding\Main\Controls.h", sDirPath & "Controls.h"
End If
If Err.Number <> 0 Then
If bRelease Then
MsgBox "复制文件" & CurrAppPath & "Coding\Main\Controls_Release.h 时发生错误,文件生成失败。", vbExclamation, "错误"
Else
MsgBox "复制文件" & CurrAppPath & "Coding\Main\Controls.h 时发生错误,文件生成失败。", vbExclamation, "错误"
End If
MakeHeaderFile = False
Exit Function
End If
'=====================================================
Dim WindowInitCode As String '初始化窗体状态部分的代码
Dim tmp As String '读取文件缓存
Dim PropValue As String '生成的属性值缓存
Dim WindowRect As RECT '目标窗体的坐标及大小
Dim CtlHeaderFile As String 'Controls.h的文件内容
Open sDirPath & "Controls.h" For Input As #1 '读取复制之后的Controls.h
If Err.Number <> 0 Then
Close #1
MsgBox "读写文件" & sDirPath & "Controls.h时发生错误,文件生成失败。", vbExclamation, "错误"
MakeHeaderFile = False
Exit Function
End If
'=================================
Do While Not EOF(1) '读取文件
Line Input #1, tmp
CtlHeaderFile = CtlHeaderFile & tmp & vbCrLf
Loop
'=================================
If Not LoadCodeModel(24, "WindowInitCode", WindowInitCode) Then
Exit Function
End If
If Not bRelease Then '若为调试模式 则替换调试器的窗体句柄 以拦截调试消息
CtlHeaderFile = Replace(CtlHeaderFile, "const HWND DEBUGGER_HWND = (HWND)【DebuggerHwnd】;", _
"const HWND DEBUGGER_HWND = (HWND)" & CStr(Me.hWnd) & ";")
End If
'=====================================================================================================================
'分析窗体所有的属性 并生成窗体初始化状态的代码
'窗体类名
PropValue = Chr(34) & MainPropList(0, 0, 0) & Chr(34)
WindowInitCode = Replace(WindowInitCode, "【WindowClass】", PropValue)
'窗体标题
PropValue = Chr(34) & MainPropList(0, 1, 0) & Chr(34)
WindowInitCode = Replace(WindowInitCode, "【WindowCaption】", PropValue)
'窗体背景颜色
PropValue = MainPropList(0, 2, 0)
WindowInitCode = Replace(WindowInitCode, "【WindowBkColor】", PropValue)
'窗体样式
PropValue = ""
InsertConstant CBool(MainPropList(0, 3, 0) = True), "WS_MAXIMIZEBOX", PropValue '最大化按钮
InsertConstant CBool(MainPropList(0, 4, 0) = True), "WS_MINIMIZEBOX", PropValue '最小化按钮
InsertConstant CBool(MainPropList(0, 5, 0) = True), "WS_VISIBLE", PropValue '可视
InsertConstant CBool(MainPropList(0, 6, 0) = True), "WS_SYSMENU", PropValue '有系统菜单
InsertConstant CBool(MainPropList(0, 7, 0) = True), "WS_THICKFRAME", PropValue '可调大小
Select Case MainPropList(0, 8, 0)
Case "WS_MINIMIZE"
InsertConstant True, "WS_MINIMIZE", PropValue '最小化
Case "WS_MAXIMIZE"
InsertConstant True, "WS_MAXIMIZE", PropValue '最大化
End Select
InsertConstant CBool(MainPropList(0, 9, 0) = False), "WS_DISABLED", PropValue '窗体有效
WindowInitCode = Replace(WindowInitCode, "【WindowStyle】", PropValue)
'窗体扩展样式
WindowInitCode = Replace(WindowInitCode, "【WindowExStyle】", "0")
'窗体的坐标及大小(坐标是自动居中)
GetWindowRect frmTarget.hWnd, WindowRect
WindowInitCode = Replace(WindowInitCode, "【WindowLeft】", _
CLng((Screen.Width / Screen.TwipsPerPixelX / 2) - (WindowRect.Right - WindowRect.Left) / 2))
WindowInitCode = Replace(WindowInitCode, "【WindowTop】", _
CLng((Screen.Height / Screen.TwipsPerPixelY / 2) - (WindowRect.Bottom - WindowRect.Top) / 2))
WindowInitCode = Replace(WindowInitCode, "【WindowWidth】", CLng(WindowRect.Right - WindowRect.Left))
WindowInitCode = Replace(WindowInitCode, "【WindowHeight】", CLng(WindowRect.Bottom - WindowRect.Top))
'---------------------------------------
CtlHeaderFile = Replace(CtlHeaderFile, "【WindowInitCodeHere】", WindowInitCode) '把标记替换成生成好的代码
'=====================================================================================================================
'遍历窗体中所有的控件
Dim i As PictureBox
Dim j As ListItem
Dim TargetCtlType As Integer '目标控件的类型
Dim TatgetCtlIndex As Integer '当前控件的计数
Dim CtlDefCode As String '定义控件的代码
Dim CtlName As String '控件的名称
Dim TargetCtlEvent As String '当前目标控件的事件
Dim AllEvents As String '所有的事件定义代码
Dim TargetRealHmenu As String '目标控件真实的hMenu(控件唯一标识符)
Dim ControlEvents As String '在WM_COMMAND事件里调用事件的代码
Dim NotifyEvents As String '在WM_NOTIFY事件里调用事件的代码
'各种控件的WndProc代码
Dim tmpCodeModel As String '用来暂存代码模板的缓存区
Dim StaticWndProc As String 'Static
Dim EditWndProc As String 'Edit
Dim ButtonWndProc As String 'Button
Dim ComboWndProc As String 'Combo
Dim ListWndProc As String 'List
Dim ScrollWndProc As String 'Scroll
Dim UpDownWndProc As String 'UpDown
Dim ProgressWndProc As String 'ProgressBar
Dim SliderWndProc As String 'Slider
Dim HotKeyWndProc As String 'Hotkey
Dim ListViewWndProc As String 'ListView
Dim TreeViewWndProc As String 'TreeView
Dim TabWndProc As String 'Tab
Dim RichEditWndProc As String 'RichEdit
Dim tPickerWndProc As String 'TimePicker
Dim MonthCalWndProc As String 'MonthCalendar
Dim HSCount As Integer '水平滚动条的数量
Dim VSCount As Integer '垂直滚动条的数量
Dim ArrHSL As String '滚动条移动速度的常数数组(HS = HScroll, VS = VScroll, L = Large, S = Small)
Dim ArrHSS As String
Dim ArrVSL As String
Dim ArrVSS As String
For Each i In frmTarget.picControlContainer
If i.Index <> 0 Then
'添加控件的定义
TargetCtlType = Val(Split(i.Tag, "|")(1)) '获取目标控件的类型
TatgetCtlIndex = Val(Split(i.Tag, "|")(2)) '获取目标控件的计数
CtlName = frmTarget.NumberToCtlType(TargetCtlType) & "_" & TatgetCtlIndex '获得目标控件的名称
CtlDefCode = CtlDefCode & Chr(vbKeyTab) & "My" & frmTarget.NumberToCtlType( _
TargetCtlType) & " " & CtlName & ";" & vbCrLf 'My[类型名] [类型名]_[当前类型控件计数];
TargetRealHmenu = MainPropList(i.Index, 0, 0)
'-------------------------------------------------------------
'添加控件的事件
If Not LoadCodeModel(TargetCtlType, "Events", TargetCtlEvent) Then '把预先编写的对应的控件的所有事件读取到缓存中
Exit Function
End If
AllEvents = AllEvents & TargetCtlEvent '把读取到的事件添加到所有事件代码里
AllEvents = Replace(AllEvents, "【hMenu】", CStr(TatgetCtlIndex)) '把文件里的控件序号标记替换成控件的计数
'-------------------------------------------------------------
'添加对每个控件事件的处理
Select Case TargetCtlType
Case 0 '图片控件
'读取图片控件的代码模板
If Not LoadCodeModel(0, "WndProc", tmpCodeModel) Then '读取图片框的WndProc代码模板
Exit Function
End If
StaticWndProc = StaticWndProc & Replace(Replace(tmpCodeModel, "【hMenu】", _
CStr(TatgetCtlIndex)), "【RealhMenu】", TargetRealHmenu) & vbCrLf '处理之后写入到WndProc代码里
Case 1 '标签控件
'读取标签控件的代码模板
If Not LoadCodeModel(1, "WndProc", tmpCodeModel) Then '读取标签的WndProc代码模板
Exit Function
End If
StaticWndProc = StaticWndProc & Replace(Replace(tmpCodeModel, "【hMenu】", _
CStr(TatgetCtlIndex)), "【RealhMenu】", TargetRealHmenu) & vbCrLf '处理之后写入到WndProc代码里
Case 2 '文本框控件
'读取文本框的代码模板
If Not LoadCodeModel(2, "WndProc", tmpCodeModel) Then '读取文本框的WndProc代码
Exit Function
End If
EditWndProc = EditWndProc & Replace(Replace(tmpCodeModel, "【hMenu】", _
CStr(TatgetCtlIndex)), "【RealhMenu】", TargetRealHmenu) & vbCrLf '处理之后写入到WndProc代码里
'-------------------------------------
If Not LoadCodeModel(2, "WM_COMMAND", tmpCodeModel) Then '读取WM_COMMAND代码
Exit Function
End If
ControlEvents = ControlEvents & Replace(Replace(tmpCodeModel, "【hMenu】", _
CStr(TatgetCtlIndex)), "【RealhMenu】", TargetRealHmenu) & vbCrLf '处理之后写入到WM_COMMAND代码里
Case 3 '组框控件
'读取组框的代码模板
If Not LoadCodeModel(3, "WndProc", tmpCodeModel) Then '读取组框的WndProc代码
Exit Function
End If
ButtonWndProc = ButtonWndProc & Replace(Replace(tmpCodeModel, "【hMenu】", _
CStr(TatgetCtlIndex)), "【RealhMenu】", TargetRealHmenu) & vbCrLf '处理之后写入到WndProc代码里
Case 4, 5, 6 '按钮控件,多选框控件和单选框控件
'读取按钮的代码模板
If Not LoadCodeModel(TargetCtlType, "WndProc", tmpCodeModel) Then '读取对应的WndProc代码
Exit Function
End If
ButtonWndProc = ButtonWndProc & Replace(Replace(tmpCodeModel, "【hMenu】", _
CStr(TatgetCtlIndex)), "【RealhMenu】", TargetRealHmenu) & vbCrLf '处理之后写入到WndProc代码里
'-------------------------------------
If Not LoadCodeModel(TargetCtlType, "WM_COMMAND", tmpCodeModel) Then '读取WM_COMMAND代码
Exit Function
End If
ControlEvents = ControlEvents & Replace(Replace(tmpCodeModel, "【hMenu】", _
CStr(TatgetCtlIndex)), "【RealhMenu】", TargetRealHmenu) & vbCrLf '处理之后写入到WM_COMMAND代码里
Case 7 '组合框控件
'读取组合框的代码模板
If Not LoadCodeModel(TargetCtlType, "WndProc", tmpCodeModel) Then '读取对应的WndProc代码
Exit Function
End If
ComboWndProc = ComboWndProc & Replace(Replace(tmpCodeModel, "【hMenu】", _
CStr(TatgetCtlIndex)), "【RealhMenu】", TargetRealHmenu) & vbCrLf '处理之后写入到WndProc代码里
'-------------------------------------
If Not LoadCodeModel(TargetCtlType, "WM_COMMAND", tmpCodeModel) Then '读取WM_COMMAND代码
Exit Function
End If
ControlEvents = ControlEvents & Replace(Replace(tmpCodeModel, "【hMenu】", _
CStr(TatgetCtlIndex)), "【RealhMenu】", TargetRealHmenu) & vbCrLf '处理之后写入到WM_COMMAND代码里
Case 8 '列表框控件
'读取列表框的代码模板
If Not LoadCodeModel(TargetCtlType, "WndProc", tmpCodeModel) Then '读取对应的WndProc代码
Exit Function
End If
ListWndProc = ListWndProc & Replace(Replace(tmpCodeModel, "【hMenu】", _
CStr(TatgetCtlIndex)), "【RealhMenu】", TargetRealHmenu) & vbCrLf '处理之后写入到WndProc代码里
'-------------------------------------
If Not LoadCodeModel(TargetCtlType, "WM_COMMAND", tmpCodeModel) Then '读取WM_COMMAND代码
Exit Function
End If
ControlEvents = ControlEvents & Replace(Replace(tmpCodeModel, "【hMenu】", _
CStr(TatgetCtlIndex)), "【RealhMenu】", TargetRealHmenu) & vbCrLf '处理之后写入到WM_COMMAND代码里
Case 9, 10 '滚动条控件
'读取滚动条的代码模板
If Not LoadCodeModel(TargetCtlType, "WndProc", tmpCodeModel) Then '读取对应的WndProc代码
Exit Function
End If
ScrollWndProc = ScrollWndProc & Replace(Replace(tmpCodeModel, "【hMenu】", _
CStr(TatgetCtlIndex)), "【RealhMenu】", TargetRealHmenu) & vbCrLf '处理之后写入到WndProc代码里
'-------------------------------------
If TargetCtlType = 9 Then '统计两种滚动条的数量
HSCount = HSCount + 1 '控件计数 + 1
ArrHSS = ArrHSS & MainPropList(i.Index, 3, 0) & ", " '滚动条的最小更改值
ArrHSL = ArrHSL & MainPropList(i.Index, 4, 0) & ", " '滚动条的最大更改值
Else
VSCount = VSCount + 1 '控件计数 + 1
ArrVSS = ArrVSS & MainPropList(i.Index, 3, 0) & ", " '滚动条的最小更改值
ArrVSL = ArrVSL & MainPropList(i.Index, 4, 0) & ", " '滚动条的最大更改值
End If
Case 11
'读取调节按钮的代码模板
If Not LoadCodeModel(TargetCtlType, "WndProc", tmpCodeModel) Then '读取对应的WndProc代码
Exit Function
End If
UpDownWndProc = UpDownWndProc & Replace(Replace(tmpCodeModel, "【hMenu】", _
CStr(TatgetCtlIndex)), "【RealhMenu】", TargetRealHmenu) & vbCrLf '处理之后写入到WndProc代码里
Case 12
'读取进度条的代码模板
If Not LoadCodeModel(TargetCtlType, "WndProc", tmpCodeModel) Then '读取对应的WndProc代码
Exit Function
End If
ProgressWndProc = ProgressWndProc & Replace(Replace(tmpCodeModel, "【hMenu】", _
CStr(TatgetCtlIndex)), "【RealhMenu】", TargetRealHmenu) & vbCrLf '处理之后写入到WndProc代码里
Case 13
'读取滑块的代码模板
If Not LoadCodeModel(TargetCtlType, "WndProc", tmpCodeModel) Then '读取对应的WndProc代码
Exit Function
End If
SliderWndProc = SliderWndProc & Replace(Replace(tmpCodeModel, "【hMenu】", _
CStr(TatgetCtlIndex)), "【RealhMenu】", TargetRealHmenu) & vbCrLf '处理之后写入到WndProc代码里
Case 14
'读取热键的代码模板
If Not LoadCodeModel(TargetCtlType, "WndProc", tmpCodeModel) Then '读取对应的WndProc代码
Exit Function
End If
HotKeyWndProc = HotKeyWndProc & Replace(Replace(tmpCodeModel, "【hMenu】", _
CStr(TatgetCtlIndex)), "【RealhMenu】", TargetRealHmenu) & vbCrLf '处理之后写入到WndProc代码里
Case 15
'读取列表视图的代码模板
If Not LoadCodeModel(TargetCtlType, "WndProc", tmpCodeModel) Then '读取对应的WndProc代码
Exit Function
End If
ListViewWndProc = ListViewWndProc & Replace(Replace(tmpCodeModel, "【hMenu】", _
CStr(TatgetCtlIndex)), "【RealhMenu】", TargetRealHmenu) & vbCrLf '处理之后写入到WndProc代码里
'-------------------------------------
If Not LoadCodeModel(TargetCtlType, "WM_NOTIFY", tmpCodeModel) Then '读取WM_NOTIFY代码
Exit Function
End If
NotifyEvents = NotifyEvents & Replace(Replace(tmpCodeModel, "【hMenu】", _
CStr(TatgetCtlIndex)), "【RealhMenu】", TargetRealHmenu) & vbCrLf '处理之后写入到WM_NOTIFY代码里
Case 16
'读取树视图的代码模板
If Not LoadCodeModel(TargetCtlType, "WndProc", tmpCodeModel) Then '读取对应的WndProc代码
Exit Function
End If
TreeViewWndProc = TreeViewWndProc & Replace(Replace(tmpCodeModel, "【hMenu】", _
CStr(TatgetCtlIndex)), "【RealhMenu】", TargetRealHmenu) & vbCrLf '处理之后写入到WndProc代码里
'-------------------------------------
If Not LoadCodeModel(TargetCtlType, "WM_NOTIFY", tmpCodeModel) Then '读取WM_NOTIFY代码
Exit Function
End If
NotifyEvents = NotifyEvents & Replace(Replace(tmpCodeModel, "【hMenu】", _
CStr(TatgetCtlIndex)), "【RealhMenu】", TargetRealHmenu) & vbCrLf '处理之后写入到WM_NOTIFY代码里
Case 17
'读取选项卡的代码模板
If Not LoadCodeModel(TargetCtlType, "WndProc", tmpCodeModel) Then '读取对应的WndProc代码
Exit Function
End If
TabWndProc = TabWndProc & Replace(Replace(tmpCodeModel, "【hMenu】", _
CStr(TatgetCtlIndex)), "【RealhMenu】", TargetRealHmenu) & vbCrLf '处理之后写入到WndProc代码里
'-------------------------------------
If Not LoadCodeModel(TargetCtlType, "WM_NOTIFY", tmpCodeModel) Then '读取WM_NOTIFY代码
Exit Function
End If
NotifyEvents = NotifyEvents & Replace(Replace(tmpCodeModel, "【hMenu】", _
CStr(TatgetCtlIndex)), "【RealhMenu】", TargetRealHmenu) & vbCrLf '处理之后写入到WM_NOTIFY代码里
Case 18
'读取动画控件的的代码模板
If Not LoadCodeModel(TargetCtlType, "WM_COMMAND", tmpCodeModel) Then '读取WM_COMMAND代码
Exit Function
End If
ControlEvents = ControlEvents & Replace(Replace(tmpCodeModel, "【hMenu】", _
CStr(TatgetCtlIndex)), "【RealhMenu】", TargetRealHmenu) & vbCrLf '处理之后写入到WM_COMMAND代码里
Case 19
'读取RTF文本框控件的代码模板
If Not LoadCodeModel(TargetCtlType, "WndProc", tmpCodeModel) Then '读取对应的WndProc代码
Exit Function
End If
RichEditWndProc = RichEditWndProc & Replace(Replace(tmpCodeModel, "【hMenu】", _
CStr(TatgetCtlIndex)), "【RealhMenu】", TargetRealHmenu) & vbCrLf '处理之后写入到WndProc代码里
Case 20
'读取日期时间选择器的代码模板
If Not LoadCodeModel(TargetCtlType, "WndProc", tmpCodeModel) Then '读取对应的WndProc代码
Exit Function
End If
tPickerWndProc = tPickerWndProc & Replace(Replace(tmpCodeModel, "【hMenu】", _
CStr(TatgetCtlIndex)), "【RealhMenu】", TargetRealHmenu) & vbCrLf '处理之后写入到WndProc代码里
'-------------------------------------
If Not LoadCodeModel(TargetCtlType, "WM_NOTIFY", tmpCodeModel) Then '读取WM_NOTIFY代码
Exit Function
End If
NotifyEvents = NotifyEvents & Replace(Replace(tmpCodeModel, "【hMenu】", _
CStr(TatgetCtlIndex)), "【RealhMenu】", TargetRealHmenu) & vbCrLf '处理之后写入到WM_NOTIFY代码里
Case 21
'读取月历的代码模板
If Not LoadCodeModel(TargetCtlType, "WndProc", tmpCodeModel) Then '读取对应的WndProc代码
Exit Function
End If
MonthCalWndProc = tPickerWndProc & Replace(Replace(tmpCodeModel, "【hMenu】", _
CStr(TatgetCtlIndex)), "【RealhMenu】", TargetRealHmenu) & vbCrLf '处理之后写入到WndProc代码里
'-------------------------------------
If Not LoadCodeModel(TargetCtlType, "WM_NOTIFY", tmpCodeModel) Then '读取WM_NOTIFY代码
Exit Function
End If
NotifyEvents = NotifyEvents & Replace(Replace(tmpCodeModel, "【hMenu】", _
CStr(TatgetCtlIndex)), "【RealhMenu】", TargetRealHmenu) & vbCrLf '处理之后写入到WM_NOTIFY代码里
Case 22
'读取IP地址控件的代码模板
If Not LoadCodeModel(TargetCtlType, "WM_NOTIFY", tmpCodeModel) Then '读取WM_NOTIFY代码
Exit Function
End If
NotifyEvents = NotifyEvents & Replace(Replace(tmpCodeModel, "【hMenu】", _
CStr(TatgetCtlIndex)), "【RealhMenu】", TargetRealHmenu) & vbCrLf '处理之后写入到WM_NOTIFY代码里
End Select
End If
Next i
Dim TimerCallBackCode As String '全部计时器的回调函数代码
Dim TimerCallBackModel As String '计时器的回调函数代码模型
Dim TimerEventDefModel As String '计时器的事件定义代码模型
Dim CurrTimerID As Long '当前计时器的ID
Dim CurrTimerInterval As Long '当前计时器的计时间隔
'读取计时器的回调函数代码模型
If Not LoadCodeModel(23, "TimerProc", TimerCallBackModel) Then
Exit Function
End If
'读取计时器的事件定义代码模型
If Not LoadCodeModel(23, "Events", TimerEventDefModel) Then
Exit Function
End If
For Each j In frmTimerList.lstTimer.ListItems
CurrTimerID = CLng(j.Text) '获取计时器ID
CurrTimerInterval = CLng(j.SubItems(1)) '获取计时器计时间隔
'定义计时器的事件
AllEvents = AllEvents & Replace(TimerEventDefModel, "【hMenu】", CStr(CurrTimerID))
'在计时器回调函数里添加对此计时器的过程的调用
TimerCallBackCode = TimerCallBackCode & Replace(TimerCallBackModel, "【hMenu】", CStr(CurrTimerID))
'在控件列表中添加计时器
CtlDefCode = CtlDefCode & Chr(9) & "MyTimer Timer_" & CStr(CurrTimerID) & ";" & vbCrLf
Next j
'把各种标记替换成生成好的代码
CtlHeaderFile = Replace(CtlHeaderFile, "【AllControlsHere】", CtlDefCode) '控件定义
CtlHeaderFile = Replace(CtlHeaderFile, "【AllEventsDefHere】", AllEvents) '事件定义
CtlHeaderFile = Replace(CtlHeaderFile, "【AllTimerIDHere】", TimerCallBackCode) '计时器回调
CtlHeaderFile = Replace(CtlHeaderFile, "【StaticProcCode】", StaticWndProc) 'Static的回调函数
CtlHeaderFile = Replace(CtlHeaderFile, "【EditProcCode】", EditWndProc) 'Edit的回调函数
CtlHeaderFile = Replace(CtlHeaderFile, "【ButtonProcCode】", ButtonWndProc) 'Button的回调函数
CtlHeaderFile = Replace(CtlHeaderFile, "【ComboProcCode】", ComboWndProc) 'Combo的回调函数
CtlHeaderFile = Replace(CtlHeaderFile, "【ListProcCode】", ListWndProc) 'List的回调函数
CtlHeaderFile = Replace(CtlHeaderFile, "【ScrollBarProcCode】", ScrollWndProc) 'ScrollBar的回调函数
CtlHeaderFile = Replace(CtlHeaderFile, "【UpDownProcCode】", UpDownWndProc) 'UpDown的回调函数
CtlHeaderFile = Replace(CtlHeaderFile, "【ProgressBarProcCode】", ProgressWndProc) 'ProgressBar的回调函数
CtlHeaderFile = Replace(CtlHeaderFile, "【SliderProcCode】", SliderWndProc) 'Slider的回调函数
CtlHeaderFile = Replace(CtlHeaderFile, "【HotkeyProcCode】", HotKeyWndProc) 'Hotkey的回调函数
CtlHeaderFile = Replace(CtlHeaderFile, "【ListViewProcCode】", ListViewWndProc) 'ListView的回调函数
CtlHeaderFile = Replace(CtlHeaderFile, "【TreeViewProcCode】", TreeViewWndProc) 'TreeView的回调函数
CtlHeaderFile = Replace(CtlHeaderFile, "【TabProcCode】", TabWndProc) 'Tab的回调函数
CtlHeaderFile = Replace(CtlHeaderFile, "【RichEditProcCode】", RichEditWndProc) 'RichEdit的回调函数
CtlHeaderFile = Replace(CtlHeaderFile, "【TimePickerProcCode】", tPickerWndProc) 'TimePicker的回调函数
CtlHeaderFile = Replace(CtlHeaderFile, "【MonthCalendarProcCode】", MonthCalWndProc) 'MonthCalendar的回调函数
CtlHeaderFile = Replace(CtlHeaderFile, "【NumberOfHS】", HSCount) '换掉滚动条数量标记
CtlHeaderFile = Replace(CtlHeaderFile, "【NumberOfVS】", VSCount)
If ArrHSL <> "" Then '滚动条移动速度常数数组
CtlHeaderFile = Replace(CtlHeaderFile, "【ArrayOfHSLarge】", Left(ArrHSL, Len(ArrHSL) - 2))
CtlHeaderFile = Replace(CtlHeaderFile, "【ArrayOfHSSmall】", Left(ArrHSS, Len(ArrHSS) - 2))
Else
CtlHeaderFile = Replace(CtlHeaderFile, "【ArrayOfHSLarge】", "")
CtlHeaderFile = Replace(CtlHeaderFile, "【ArrayOfHSSmall】", "")
End If
If ArrVSL <> "" Then
CtlHeaderFile = Replace(CtlHeaderFile, "【ArrayOfVSLarge】", Left(ArrVSL, Len(ArrVSL) - 2))
CtlHeaderFile = Replace(CtlHeaderFile, "【ArrayOfVSSmall】", Left(ArrVSS, Len(ArrVSS) - 2))
Else
CtlHeaderFile = Replace(CtlHeaderFile, "【ArrayOfVSLarge】", "")
CtlHeaderFile = Replace(CtlHeaderFile, "【ArrayOfVSSmall】", "")
End If
CtlHeaderFile = Replace(CtlHeaderFile, "【ControlEventsHere】", ControlEvents) 'WM_COMMAND标记
CtlHeaderFile = Replace(CtlHeaderFile, "【ControlNotifyCodeHere】", NotifyEvents) 'WM_NOTIFY标记
Close #1
Open sDirPath & "Controls.h" For Output As #1
If Err.Number <> 0 Then
Close #1
MsgBox "文件访问错误:" & sDirPath & "Controls.h,文件生成失败。", vbExclamation, "错误"
MakeHeaderFile = False
Exit Function
End If
Print #1, CtlHeaderFile '保存到原文件里
Close #1
MakeHeaderFile = True
End Function
'生成C++代码文件
' 描述:生成C++代码文件到指定目录
'必选参数:sFilePath:指定的文件路径
'可选参数:无
' 返回值:文件是否生成成功
Private Function MakeCppFile(sFilePath As String) As Boolean
On Error Resume Next
Dim i As Long '控制循环变量
Dim j As Integer
Dim MainProgram As String '主程序的代码
Dim EventProgram As String '读取到的事件的代码
Dim AllEventProgram As String '所有事件加在一起的代码
Dim CtlCreateCode As String '创建控件的代码
Dim tmp As String '读取文件缓存
Dim lnEvent As Long '主程序中找到的事件的行数
Dim EventExists() As Boolean '标记事件是否存在的数组
Open sFilePath For Output As #1
'=========================
If Err.Number <> 0 Then '文件访问错误
Close #1
MsgBox "文件访问错误:" & sFilePath & ",文件生成失败。", vbExclamation, "错误"
MakeCppFile = False
Exit Function
End If
'=================================
Open CurrAppPath & "Coding\Main\MainProgram.cpp" For Input As #2 '读取主程序的代码
'=========================
If Err.Number <> 0 Then '文件访问错误
Close #1
Close #2
MsgBox "文件访问错误:" & CurrAppPath & "Coding\Main\MainProgram.cpp,文件生成失败。", vbExclamation, "错误"
MakeCppFile = False
Exit Function
End If
'=================================
Do While Not EOF(2)
Line Input #2, tmp
MainProgram = MainProgram & tmp & vbCrLf '读取主程序的所有内容
Loop
Close #2
'---------------------------------------------------
ReDim EventExists(EventList(24).Count - 1)
For i = 1 To EventList(24).Count '遍历窗体所有的事件
lnEvent = frmCoding.IsEventExists(EventList(24).Item(i))
If lnEvent <> -1 Then '如果检测到事件已经存在
EventExists(i - 1) = True '标记为已经存在
Else '否则标记为不存在
EventExists(i - 1) = False
End If
Next i
'---------------------------------------------------
For i = 0 To UBound(EventExists)
If EventExists(i) = False Then '遇到不存在的事件
'读取预先编写的事件
EventProgram = ""
If Not LoadCodeModel(24, EventList(24).Item(i + 1), EventProgram) Then
Exit Function
End If
AllEventProgram = AllEventProgram & EventProgram & vbCrLf
End If
Next i
'---------------------------------------------------
AllEventProgram = Replace(AllEventProgram, "【CodingPart】", Chr(9))
MainProgram = Replace(MainProgram, "【WindowCodeHere】", AllEventProgram)
'==================================================================================================
'读取对应控件的创建代码
Dim Ctl As PictureBox '遍历的控件
Dim TargetCtlType As Integer '目标控件的类型
Dim ctlIndex As Integer '目标控件的索引
Dim CtlName As String '控件的名称
Dim LoadFileTmp As String '读取文件时的缓存
Dim ComboAddItems As String 'Combo控件创建时添加列表项的代码
Dim ListAddItems As String 'List控件创建时添加列表项的代码
For Each Ctl In frmTarget.picControlContainer '遍历所有的控件
If Ctl.Index <> 0 Then '排除掉序号是0的空控件
'获取控件的信息
TargetCtlType = Val(Split(Ctl.Tag, "|")(1)) '获取目标控件的类型
ctlIndex = Split(Ctl.Tag, "|")(2) '获取目标控件的序号
CtlName = frmTarget.NumberToCtlType(TargetCtlType) & "_" & ctlIndex '获得目标控件的名称
'-------------------------------------------------------------------
'读取控件对应的创建控件代码
If Not LoadCodeModel(TargetCtlType, "Create", LoadFileTmp) Then '读取创建控件的代码到缓存
Exit Function
End If
CtlCreateCode = CtlCreateCode & LoadFileTmp '把缓存中的代码添加到创建控件的所有代码里
CtlCreateCode = CtlCreateCode & "/*=====================================*/" & vbCrLf & vbCrLf