Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > Interaction command and functions (tutorial)

Reply
Thread Tools

Interaction command and functions (tutorial)

 
 
Omar Abid
Guest
Posts: n/a
 
      06-01-2008
Reason of this project:
The Microsoft.VisualBasic.Interaction class exposes many useful
commands and methods that were available in Visual Basic like
AppActivate, Beep, Callbyname...
This tutorial shows how to work with some of them.
Project details:
1- From VB 6.0 to VB .net 2.0
2- Useful interaction commands
3- Samples of interaction commands

1- From VB 6.0 to VB .net 2.0

There was several changes on VB .net (it's a big change and that's
clear). Although in an effort to make the transition from VB 6 to VB
2005 as easy as possible, Microsoft has gathered most of the Visual
Basic 6.0 commands and functions in the Microsoft.VisualBasic.dll
assembly.
Some of the commands and functions was deleted, other still the same
and others changed to the .net syntax.
For Example:
VbCrlf which is used on VB 6.0 (as a separator) still alive on VB .net
2.0 but a new syntax is already available for use.
ControlChars.crlf is the new method
As you are using VB .net I recommend that use the new syntax, and I'm
going to introduce some of the important change between the old and
the new syntax.

2- Useful interaction commands

VB 6.0 syntax contain many useful interaction commands and function
like the Message Box for example. Those commands still alive but have
been improved in the .net 2.0 version.

Shell Function:
The shell function runs an executable program, it works like the
command line so you can use it as a command line.
The shell function is capable of returning an integer indicating if
the program still running or not. The shell function was expanded in
the .net 2.0 version and supports an additional argument that enables
you to specify whether to wait until the shelled program terminates
with an optional timeout.
Use of the function

Shell (Application Path, Style, Wait, Timeout)

Example:

' Run Notepad.exe and wait until the user terminates it.
Shell ("notepad", AppWinStyle.NormalFocus, True)


AppActivate Function:
AppActivate is a cool function that may be helpful if you are
developing application for Windows. Now let see how this works and
what it do. The AppActivate function as it names, activate a currently
running application.
How it activates? Simply by giving the focus to the application
Window.
The function is quite useful and require only to know the windows
caption!
Use of the function

AppActivate ( Title) or AppActivate (ProcessID)

NB: You have to choose either to use the title or the processID and
not both!

Now let's see this example

' Activate the NotePad Window
AppActivate("Untitled - Notepad")

Now as we know those simple functions we can use them to build helpful
projects and application. Now see the sample of the interaction
commands.

3- Samples of interaction commands

This sample is exactly a direct (little expanded) application of the
two functions that we have studied together right now.
There's only one sample and if you run it you'll get a window with 2
buttons.
Each button introduce a sample for each function. The button caption
let you distinguish them.

The Shell sample:
Run a notepad application and return a message if the NotePad was
closed.
If the timeout was exceeded (5 seconds), return a message that the
NotePad still running
The AppActivate:
The following sample run a notepad with no focus and use AppActivate
to give it the focus.
So the sample use both of the functions

Download the source code
http://thedotnetsource.blogspot.com/...mands-and.html

The Zip file contains:
-The sample source code
-The readme.txt file
-The tutorial.txt file

Still have question:
Go to our blog (http://thedotnetsource.blogspot.com). Select the
tutorial post. Post a comment describing your problem.
If you have a general question, we highly recommend the MSDN Forums as
the best Dot Net forums in the net.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Weird interaction with nested functions inside a decorator-producingfunction and closuring of outer data... Adam Jorgensen Python 0 08-24-2011 12:21 PM
Interaction command and functions (tutorial) Omar Abid ASP .Net 0 06-01-2008 10:58 AM
virtual functions & container interaction babaco C++ 2 04-05-2007 05:47 PM
coldfusion cfhttp command interaction =?Utf-8?B?RnJhbmNlc2Nv?= ASP .Net 2 11-11-2004 02:20 PM
please help me in distinguish redefining functions, overloading functions and overriding functions. Xiangliang Meng C++ 1 06-21-2004 03:11 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57