Archive

Posts Tagged ‘Coding’

Open / Close CD ROM in Visual Basic

March 23rd, 2009 Zaur Bahramov No comments

This code demonstrates how to create CD ROM open and close calls. Create a Windows Forms Application and add two buttons. I will leave default names in this example Form1 for the form and Button1 and Button2 for buttons. I’ve changed the text property only.

form1

Read more…

Categories: Visual Basic Tags: ,

How to Log Off, Restart and Shutdown PC in Visual Basic

March 23rd, 2009 Zaur Bahramov No comments

Here’s a small example of how to log off, restart and shutdown computer in Visual Basic. Open Visual Studio and create a new Windows Forms Application:

01

In the Solution Explorer right-click on ExitWindows –> Add –> Module… Leave the default name Module1.vb as is and click Add.

Paste the following code in Module1:

Public Declare Function ExitWindows Lib "user32" (ByVal uFlags As Long, _
ByVal dwReserved As Long) As Long

Public Const EWX_LOGOFF = 0
Public Const EWX_SHUTDOWN = 1
Public Const EWX_REBOOT = 2
Public Const EWX_FORCE = 4

Read more…

Categories: Visual Basic Tags: ,

Some links for Windows scripting… (Microsoft)

March 20th, 2009 Zaur Bahramov No comments

Creating a custom DLL in Visual Basic .NET

March 18th, 2009 Zaur Bahramov No comments

One of the best programming practices is to use DLL (Dynamic Link Library) files to re-use your code and controls across your applications. In this tutorial I will show you how to create a sample DLL file in Visual Basic .NET Professional edition and attach it to a new application.

1)    Create a new project, select Windows Forms Control Library and name it MiniCalc

Read more…

Categories: Visual Basic Tags: , ,