From 689e56ca02e02a6b764dcb5ffab07958b3306fb5 Mon Sep 17 00:00:00 2001 From: integralfx Date: Sat, 24 Nov 2018 21:01:59 +1100 Subject: [PATCH] move_memtests() doesn't run on a separate thread When pressing the run button, the MemTest instances now moves before starting. --- MemTestHelper/Form1.cs | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/MemTestHelper/Form1.cs b/MemTestHelper/Form1.cs index 3a56a97..c45eabe 100644 --- a/MemTestHelper/Form1.cs +++ b/MemTestHelper/Form1.cs @@ -218,7 +218,7 @@ private void btn_show_Click(object sender, EventArgs e) private void offset_changed(object sender, EventArgs e) { - move_memtests(); + run_in_background(new MethodInvoker(delegate { move_memtests(); })); } private void btn_center_Click(object sender, EventArgs e) @@ -445,10 +445,10 @@ private void start_memtests() double ram = Convert.ToDouble(txt_ram.Text) / threads; ControlSetText(hwnd, MEMTEST_EDT_RAM, string.Format("{0:f2}", ram)); - ControlClick(hwnd, MEMTEST_BTN_START); - ControlSetText(hwnd, MEMTEST_STATIC_FREE_VER, "Modified version by ∫ntegral#7834"); + ControlClick(hwnd, MEMTEST_BTN_START); + Thread.Sleep(10); } } @@ -464,20 +464,17 @@ private void move_memtests() rows = (int)cbo_rows.SelectedItem, cols = (int)cbo_threads.SelectedItem / rows; - run_in_background(new MethodInvoker(delegate + for (int r = 0; r < rows; r++) { - for (int r = 0; r < rows; r++) + for (int c = 0; c < cols; c++) { - for (int c = 0; c < cols; c++) - { - IntPtr hwnd = memtest_states[r * cols + c].proc.MainWindowHandle; - int x = c * MEMTEST_WIDTH + c * x_spacing + x_offset, - y = r * MEMTEST_HEIGHT + r * y_spacing + y_offset; + IntPtr hwnd = memtest_states[r * cols + c].proc.MainWindowHandle; + int x = c * MEMTEST_WIDTH + c * x_spacing + x_offset, + y = r * MEMTEST_HEIGHT + r * y_spacing + y_offset; - MoveWindow(hwnd, x, y, MEMTEST_WIDTH, MEMTEST_HEIGHT, true); - } + MoveWindow(hwnd, x, y, MEMTEST_WIDTH, MEMTEST_HEIGHT, true); } - })); + } } private void close_all_memtests()