Expansion of shell statements

Source: Internet
Author: User

Some solutions to the problems encountered when using shell statements in VB are as follows:

It should be a shell commandProgramAfter the execution is complete, execute the operation to display the file to textbox. Use waitforsingleobject to wait for the shell to execute the following operation.
'Declare the following APIs first
Private declare function OpenProcess lib "Kernel32" (byval dwdesiredaccess as long, byval binherithandle as long, byval dwprocessid as long) as long
Private declare function closehandle lib "Kernel32" (byval hobject as long) as long
Private declare function waitforsingleobject lib "Kernel32" (byval hhandle as long, byval dwmilliseconds as long) as long
Private const synchronize = & h100000
Private const infinite = & hffffffff

'The call is as follows:
Dim PID as long, phnd as long
PID = shell (application to be executed)
Phnd = OpenProcess (synchronize, 0, pid)
If phnd <> 0 then
Call waitforsingleobject (phnd, infinite)
Call closehandle (phnd)
'Execute the operation to read the file to textbox.
..................
Else
Msgbox "Call failed"
End if

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.