Chào các bạn! Trong các khóa học trước của chuỗi khóa học Auto C# chúng ta đã cùng tìm hiểu về SELENIUM và HTTP REQUEST trong C#.
Ở khóa học này, bạn sẽ được tìm hiểu thêm một phần khá thú vị, đó là LẬP TRÌNH ĐIỀU KHIỂN ỨNG DỤNG PC VỚI C#. Mục đích hướng tới là các bạn có thể làm auto bằng C# mà không cần dùng tới các ngôn ngữ như AutoIT, C++,…
Chúng ta đã biết cách CLICK VÀO TỌA ĐỘ KHÔNG CHIẾM CHUỘT , tiếp theo chúng ta sẽ cùng tìm hiểu về cách Gửi phím ngầm trong điều khiển ứng dụng PC
Nội dung
Nội dung bao gồm Source code & các lưu ý chính về quá trình thực hiện phần mềm. Kteam khuyến khích bạn cập nhập thêm nhiều kinh nghiệm cũng như hiểu chi tiết hơn về các kỹ thuật được đề cập trong bài học thông qua các video đính kèm.
Đừng quên Like Facebook hoặc +1 Googleđể ủng hộ Kteam và tác giả.
Để có đủ khả năng học hiểu các nội dung được đề cập đến trong khóa học. Bạn nên có tối thiểu kiến thức về các phần:
namespace AutoControlAppPC
{
partial class Form1
{
///<summary>/// Required designer variable.///</summary>private System.ComponentModel.IContainer components = null;
///<summary>/// Clean up any resources being used.///</summary>///<param name="disposing">true if managed resources should be disposed; otherwise, false.</param>protectedoverridevoidDispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code///<summary>/// Required method for Designer support - do not modify/// the contents of this method with the code editor.///</summary>privatevoidInitializeComponent()
{
this.button1 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.button3 = new System.Windows.Forms.Button();
this.button4 = new System.Windows.Forms.Button();
this.button5 = new System.Windows.Forms.Button();
this.button6 = new System.Windows.Forms.Button();
this.numericUpDown1 = new System.Windows.Forms.NumericUpDown();
this.numericUpDown2 = new System.Windows.Forms.NumericUpDown();
this.checkBox1 = new System.Windows.Forms.CheckBox();
this.checkBox2 = new System.Windows.Forms.CheckBox();
this.button7 = new System.Windows.Forms.Button();
this.textBox1 = new System.Windows.Forms.TextBox();
this.button8 = new System.Windows.Forms.Button();
this.textBox2 = new System.Windows.Forms.TextBox();
this.button9 = new System.Windows.Forms.Button();
this.button10 = new System.Windows.Forms.Button();
this.label1 = new System.Windows.Forms.Label();
this.button11 = new System.Windows.Forms.Button();
this.button12 = new System.Windows.Forms.Button();
this.button13 = new System.Windows.Forms.Button();
this.button14 = new System.Windows.Forms.Button();
this.button15 = new System.Windows.Forms.Button();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown2)).BeginInit();
this.SuspendLayout();
// // button1// this.button1.Location = new System.Drawing.Point(12, 12);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(75, 23);
this.button1.TabIndex = 0;
this.button1.Text = "Mở notepad";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
// // button2// this.button2.Location = new System.Drawing.Point(93, 12);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(112, 23);
this.button2.TabIndex = 1;
this.button2.Text = "Mở file/Ứng dụng";
this.button2.UseVisualStyleBackColor = true;
this.button2.Click += new System.EventHandler(this.button2_Click);
// // button3// this.button3.Location = new System.Drawing.Point(12, 41);
this.button3.Name = "button3";
this.button3.Size = new System.Drawing.Size(122, 23);
this.button3.TabIndex = 2;
this.button3.Text = "Chạy lệnh CMD";
this.button3.UseVisualStyleBackColor = true;
this.button3.Click += new System.EventHandler(this.button3_Click);
// // button4// this.button4.Location = new System.Drawing.Point(140, 41);
this.button4.Name = "button4";
this.button4.Size = new System.Drawing.Size(122, 23);
this.button4.TabIndex = 3;
this.button4.Text = "Chạy lệnh CMD ngầm";
this.button4.UseVisualStyleBackColor = true;
this.button4.Click += new System.EventHandler(this.button4_Click);
// // button5// this.button5.Location = new System.Drawing.Point(268, 41);
this.button5.Name = "button5";
this.button5.Size = new System.Drawing.Size(203, 23);
this.button5.TabIndex = 4;
this.button5.Text = "Chạy lệnh CMD ngầm và lấy kết quả";
this.button5.UseVisualStyleBackColor = true;
this.button5.Click += new System.EventHandler(this.button5_Click);
// // button6// this.button6.Location = new System.Drawing.Point(373, 67);
this.button6.Name = "button6";
this.button6.Size = new System.Drawing.Size(149, 23);
this.button6.TabIndex = 5;
this.button6.Text = "Click vào tọa độ màn hình";
this.button6.UseVisualStyleBackColor = true;
this.button6.Click += new System.EventHandler(this.button6_Click);
// // numericUpDown1// this.numericUpDown1.Location = new System.Drawing.Point(12, 70);
this.numericUpDown1.Maximum = newdecimal(newint[] {
3000,
0,
0,
0});
this.numericUpDown1.Minimum = newdecimal(newint[] {
3000,
0,
0,
-2147483648});
this.numericUpDown1.Name = "numericUpDown1";
this.numericUpDown1.Size = new System.Drawing.Size(75, 20);
this.numericUpDown1.TabIndex = 6;
// // numericUpDown2// this.numericUpDown2.Location = new System.Drawing.Point(93, 70);
this.numericUpDown2.Maximum = newdecimal(newint[] {
3000,
0,
0,
0});
this.numericUpDown2.Minimum = newdecimal(newint[] {
3000,
0,
0,
-2147483648});
this.numericUpDown2.Name = "numericUpDown2";
this.numericUpDown2.Size = new System.Drawing.Size(75, 20);
this.numericUpDown2.TabIndex = 7;
// // checkBox1// this.checkBox1.AutoSize = true;
this.checkBox1.Location = new System.Drawing.Point(174, 73);
this.checkBox1.Name = "checkBox1";
this.checkBox1.Size = new System.Drawing.Size(77, 17);
this.checkBox1.TabIndex = 8;
this.checkBox1.Text = "Chuột phải";
this.checkBox1.UseVisualStyleBackColor = true;
// // checkBox2// this.checkBox2.AutoSize = true;
this.checkBox2.Location = new System.Drawing.Point(257, 73);
this.checkBox2.Name = "checkBox2";
this.checkBox2.Size = new System.Drawing.Size(85, 17);
this.checkBox2.TabIndex = 9;
this.checkBox2.Text = "Double click";
this.checkBox2.UseVisualStyleBackColor = true;
// // button7// this.button7.Location = new System.Drawing.Point(528, 67);
this.button7.Name = "button7";
this.button7.Size = new System.Drawing.Size(149, 23);
this.button7.TabIndex = 10;
this.button7.Text = "Click vào tọa độ ứng dụng";
this.button7.UseVisualStyleBackColor = true;
this.button7.Click += new System.EventHandler(this.button7_Click);
// // textBox1// this.textBox1.Location = new System.Drawing.Point(683, 69);
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(153, 20);
this.textBox1.TabIndex = 11;
this.textBox1.Text = "Remote Desktop Connection";
// // button8// this.button8.Location = new System.Drawing.Point(12, 96);
this.button8.Name = "button8";
this.button8.Size = new System.Drawing.Size(149, 23);
this.button8.TabIndex = 12;
this.button8.Text = "Click vào control ứng dụng";
this.button8.UseVisualStyleBackColor = true;
this.button8.Click += new System.EventHandler(this.button8_Click);
// // textBox2// this.textBox2.Location = new System.Drawing.Point(167, 98);
this.textBox2.Name = "textBox2";
this.textBox2.Size = new System.Drawing.Size(153, 20);
this.textBox2.TabIndex = 13;
this.textBox2.Text = "ToolbarWindow32";
// // button9// this.button9.Location = new System.Drawing.Point(12, 125);
this.button9.Name = "button9";
this.button9.Size = new System.Drawing.Size(149, 23);
this.button9.TabIndex = 14;
this.button9.Text = "Gửi phím cho ứng dụng";
this.button9.UseVisualStyleBackColor = true;
this.button9.Click += new System.EventHandler(this.button9_Click);
// // button10// this.button10.Location = new System.Drawing.Point(167, 124);
this.button10.Name = "button10";
this.button10.Size = new System.Drawing.Size(149, 23);
this.button10.TabIndex = 15;
this.button10.Text = "Gửi tổ hợp phím cho ứng dụng";
this.button10.UseVisualStyleBackColor = true;
this.button10.Click += new System.EventHandler(this.button10_Click);
// // label1// this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(12, 190);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(162, 13);
this.label1.TabIndex = 16;
this.label1.Text = "Không chiếm chuột và bàn phím";
// // button11// this.button11.Location = new System.Drawing.Point(15, 221);
this.button11.Name = "button11";
this.button11.Size = new System.Drawing.Size(149, 23);
this.button11.TabIndex = 17;
this.button11.Text = "Sửa tiêu đề của cửa sổ";
this.button11.UseVisualStyleBackColor = true;
this.button11.Click += new System.EventHandler(this.button11_Click);
// // button12// this.button12.Location = new System.Drawing.Point(174, 221);
this.button12.Name = "button12";
this.button12.Size = new System.Drawing.Size(149, 23);
this.button12.TabIndex = 18;
this.button12.Text = "Gửi text cho combobox";
this.button12.UseVisualStyleBackColor = true;
this.button12.Click += new System.EventHandler(this.button12_Click);
// // button13// this.button13.Location = new System.Drawing.Point(15, 250);
this.button13.Name = "button13";
this.button13.Size = new System.Drawing.Size(149, 23);
this.button13.TabIndex = 19;
this.button13.Text = "Click vào control của ứng dụng";
this.button13.UseVisualStyleBackColor = true;
this.button13.Click += new System.EventHandler(this.button13_Click);
// // button14// this.button14.Location = new System.Drawing.Point(15, 279);
this.button14.Name = "button14";
this.button14.Size = new System.Drawing.Size(149, 23);
this.button14.TabIndex = 20;
this.button14.Text = "Click vào tọa độ ngầm";
this.button14.UseVisualStyleBackColor = true;
this.button14.Click += new System.EventHandler(this.button14_Click);
// // button15// this.button15.Location = new System.Drawing.Point(15, 308);
this.button15.Name = "button15";
this.button15.Size = new System.Drawing.Size(149, 23);
this.button15.TabIndex = 21;
this.button15.Text = "Gửi phím ENTER cho ứng dụng";
this.button15.UseVisualStyleBackColor = true;
this.button15.Click += new System.EventHandler(this.button15_Click);
// // Form1// this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(848, 340);
this.Controls.Add(this.button15);
this.Controls.Add(this.button14);
this.Controls.Add(this.button13);
this.Controls.Add(this.button12);
this.Controls.Add(this.button11);
this.Controls.Add(this.label1);
this.Controls.Add(this.button10);
this.Controls.Add(this.button9);
this.Controls.Add(this.textBox2);
this.Controls.Add(this.button8);
this.Controls.Add(this.textBox1);
this.Controls.Add(this.button7);
this.Controls.Add(this.checkBox2);
this.Controls.Add(this.checkBox1);
this.Controls.Add(this.numericUpDown2);
this.Controls.Add(this.numericUpDown1);
this.Controls.Add(this.button6);
this.Controls.Add(this.button5);
this.Controls.Add(this.button4);
this.Controls.Add(this.button3);
this.Controls.Add(this.button2);
this.Controls.Add(this.button1);
this.Name = "Form1";
this.Text = "Form1";
((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown2)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregionprivate System.Windows.Forms.Button button1;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.Button button3;
private System.Windows.Forms.Button button4;
private System.Windows.Forms.Button button5;
private System.Windows.Forms.Button button6;
private System.Windows.Forms.NumericUpDown numericUpDown1;
private System.Windows.Forms.NumericUpDown numericUpDown2;
private System.Windows.Forms.CheckBox checkBox1;
private System.Windows.Forms.CheckBox checkBox2;
private System.Windows.Forms.Button button7;
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.Button button8;
private System.Windows.Forms.TextBox textBox2;
private System.Windows.Forms.Button button9;
private System.Windows.Forms.Button button10;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Button button11;
private System.Windows.Forms.Button button12;
private System.Windows.Forms.Button button13;
private System.Windows.Forms.Button button14;
private System.Windows.Forms.Button button15;
}
}
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
Project tải xuống
Nếu việc thực hành theo hướng dẫn không diễn ra suôn sẻ như mong muốn. Bạn cũng có thể tải xuốngPROJECT THAM KHẢO ở link bên dưới!
Phần mềm & Thư viện khác
Kết
Trong bài này, chúng ta đã tìm hiểu cách Gửi phím ngầm trong điều khiển ứng dụng PC.
Ở bài sau, Kteam sẽ giới thiệu đến bạn IMAGE SEARCH TRONG ĐIỀU KHIỂN ỨNG DỤNG PC
Cảm ơn các bạn đã theo dõi bài viết. Hãy để lại bình luận hoặc góp ý của mình để phát triển bài viết tốt hơn. Và đừng quên “Luyện tập – Thử Thách – Không ngại khó”
Tải xuống
Tài liệu
Nhằm phục vụ mục đích học tập Offline của cộng đồng, Kteam hỗ trợ tính năng lưu trữ nội dung bài học Gửi phím ngầm trong điều khiển ứng dụng PC dưới dạng file PDF trong link bên dưới.
Ngoài ra, bạn cũng có thể tìm thấy các tài liệu được đóng góp từ cộng đồng ở mục TÀI LIỆU trên thư viện Howkteam.com
Đừng quên like và share để ủng hộ Kteam và tác giả nhé!
Thảo luận
Nếu bạn có bất kỳ khó khăn hay thắc mắc gì về khóa học, đừng ngần ngại đặt câu hỏi trong phần bên dưới hoặc trong mục HỎI & ĐÁP trên thư viện Howkteam.com để nhận được sự hỗ trợ từ cộng đồng.
Ở khóa học này, bạn sẽ được tìm hiểu thêm một phần khá thú vị, đó là LẬP TRÌNH ĐIỀU KHIỂN ỨNG DỤNG PC VỚI C#. Mục đích hướng tới là các bạn có thể làm auto bằng C# mà không cần dùng tới các ngôn ngữ như AutoIT, C++,…
Đánh giá
Bình luận
Để bình luận, bạn cần đăng nhập bằng tài khoản Howkteam.
mình gặp vấn đề là khi chạy "hWnd = AutoControl.FindWindowHandle("#32770", "Nguyễn Ngọc Anh");" không tìm thấy cửa sổ, và có thể do không nhận diện được unicode bác à, có cách nào khắc phục ko bác
cho minh xin soft spy++
Hi bạn,
Mình đang làm 1 cái form, có 1 textBox1.
Khi bấm Start, mình cho nó copy text ở trong textBox1 đó bằng lệnh: Clipboard.SetDataObject(textBox1.Text);
Khi ko tạo Task mới để chạy thì nó chạy và copy được
Nhưng khi tạo t = New Task() .. để chạy thì nó báo lỗi ở dòng lệnh đó.
Không biết sai chỗ nào bạn giúp mình với nhé
Chỉ giúp mình cách gửi phím Ctrl+Chuột trái , Ctrl+Chuột phải
Chỉ giúp mình cách gửi phím Ctrl+Chuột trái , Ctrl+Chuột phải
mình gặp vấn đề là khi chạy "hWnd = AutoControl.FindWindowHandle("#32770", "Nguyễn Ngọc Anh");" không tìm thấy cửa sổ, và có thể do không nhận diện được unicode bác à, có cách nào khắc phục ko bác