chevron_left chevron_right
Login Register invert_colors photo_library
Thread Rating:
  • 0 Vote(s) - 0 Average


filter_list VB.NET Freeze Windows Script
Author
Message
VB.NET Freeze Windows Script #1
This simple script can freeze windows if the form is selected.

Code:
Public Class Form1

    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick


        Dim a As New Label

        Do Until a.Text = "b"

            Application.DoEvents()
            Try

            
                Do Until a.Text = "b"

                    Application.DoEvents()
                    Try

                    Catch exea As Exception

                    End Try

                Loop

            Catch ex As Exception

            End Try

        Loop


    End Sub
End Class
(This post was last modified: 02-12-2018, 07:17 PM by kokiprik.)

Reply

RE: VB.NET Freeze Windows Script #2
I haven't tested, but this is a cool little script. Nice job, man.

Reply

RE: VB.NET Freeze Windows Script #3
I wouldn't even know why you'd use this but it's all about locking the main thread. Your code is even pretty long for just locking the main thread. You could do that in a single line or to keep it more clear:
You also don't need a timer at all. To everyone still using VB.NET I highly recommend switching to C#.

In VB.NET:
Spoiler:
Code:
Public Class Form1
    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        While True
            'This will lock the UI thread (main thread)
        End While
    End Sub
End Class

In C#:
Spoiler:
Code:
using System;
using System.Windows.Forms;

namespace WindowsFormsApp2
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            while (true)
            {
                //Do nothing
            }
        }
    }
}
(This post was last modified: 04-29-2018, 10:39 PM by Bish0pQ.)
[Image: 5u8rTPk.jpg]
Click image to go to my website, it has been updated!

Reply






Users browsing this thread: 1 Guest(s)