Menu
Is free
registration
home  /  Installation and configuration/ All commands microsoft smail basic. Alternatives to replace Microsoft Small Basic

All microsoft smail basic commands. Alternatives to replace Microsoft Small Basic

Eclipse is an extensible development platform with runtimes and application platforms for creating, using, and managing software throughout its life cycle. Many people know Eclipse as the Java IDE, but Eclipse actually consists of over 60 different open source projects, see

Free Open Source Mac Windows Linux

  • NetBeans

    Free open source IDE for developers software... You get all the tools you need to create professional applications for desktop, corporate, web applications and mobile applications in Java, C / C ++ and even dynamic languages ​​such as PHP, JavaScript, Groovy and Ruby

    Free Open Source Mac Windows Linux BSD

  • Aptana studio

    Aptana Studio is a complete web development environment that combines powerful development tools with a suite of online hosting and collaboration services to help you and your team get more done. Includes PHP support, CSS, FTP and more.

    Free Open Source Mac Windows Linux

  • Komodo Edit

    Komodo Edit is fast, smart and free editor open source. Try using Komodo Edit (or its older brother Komodo IDE) - it's worth it.

    Free Open Source Mac Windows Linux

  • Xcode

    Apple's Xcode is the premier development environment for Mac OS X. In addition to being bundled on disc with every Mac OS X purchased, it is the most a new version is also always available for free download for ADC members ( social network for app developers on all Apple platforms) and includes all the tools you need to create, tweak and optimize the apps you create

    Free of charge Mac

  • MonoDevelop

    MonoDevelop is a cross-platform IDE primarily designed for C # and other .NET languages. MonoDevelop allows developers to quickly build desktop and ASP.NET web applications for Linux, Windows and Mac OSX. MonoDevelop allows developers to easily port .NET applications built in Visual Studio to Linux and Mac OSX while maintaining a single code base for all platforms

    Free Open Source Mac Windows Linux. NET Framework Xamarin Studio

  • Lazarus

    Free Pascal is a GPL compiler that works on Linux, Win32, OS / 2, 68K and more. Free Pascal is designed to understand and compile Delphi syntax. Lazarus is part of a missing puzzle that will allow you to develop Delphi-like programs for all of the above platforms. Since the same compiler is available on all of the above platforms, this means that you do not need to recode to create identical products for different platforms.

    Free Open Source Mac Windows Linux BSD OpenSolaris

  • WebStorm

    JetBrains WebStorm is a commercial JavaScript, CSS and HTML IDE built on the JetBrains IntelliJ IDEA framework.
    WebStorm provides code completion, on-the-fly code analysis, refactoring support, and VCS integration.

    Paid Mac Windows Linux

  • SharpDevelop

    #develop (short for SharpDevelop) is a free development environment for C #, VB.NET and Boo projects on the Microsoft platform. It is an open source environment. You can download as source and executable files.

  • Basics of programming.

    Programming language Small Basic

    LESSON 1: Familiarity with the programming environment Small Basic .

    Target: To acquaint with programming language Small Basic.

    Tasks:

      Start learning a programming language Smal Basic. Give a concept of OOP (Object Oriented Programming)

      To teach how to work in this programming environment. NS familiarize with the "text object" of the environment Smal Basic.

      To give the first idea of ​​creating programs in a programming environment.

    The main educational tasks of the project:

      Education of personal qualities: dedication, attentiveness, accuracy, objectivity in self-esteem, responsibility, cognitive interest.

    The main developmental tasks of the project:

      Form students' key competencies that contribute to successful social adaptation;

      To develop the desire for self-development and personal growth through cognitive activity.

    Know: Basic concepts: object, variables, assignment, data types, input-output.Know the constituent elements of the Small Basic programming environment.

    Be able to: Download the Smal Basic program. Create the simplest projects in a given programming environment. Be able to enter mathematical functions and write mathematical expressions in the Smal Basic language. Create simple linear programs.

    Equipment and material: supporting lecture notes (see.Annex 1 ), task cards, PC, Small Basic application, whiteboard, multimedia projector, screen.

    During the classes:

      Organizing time

      1. Lesson preparation

        Knowledge update

      Explanation of the new material

      Consolidation of the studied material

      1. Questions on the topic

      Summarizing

      1. Grading

        Homework

      Organizing time

      1. Preparation for the lesson (check the readiness for the lesson, mark the absent)

        Knowledge update

    What is programming for?

    You want to write an abstract in biology. Most likely, you will write it on your computer in some text editor. Where did it come from text editor? Of course, programmers wrote it. You will search for information on the Internet using a browser that was also written by programmers. After you write your abstract, you will want to relax and play computer game, which was again written by the programmers. In general, working on a computer is impossible without using programs written by programmers. This means that if there was no programming, there would be no programs, and a computer would be a bunch of expensive hardware, because it is impossible to do something using a computer without programs.

    Stages of problem solving.

    Basic concepts

    Programming - writing programs.

    Program - an algorithm written in a programming language that a computer can understand.

    Algorithm - a clear sequence of actions aimed at achieving the goal.

    In object oriented programming the concept of an object has been introduced, calculation mechanisms have been implemented that allow:

      Describe the structure of an object

      Describe actions with objects

      Use special rules for object inheritance (Inheritance means creating new objects from existing ones)

      Set the degree of protection of the object's components

      Theory

    First meeting

    Microsoft Small Basic - a programming language developed by the company. Designed for beginner developers who want to grasp the basics of software development.

    Main advantages:

      A very simple development environment - a text editor with a multifunctional tooltip and only a few buttons for editing text and launching programs.

      Simple language with only 20 keywords

      Contextual documentation for all language elements built into the development environment

      The ability to extend Small Basic components to include additional functionality. (For example, the delivery already includes opportunities for working with services)

      A special advantage of BASIC should be considered the ability to work in the interpretation mode, which greatly simplifies the process of debugging programs: the execution of almost every command can be checked immediately after writing.

    Output operator

    WriteLine ("Hello!")

    Displays the line (text or number )

    Hey!

    To get the result - output the text "Hello!" to the screen - you need to write a program:

    TextWindow.WriteLine ("Hello!")

    The program is entered into the windowSmallBasicand is started by the buttonLaunch or by key F 5

    The result of the program is the output of the text: "Hello!" vText box programs.

    The line means "Press any key to continue ...."

    A TextWindow is a text window object in which text can be displayed.

    The object possesses properties and methods.

    Object method something that the object is able to do, i.e. it isoperations (operators )

    Parameter the operation is enclosed in brackets WriteLine()

    Same object text box possesses properties (these are the characteristics of the object) , for example

    BackgroundColor property - sets the background color for the text,ForegroundColor- text color


    Colors:

    red

    yellow

    green

    blue

    black

    white

    Red

    yellow

    green

    blue

    black

    White

    Variable

    Variables are often used to create programs.

      The variable hasname - latin letter (a)

      A variable can be assigned a value, such as a numeric value

    a= 5, where the sign “ = " - this is assignment operator

    String value

    a = a + 5

      Take the value of variable a

      Add 5 to it

      Put the new value of the variable a, erasing the previous one from it

      There are two types of variable: number and line

    10, -5, 3.14 "informatics"

    Fold +

    Multiply *

    Divide /

    Mathematical actions:

    Sine, logarithm, root

    Glue

    Divide into parts

    Search symbols

    Replace characters

    EXAMPLE with operator "+"

    expression

    result

    expression

    result

    "Ivan" + "ova"

    "Ivanova"

    "Class" + 10

    "Class10"

    Programming

    Example 1: program result

    Example 2: program result

    Example 3: the program calculates and displays the sum of two variablesa and b

    Math.Abs ​​(namber)

    module

    Math.Cos ( namber)

    cosine

    Math.Ceiling (namber)

    rounds to an integer

    Math.GetDegrees ( namber)

    converting a number from radians to degrees

    Math.GetRandomNumber ( maxnamber)

    A random number in the range from 1 tomaxnamber

    NaturalLog (namber)

    Natural logarithm

    Math.Pi

    Pi

    Math.Power ( baseNamber, exponent)

    V omultiplying baseNamber to exponent

    Math. Max (namber1, namber2)

    Maximum of two numbers

    Math. Remainder (dividend, divisor)

    Remainder of the division

    Math .Sin (namber)

    Sinus

    Math. Tan(namber)

    Cosine

    Math .ScuareRoot (namber)

    Root

    Math. Round(namber)

    Normal rounding

    Math .ArcSin (namber)

    Arcsine

    Math. Floor(namber)

    Rounds to the nearest smallest integer

    x = TextWindow.ReadNumber ()

    y = Math.Abs ​​(x)

    TextWindow.WriteLine ("y equals "+ y)

    Math.Pi

      Securing the material

      1. Self practical work for PC

    Assignments for independent work

    Exercise 1:

    Determine End Results of Assignment Operators

    X = 3

    Y = 2

    X = X + 2

    Y = X * 2

    X = Y

    A = 15

    B = A

    A = B / 5 + 2

    B = A * 3

    A = 0

    Assignment 2 : Create a program for calculating the product of 3 variables:a , b and c .

    Assignment 3 : Make a program for calculating the expression:z=5* x+ y/ 2 (provided x = 10,y=100)

    Assignment 4: Create a program for outputting the values ​​of X andY, according to task 1.

    Assignment 5: Create a program for finding the discriminant

    Assignment 6 : evaluate expressions

      (5+5) 3 (1000 )

      2+|3-25| (24 )

      4 2 – (10)

      Cos 2 (Pi/4)+ Sin 2 (Pi/2) (1 )

      ( 1)

      Y = 2x 2 ( at x = 5, y = 50)

      X 1,2 = (for a = 2, b=6, c=4 , x 1=-1, x 2=-2)

      Z= ln (y)-3 ( at y = 3, z = -1.901 ...)

      С = (for a=4, b=9, c=13)

      Y = cos (x) + sin (x) (x = 180 0 , y = -1)

      Questions

      What is a program?

      What are programming languages ​​for?

      What are the basic elements of object-oriented programming?

      What operations can be performed in the "text box"?

      What does the assignment operator mean:

      What types of data are used in Smal Basic?

      How are I / O statements written?

      Summarizing

      1. Grading

        Homework

      Work with supporting notes

      prepare a message on the topic: "A variety of programming languages"

      Make a program calculating the area of ​​a triangle using Heron's formula

    Application

    OK 1: Fundamentals of programming in the language Small Basic .

    Programming - writing programs.

    ALGORITHM + PROGRAMMING LANGUAGE= PROGRAM

    Variable

      The variable hasname - Latin letter (For example,a , V , x1 , C9 )

      A variable can be assigned a value

    Example: a = 5 , where the sign " = " - this is assignment operator

      There are two types of variable: number and line (character sequence)

    10, -5, 3.14 "informatics"

    Fold +

    Multiply *

    Divide /

    Mathematical actions:

    Sine, logarithm, root

    Glue

    Divide into parts

    Search symbols

    Replace characters

    Programming

    TextWindow- this is text window object where you can display text.

    Operation parameter enclosed in brackets - WriteLine()

    An object text box possesses properties , for example

    Property BackgroundColor - sets the background color for the text,ForegroundColor - text color

    Colors used:

    red

    yellow

    green

    blue

    black

    white

    Red

    yellow

    green

    blue

    black

    White

    Small Basic Operators

    operator "+"

    Basic Operators

    Using math functions in expression

    Writing complex mathematical expressions Math.Pi TextWindow.WriteLine ("enter a value for variable x")

    x = TextWindow.ReadNumber ()

    y = Math.Abs ​​(x)

    TextWindow.WriteLine ("y equals "+ y)

    TextWindow.WriteLine (Math.Abs ​​(-10))

    Program for calculating the sum of two variablesa and b

    TextWindow.WriteLine ("enter the value of variable a")

    a = TextWindow.ReadNumber ()

    TextWindow.WriteLine ("enter a value for b")

    b = TextWindow.ReadNumber ()

    s = a + b

    TextWindow.WriteLine (" the sum of the numbers is "+ s)

    The program is entered into the windowSmallBasicand is started by the buttonLaunch or by key F 5.

    Line Press any key continue ... means “ Press any key to continue

    Hello everyone, in this article I want to show you useful codes small programs. Which you can use to write your own more serious programs, well, or you were looking for exactly these functions, which are described here.

    All codes were used in the Microsoft Visual Basic v6.0 programming environment.

    Exit with confirmation

    The first kind of program, or function, is an exit with an exit confirmation message. In general, open Wednesday Visual programming Basic, create a standard project, then place one button on the form, click on the button and you will see the code editing window, and there you need to insert the following code:

    Beep Dim message As String Dim buttonsandicons As Integer Dim title As String Dim response As String message = "Would you like to exit?" title = "(! LANG: Exit" buttonasicons = vbYesNo + vbQuestion response = MsgBox(message, buttonasicons, title) If response = vbYes Then End End If !}

    Password to start the program

    Dim Password, Pword PassWord = "12345" Pword = InputBox If Pword<>PassWord Then MsgBox "Password is not correct" End End If

    Where, 12345 is the password to start the program. But this code can be used wherever you want.

    Displaying a message

    If you just want to display a message, for something, then insert this:

    Beep Dim message As String Dim buttonsandicons As Integer Dim title As String message = "Message" title = "(! LANG: Message" buttonasicons = vbOKOnly + vbexciamation MsgBox message, buttonsandicons, title !}

    Drawing on a form

    Private Sub Form_MouseDown (Button As Integer, Shift As Integer, X As Single, Y As Single) Form1.CurrentX = X Form1.CurrentY = Y End Sub Private Sub Form_MouseMove (Button As Integer, Shift As Integer, X As Single, Y As Single) If Button = 1 Then Line (Form1.CurrentX, Form1.CurrentY) - (X, Y), QBColor (0) End If End Sub

    You can change the color using the QBColor (0) parameter, i.e. replace 0 with another digit.

    Restart your computer

    To restart your computer: place the button and paste the following code:

    Dim strComputer As String strComputer = "." Set objWMIService = GetObject ("winmgmts:" & "(impersonationLevel = impersonate, (Shutdown))! \\" _ & strComputer & "\ root \ cimv2") Set colOperatingSystems = objWMIService.ExeperacQuery ("Select * from For Win32_O Each ObjOperatingSystem In colOperatingSystems ObjOperatingSystem.Reboot "To restart Next

    Running the program in a single copy

    The following example will help you to make the program run only once, i.e. in case of restart, it will display a corresponding message. Insert into the form code:

    Private Sub Form_Load () If App.PrevInstance = True Then MsgBox "The project is already running!" End End If

    Shutting down your computer

    In order to turn off the computer, you can use the following code:

    Dim strComputer As String strComputer = "." Set objWMIService = GetObject ("winmgmts:" & "(impersonationLevel = impersonate, (Shutdown))! \\" _ & strComputer & "\ root \ cimv2") Set colOperatingSystems = objWMIService.ExeperacQuery ("Select * from For Win32_O Each ObjOperatingSystem In colOperatingSystems ObjOperatingSystem.ShutDown "To turn off Next

    Completion of any process

    In order to complete the process, you can use the following code:

    Shell "Cmd / x / c taskkill / f / im ICQlite.exe", vbvhite

    Where, instead of ICQlite.exe, there can be any process.

    How long does the computer work

    Below is an example of how you can determine the operating time of your computer. This method is based on using the kernel32 library, so include this DLL at the very beginning of the form code.

    Private Declare Function GetTickCount Lib "kernel32" () As Long "And in the button code: Dim a_hour, a_minute, a_second a = Format (GetTickCount () / 1000," 0 ")" only seconds a_days = Int (a / 86400) a = a - a_days * 86400 a_hour = Int (a / 3600) a = a - a_hour * 3600 a_minute = Int (a / 60) a_second = a - a_minute * 60 MsgBox "Your computer is running" & Str (a_days) & " "& Str (a_hour) _ &" hours "& Str (a_minute) &" minutes "& Str (a_second) &" seconds "

    We've covered simple functions that can be used just about anywhere. Now let's look at more serious examples, and they can greatly help you write your large projects.

    Examples of working with folders

    Delete directory

    Private Declare Function RemoveDirectory & Lib _ "kernel32" Alias ​​"RemoveDirectoryA" (ByVal lpPathName As String) "Delete directory (empty!) PathName $ =" D: \ t "code & = RemoveDirectory (PathName) If code & = 0 Then" Error deleting directory Else "Directory deleted End If

    Create directory

    Sub MakeDir (dirname As String) Dim i As Long, path As String Do i = InStr (i + 1, dirname & "\", "\") path = Left $ (dirname, i - 1) If Right $ (path , 1)<>":" And Dir $ (path, vbDirectory) = "" Then MkDir path End If Loop Until i> = Len (dirname) End Sub Private Sub Command1_Click () Call MakeDir ("C: \ Soft \ 1 \ 2 \ 3 \ ") End Sub

    List of all folders with sub folders

    Add 2 text fields and a button to the form, the name of the first text field: StartText, the name of the second text field OutText. Multiline property = true, button name = CmdStart

    Static running As Boolean Dim AllDirs As New Collection Dim next_dir As Integer Dim dir_name As String Dim sub_dir As String Dim i As Integer Dim txt As String If running Then running = False CmdStart.Enabled = False CmdStart.Caption = "Stopping" Else running = True MousePointer = vbHourglass CmdStart.Caption = "Stop" OutText.Text = "" DoEvents next_dir = 1 AllDirs.Add StartText.Text Do While next_dir<= AllDirs.Count dir_name = AllDirs(next_dir) next_dir = next_dir + 1 sub_dir = Dir$(dir_name & "\*", vbDirectory) Do While sub_dir <>"" If UCase $ (sub_dir)<>"PAGEFILE.SYS" And sub_dir<>"." And sub_dir<>".." Then sub_dir = dir_name & "\" & sub_dir On Error Resume Next If GetAttr (sub_dir) And vbDirectory Then AllDirs.Add sub_dir End If sub_dir = Dir $ (, vbDirectory) Loop DoEvents If Not running Then Exit Do Loop txt = "" For i = 1 To AllDirs.Count txt = txt & AllDirs (i) & vbCrLf Next i OutText.Text = txt MousePointer = vbDefault unning = False End If

    Now we run the program, in the StartText text box, write: C: \ windows, and click on the button.

    Catalog size

    Const MAX_PATH = 260 Private Type FILETIME dwLowDateTime As Long dwHighDateTime As Long End Type Private Type WIN32_FIND_DATA dwFileAttributes As Long ftCreationTime As FILETIME ftLastAccessTime As FILETIME ftLastWriteTime As FILETHIME As FILETIME ftLastWriteTime As FILETHIME nFile * 14 End Type Private Declare Function FindFirstFile Lib _ "kernel32" Alias ​​"FindFirstFileA" (ByVal lpFileName As String, lpFindFileData As WIN32_FIND_DATA) As Long Private Declare Function FindNextFile Lib _ "kernel32" Alias ​​"FindNextFileA" (By AsFile Long hFind WIN32_FIND_DATA) As Long Private Declare Function FindClose Lib _ "kernel32" (ByVal hFindFile As Long) As Long Public Function SizeOf (ByVal DirPath As String) As Double Dim hFind As Long Dim fdata As WIN32_FIND_DATA Dim dblSize As Double Dim sName As String Dim x As Long On Error Resume Next x = GetAttr (DirPath) If Err Then SizeOf = 0: Exit Function If (x And vbDirectory) = vbDirectory Then dblSize = 0 Err.Clear sName = Dir $ (EndSlash (DirPath) & "*. *", VbSystem Or vbHidden Or vbDirectory) If Err.Number = 0 Then hFind = FindFirstFile (EndSlash (DirPath) & "*. *", Fdata) If hFind = 0 Then Exit Function Do If (fdata.dwFileAttributes And vbDirectory) = vbDirectory Then sName = Left $ (fdata.cFileName, InStr (fdata.cFileName, vbNullChar) - 1) If sName<>"." And sName<>".." Then dblSize = dblSize + SizeOf (EndSlash (DirPath) & sName) End If Else dblSize = dblSize + fdata.nFileSizeHigh * 65536 + fdata.nFileSizeLow End If DoEvents Loop While FindNextFile (hFind, fdata)<>0 hFind = FindClose (hFind) End If Else On Error Resume Next dblSize = FileLen (DirPath) End If SizeOf = dblSize End Function Private Function EndSlash (ByVal PathIn As String) As String If Right $ (PathIn, 1) = "\" Then EndSlash = PathIn Else EndSlash = PathIn & "\" End If End Function Private Sub Form_Load () "Replace" D: \ soft "with the directory you want to know the size of MsgBox SizeOf (" D: \ soft ") / 1000000 End Sub

    Examples of working with files

    Copy

    Let's say we have a file named 1.txt in the C: \ 1 \ folder, and we need to copy it to C: \ 2 \ for this we write the following code:

    Filecopy "C: \ 1 \ 1.txt", "C: \ 2 \ 1.txt"

    Note! If there is already a file named 1.txt in directory 2, it will be replaced with 1.txt from directory 1.

    Private Declare Function CopyFile Lib _ "kernel32.dll" Alias ​​"CopyFileA" _ (ByVal lpExistingFileName As String, ByVal lpNewFileName As String, ByVal bFailIfExists As Long) As Long Private Sub Command1_Click () "Copy file C: \ 1.txt to D : \ 1.txt. Dim retval As Long "return value" Copy file retval = CopyFile ("C: \ 1.txt", "D: \ 1.txt", 1) If retval = 0 Then "If MsgBox error" Can't copy "Else" If everything is ok MsgBox "File copied." End If End Sub

    Deleting

    For example, we want to delete the file 1.txt from the root of the C: \ drive

    Kill ("C: \ 1.txt")

    API way

    Private Declare Function DeleteFile Lib _ "kernel32.dll" Alias ​​"DeleteFileA" (ByVal lpFileName As String) As Long Private Sub Command1_Click () "Delete file C: \ Samples \ anyfile.txt Dim retval As Long" Return value retval = DeleteFile ( "C: \ 1.txt") If retval = 1 Then MsgBox "File deleted successfully." End Sub

    Moving

    You can, for example, move it like this:

    Filecopy "C: \ 1.txt", "C: \ 2 \ 1.txt" Kill ("C: \ 1.txt")

    But it's better like this (via API):

    Private Declare Function MoveFile Lib _ "kernel32.dll" Alias ​​"MoveFileA" _ (ByVal lpExistingFileName As String, ByVal lpNewFileName As String) As Long Private Sub Command1_Click () Dim retval As Long "Return value retval = MoveFile (" C: \ 1 .txt "," C: \ 2 \ 1.txt ") If retval = 1 Then MsgBox" Moved successfully "Else MsgBox" Error "End If End Sub

    Renaming

    In order to rename the file 1.txt located in C: \ to 2.txt, you can use the following code:

    Filecopy "C: \ 1.txt", "C: \ 2.txt" Kill ("C: \ 1.txt")

    API way

    Private Declare Function MoveFile Lib _ "kernel32.dll" Alias ​​"MoveFileA" _ (ByVal lpExistingFileName As String, ByVal lpNewFileName As String) As Long Private Sub Command1_Click () Dim retval As Long "return value retval = MoveFile (" C: \ 1 .txt "," C: \ 2.txt ") If retval = 1 Then MsgBox" Success "Else MsgBox" Error "End If End Sub

    Determine file size

    File size can be determined in two ways:

    If the file can be opened with the OPEN function, then you can use the LOF function

    Dim FileFree As Integer Dim FileSize As Long FileFree = FreeFile Open "C: \ WIN \ GENERAL.TXT" For Input As FileFree FileSize = LOF (FileFree) Close FileFree

    Or use the FileLen function

    Dim lFileSize As Long FileSize = FileLen ("C: \ WIN \ GENERAL.TXT")

    Hide clock programmatically

    Add 2 buttons and paste the code:

    Option Explicit Private Declare Function FindWindow Lib _ "user32" Alias ​​"FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long Private Declare Function FindWindowEx Lib _ "user32" Alias ​​"FindWindowExA" _ (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long Private Declare Function ShowWindow Lib _ "user32" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long Dim hnd As Long Private Sub Command1_Click () ShowW hnd, 0 End Sub Private Sub Command2_Click () ShowWindow hnd, 1 End Sub Private Sub Form_Load () hnd = FindWindow ("Shell_TrayWnd", vbNullString) hnd = FindWindowEx (hnd, 0, "TrayNotifyWnd", vbNullString) hnd = FindWindowEx (hnd, 0, "TrayClockWClass", vbNullString) Command1.Caption = "Hide clock" Command2.Caption = "Show clock" End Sub

    Add icon to tray

    Add a module, paste the code into it:

    Declare Function Shell_NotifyIconA Lib _ "SHELL32" (ByVal dwMessage As Long, lpData As NOTIFYICONDATA) As Integer Public Const NIM_ADD = 0 Public Const NIM_MODIFY = 1 Public Const NIM_DELETE = 2 Public Const NIF_MESSAGE = 1 Public Const NIF_ICONT = 2 Type NOTIFYICONDATA cbSize As Long hWnd As Long uID As Long uFlags As Long uCallbackMessage As Long hIcon As Long szTip As String * 64 End Type Public Function SetTrayIcon (Mode As Long, hWnd As Long, Icon As Long, tip As String) As Long Dim nidTemp As NOTIFYICONDATA nidTemp.cbSize = Len (nidTemp) nidTemp.hWnd = hWnd nidTemp.uID = 0 & nidTemp.uFlags = NIF_ICON Or NIF_TIP nidTemp.uCallbackMessemp = 0 & nidTraycon = Shell_NotifyIconA (Mode, nidTemp) End Function

    To use, paste into the form code:

    Private Sub Form_Load () SetTrayIcon NIM_ADD, Me.hWnd, Me.Icon, "Test" End Sub "To remove Private Sub Command1_Click () SetTrayIcon NIM_DELETE, Me.hWnd, 0 &," "End Sub

    Blocking the start button

    Private Declare Function FindWindow Lib "user32" Alias ​​"FindWindowA" _ (ByVal lpClassName As String, ByVal lpWindowName As String) As Long Private Declare Function FindWindowEx Lib "user32" Alias ​​"FindWindowExA" _ (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long Private Declare Function EnableWindow Lib "user32" _ (ByVal hwnd As Long, ByVal fEnable As Long) As Long Public Sub EnableStartButton (Optional Enabled As Boolean = True) Dim lHwnd As Long " find hWnd lHwnd & = FindWindowEx (FindWindow ("Shell_TrayWnd", ""), 0 &, "Button", vbNullString) Call EnableWindow (lHwnd &, CLng (Enabled)) End Sub Private Sub Command1_Click () EnableStartButton False "START button is locked End Sub Private Sub Command2_Click () EnableStartButton True "START button is not locked End Sub

    Reading parameters from INI file

    The program connects to FTP, and the parameters are written in the ini file - server, login, port, password.

    From the beginning, we create an INI file:

    Servname = server usern = Login pwd = password port = port

    Place it in the program folder. Next, we insert into the module:

    Private Declare Function WritePrivateProfileString Lib _ "kernel32" Alias ​​"WritePrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As String, _ ByVal lpString As String, ByVal lpFileName As String) As Long kernel Private Declare Function GetPrivateProfileString _ Alias ​​" (ByVal lpApplicationName As String, ByVal lpKeyName As String, _ ByVal lpDefault As String, ByVal lpReturnedString As String, _ ByVal nSize As Long, ByVal lpFileName As String) As Long Public Function ReadIni (Razdel As String, Param) As String ReadIni (Razdel, Param, App.Path & "\ test.ini", "0") End Function Private Function GetValue (ByVal Section As String, _ ByVal Key As String, ByVal fFileName As String, Optional ByVal DefaultValue As String = vbNullString) As String Dim Data As String Data = String $ (1000, Chr $ (0)) If GetPrivateProfileString (Section, Key, DefaultValue, Data, 1000, fFileName)> 0 Then GetValue = Left $ (Data, InStr (Data $, Chr $ (0)) - 1 ) Else GetValue = DefaultValue End If Exit Function End Function

    Then we insert into the code of the form:

    Private Declare Function InternetOpen Lib _ "wininet.dll" Alias ​​"InternetOpenA" (ByVal sAgent As String, ByVal nAccessType As Long, ByVal sProxyName As String, _ ByVal sProxyBypass As String, ByVal nFlags As Long) As Long Private Declare Function InternetConnect Lib _ "wininet.dll" Alias ​​"InternetConnectA" (ByVal hInternetSession As Long, ByVal sServerName As String, _ ByVal nServerPort As Integer, ByVal sUserName As String, ByVal sPassword As String, ByVal nService As Long, _ ByVal dwVFlags As Long, ByVal dwVFlags As Long, ByVal dwVFlags As Long, ByVal Long) As Long Private Declare Function FtpPutFile Lib _ "wininet.dll" Alias ​​"FtpPutFileA" (ByVal hFtpSession As Long, ByVal lpszLocalFile As String, _ ByVal lpszRemoteFile As String, ByVal dwFlags As Long, ByVal dw) AsContext Asole Long Function FtpGetFile Lib _ "wininet.dll" Alias ​​"FtpGetFileA" (ByVal hFtpSession As Long, ByVal lpszRemoteFile As String, _ ByVal lpszNewFile As String, ByVal fFailIfExists As Boolean, ByVal dwFlags, LongAttributes _ ByVal dwFlags As Long, ByVal dwContext As Long) As Boolean Private Declare Function InternetCloseHandle Lib _ "wininet.dll" (ByVal hInet As Long) As Integer Dim rc & Dim rs &

    And in the button code:

    rc & = InternetOpen ("", 0, vbNullString, vbNullString, 0) rs & = InternetConnect (rc &, ReadIni ("General", "servname"), "0", _ ReadIni ("General", "usern"), ReadIni ( "General", "pwd"), 1, 0, 0) If FtpGetFile (rs &, "Your file.txt", "path where", False, 0, 1, 0) = False Then End Call InternetCloseHandle (rs &) Call InternetCloseHandle (rc &)

    List of running processes

    Add Listbox and 1 button, insert the following code:

    Option Explicit Private Declare Function CreateToolhelpSnapshot Lib _ "Kernel32" Alias ​​"CreateToolhelp32Snapshot" _ (ByVal lFlags As Long, ByVal lProcessID As Long) As Long Private Declare Function ProcessFirst Lib _ "Kernel32" Alias ​​"Process32First" _ (ByVal hSnapShot As Long As PROCESSENTRY32) As Long Private Declare Function ProcessNext Lib _ "Kernel32" Alias ​​"Process32Next" _ (ByVal hSnapShot As Long, uProcess As PROCESSENTRY32) As Long Private Declare Sub CloseHandle Lib "Kernel32" (ByVal hPass As Long) Private Const TH32CS_ AsNAPPRO = 2 & Private Const MAX_PATH As Integer = 260 Private Type PROCESSENTRY32 dwSize As Long cntUsage As Long th32ProcessID As Long th32DefaultHeapID As Long th32ModuleID As Long cntThreads As Long th32ParentProcessID As Long pcPriClassBase As Long dwFlags As Long sz * EndShot Dim uProcess As PROCESSENTRY32 Dim r As Long Private Sub Command1_Click () List1.Clear hSnapShot = Cre ateToolhelpSnapshot (TH32CS_SNAPPROCESS, 0 &) If hSnapShot = 0 Then Exit Sub End If uProcess.dwSize = Len (uProcess) r = ProcessFirst (hSnapShot, uProcess) Do While Call r List1.AddItem uProcess.szExeFile r = ProcessNext) CloseHandle (hSnapShot) End Sub

    Putting a program on startup

    In order for the program to load along with Windows, like some other programs, you can use the registry:

    Add 2 buttons and the following code:

    Private Sub Command1_Click () "Registry entry Set Reg = CreateObject (" WScript.Shell ") Reg.RegWrite" HKLM \ Software \ Microsoft \ Windows \ CurrentVersion \ Run \ Your program name ", _" The path to your program "End Sub Private Sub Command2_Click () "Deleting from the registry Set Reg = CreateObject (" WScript.Shell ") Reg.RegDelete" HKLM \ Software \ Microsoft \ Windows \ CurrentVersion \ Run \ Your program name "End Sub

    And in order for the program to load along with Windows, even in safe mode, then a code like this:

    First, a more serious way (just in case backup registry).

    Private Sub Command1_Click () Set Reg = CreateObject ("WScript.Shell") Reg.RegWrite "HKEY_LOCAL_MACHINE \ SOFTWARE \ Microsoft \ WindowsNT \ CurrentVersion \ Winlogon \ Shell", _ "Path to your program" End Sub Private Sub Command2_Click () " This is to restore Set Reg = CreateObject ("WScript.Shell") Reg.RegWrite "HKEY_LOCAL_MACHINE \ SOFTWARE \ Microsoft \ WindowsNT \ CurrentVersion \ Winlogon \ Shell", _ "Explorer.exe," End Sub

    Well, an easy way.

    Private Sub Command1_Click () Set Reg = CreateObject ("WScript.Shell") Reg.RegWrite "HKEY_LOCAL_MACHINE \ SOFTWARE \ Microsoft \ WindowsNT \ CurrentVersion \ Winlogon \ Userinit", _ "C: \\ WINDOWS \\ system32 \\ userinit.exe , The path to your program "End Sub Private Sub Command2_Click ()" To restore Set Reg = CreateObject ("WScript.Shell") Reg.RegWrite "HKEY_LOCAL_MACHINE \ SOFTWARE \ Microsoft \ WindowsNT \ CurrentVersion \ Winlogon \ Userinit", _ "C: \\ WINDOWS \\ system32 \\ userinit.exe, "End Sub

    Hide the taskbar

    Add 2 buttons and paste the code:

    Private Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, _ ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, _ ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long Private Declare Function FindWindow Lib "user32" Alias ​​"FindWindowA" _ (ByVal lpClassName As String, ByVal lpWindowName As String) As Long Const SWP_HIDEWINDOW = & H80 Const SWP_SHOWWINDOW = & H40 "Hides Private Sub Command1_Click () hwnd1 =" FindWindow ("" Shell_trawindow ("" Shell_trawindow) Call SetWindowPos (hwnd1, 0, 0, 0, 0, 0, SWP_HIDEWINDOW) End Sub "Shows Private Sub Command2_Click () hwnd1 = FindWindow (" Shell_traywnd "," ") Call SetWindowPos (hwnd1, 0, 0, 0, 0, 0, SWP_SHOWWINDOW) End Sub

    Unzip RAR archive

    In order to unzip a RAR archive, you can use the following code:

    WinRarApp = "C: \ Program Files \ WinRAR \ WinRAR.exe x -o +" iPath = "C: \" iArhivName = "Filename.rar" adr = WinRarApp & "" "" & iPath & iArhivName & "" "" "" & iPath & "" "" RetVal = Shell (adr, vbHide)

    How much RAM is in the computer

    Add one button and paste the following code:

    Private Declare Sub GlobalMemoryStatus Lib "kernel32" (lpBuffer As TMemoryStatus) Private Type TMemoryStatus dwLength As Long dwMemoryLoad As Long dwTotalPhys As Long dwAvailPhys As Long dwTotalPageFile As Long dwAvailwatPage As TMemoryStatus ) ms.dwLength = Len (ms) Call GlobalMemoryStatus (ms) MsgBox "Total:" & ms.dwTotalPhys & vbCr & "Free:" _ & ms.dwAvailPhys & vbCr & "Used in%:" & ms.dwMemoryLoad End Sub

    Hide desktop icons

    This is done in the following way. Add 2 buttons and paste the following code:

    Private Declare Function ShowWindow & Lib "user32" (ByVal hwnd &, ByVal nCmdShow &) Private Declare Function FindWindow Lib _ "user32" Alias ​​"FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long Const SW_HIDE = 0 Const SW_NORMAL = 1 Private Sub Command1_Click () Dim hHandle As Long hHandle = FindWindow ("progman", vbNullString) Call ShowWindow (hHandle, SW_HIDE) End Sub Private Sub Command2_Click () Dim hHandle As Long hHandle = FindWindow ("progman", vbNullString) Call ShowWindow , SW_NORMAL) End Sub

    The Command1 button hides the icons, Command2 makes the icons appear.

    That's all for me, I hope the above examples will be useful to you, for now!