Write a VB program that generates a log record when the program starts

Updated on technology 2024-04-11
18 answers
  1. Anonymous users2024-02-07

    It's as simple as adding a process to mylog

    Add call mylog() to the form load"Launch"Add call mylog() to the form unload"Exit")private sub form_load()call mylog("Launch")

    end sub

    private sub form_unload(cancel as integer)

    call mylog("Exit")

    end sub

    private sub mylog(nstr as string)dim f as string, h as longf = "c:\"

    If you want to save the file to the same folder as your exe, change the previous sentence to f = &"\"

    h = freefile

    close #h

    end sub

  2. Anonymous users2024-02-06

    private sub form_load()open "d:\" for append as #print #1, now, "Launch" 'You can change the comma after now to a component sign for compact output.

    closeend sub

    private sub form_queryunload(cancel as integer, unloadmode as integer)

    print #1, vbnullstring'Add a blank line, this sentence can be omitted.

    closeend sub

  3. Anonymous users2024-02-05

    close #

    As soon as the burn-off is exceeded, it is not good to generate a text and write the data into the silver segment.

    That's it.

  4. Anonymous users2024-02-04

    Create a new project 1 of vb6, create a picturebox object picture1 on form1, set the visible property of picture1 to false (that is, it will not be displayed at runtime), set the linkmode property of form1 to 1-source, and enter the following in the **window of form1**::

    private sub form_initialize()if then

    Project 1|form1"

    endend if

    end sub

    private sub form_linkexecute(cmdstr as string, cancel as integer)

    if = 1 then = 0

    cancel = 0

    end sub

    Compile the project, generate the exe file, and try the results: the first click will run, and the second click will show the current program of the first run instead of running the current program repeatedly.

  5. Anonymous users2024-02-03

    Do you want to do this with the programs that VB writes itself, or do you want to use the programs you write to detect other programs? Different goals, different solutions, of course, can be done, but the program written by yourself is easier to write.

  6. Anonymous users2024-02-02

    private sub form_keydown(keycode as integer, shift as integer)

    if keycode = vbkeyf6 and shift = 1 then

    print "Hello! "

    end if

    end sub

    The keypreview of the form should be set to true, so that the form activates keyboard events first.

    If you want to disable it, you can add unload me

    You can put that close statement into a timer, otherwise you won't see "Hello! "of.

    Specifically, add a timer control timer1 to the form

    private sub form_keydown(keycode as integer, shift as integer)

    if keycode = vbkeyf6 and shift = 1 then

    print "Hello! "

    end if

    end sub

    private sub timer1_timer()

    unload me

    end sub

    Run the program, press shift+f6, and the "Hello! and close the window after 1 second.

  7. Anonymous users2024-02-01

    The keydown event of the window is written.

    private sub form_keydown(keycode as integer, shift as integer)

    if keycode = vbkeyf6 and shift = 1 then

    print "Hello! "

    end if

    end sub

    and set the window's autodraw to true

  8. Anonymous users2024-01-31

    'Set the keypreview=true autoredraw=true for the form

    private sub form_keydown(keycode as integer, shift as integer)

    if keycode = vbkeyf6 and shift = 1 then

    print "Hello! "

    stop 'Add this to be able to see Hello otherwise directly end the running of the program and you won't see anything.

    endend if

    end sub

  9. Anonymous users2024-01-30

    I've done a few of these options, but the ideal ones are the following.

    1. Registry read/write running status.

    2. The ini configuration file records the read/write status.

    3. The memory index gets the running state.

    Get the running status of the program by reading it before each run of the program Process it as needed in each running program** You can decide whether to be invisible or visible according to the state obtained above.

  10. Anonymous users2024-01-29

    private sub form_click()= iif( = loadpicture(""), loadpicture("d:\"), loadpicture(""))

    end sub

    This way, you can click the toggle, and by the way, you need to add a box control and write it.

  11. Anonymous users2024-01-28

    .com

    There are 4 directories in the package.

    1 in is the first two sya 1, sya 3

    In 2 are the three triangles of sya 1, sya 2, and sya 3 that are followed by triangles.

    Random numbers are all about generating random numbers and judging them.

    Please give points, thank you!!

  12. Anonymous users2024-01-27

    private sub form_load() 'Runs on startup'Hide the form.

    open "c:\" for output as #1 'Open the file print 1, date & time'Write the date and time close

    end sub

    private sub form_queryunload(cancel as integer, unloadmode as integer) 'Runs when closed.

    open "c:\" for output as #2print #2, date & timeclose #

    end sub

    Put the program into the startup group.

  13. Anonymous users2024-01-26

    With the following **, it is very convenient.

    shell "cmd c echo program start start 》c:"

    shell "cmd c echo to start working "c:"

    shell "cmd c echo program shutdown c:"

  14. Anonymous users2024-01-25

    If it's closed, can't it be written?

  15. Anonymous users2024-01-24

    How to run the window program after writing the window program ** in VB.

    Refer to the following:1First, open VisualBasic to enter the operation interface.

    2.Then on the home page of the operation, find the "View" setting option on the main menu bar, and click the left mouse button on this option.

    3.At this time, you can see the pop-up menu bar window, find "Vertical Window", right-click the left mouse button "Window Now".

    4.Or press the shortcut key "Ctrl+G", you can also open the instant window, the result is as follows, as shown below.

  16. Anonymous users2024-01-23

    1. "Run" above the first point, and then start. If you want to stop, press "Run", "Stop", or Ctrl+Break

    2. Shortcut f5

    3. If the program is programmed and is not changing, then convert it into an application mode The specific method: click the file, generate the project, and take a name, which is the completed program.

  17. Anonymous users2024-01-22

    Press F5 or the black triangle.

  18. Anonymous users2024-01-21

    There's that black triangle on it.

Related questions
3 answers2024-04-11

Create two texts and one command

dim deshu as string >>>More

6 answers2024-04-11

VB design.

Introduction. What is required. >>>More

10 answers2024-04-11

shell ("shutdown -s -t 360") 'It means that it will turn off after 360 seconds. >>>More

9 answers2024-04-11

This is a simple program controlled by a single button, you will ask such a question, indicating that you do not understand the timing analysis of the PLC enough, look at this example, first the external driver, closing, in the input image register to collect the closure, and then enter the program scanning stage, the scanning mode of the PLC should be known! Top-to-bottom, left-to-right, linear cyclic scanning. Then because of the closure of the scan, the first network can flow on, through, through the rising edge command, turn on the coil for a cycle of scanning time, that is to say, after scanning the self-locking contact, the coil loses power. >>>More

8 answers2024-04-11

If you just make a separate app (instead of engaging in the secondary development of the framework), qt can barely make up the number. Although it is not pure C++ (relying on MOC QML), the overall tools (build tools, designers, IDE integration including VS) are relatively high, and they also support multiple mainstream platforms (Windows, Linux, OS X, etc.), with relaxed license requirements (LGPL), optional commercial support, and relatively low risk for individual APP projects. Although the binary size that needs to be released is still on the large side, it is easier to do than the mainstream web and. >>>More