Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 5

DLL SERVERS

 A DLL is a library that contains code and data that can be used by more than one
program at the same time.
 By using a DLL, a program can be modularized into separate components.
 For example, an accounting program may be sold by module. Each module can be
loaded into the main program at run time if that module is installed. Because the
modules are separate, the load time of the program is faster, and a module is only
loaded when that functionality is requested.
 updates are easier to apply to each module without affecting other parts of the program.
 For example, you may have a payroll program, and the tax rates change each year.
When these changes are isolated to a DLL, you can apply an update without needing to
build or install the whole program again.
 The following list describes some of the files that are implemented as DLLs in Windows
operating systems:
1.ActiveX Controls (.ocx) files
An example of an ActiveX control is a calendar control that lets select a date from a
calendar.

2.Control Panel (.cpl) files


An example of a .cpl file is an item that is located in Control Panel. Each item is a
specialized DLL.

3.Device driver (.drv) files


An example of a device driver is a printer driver that controls the printing to a printer.

 DLL ADVANTAGES:

1. Uses fewer resources

When multiple programs use the same library of functions, a DLL can reduce the
duplication of code that is loaded on the disk and in physical memory.
This can greatly influence the performance of not just the program that is running in the
foreground, but also other programs that are running on the Windows operating system.

2.Promotes modular architecture

A DLL helps promote developing modular programs.


This helps to develop large programs that require multiple language versions or a
program that requires modular architecture.
An example of a modular program is an accounting program that has many modules that
can be dynamically loaded at run time.

3.Eases deployment and installation

When a function within a DLL needs an update or a fix, the deployment and installation
of the DLL does not require the program to be relinked with the DLL.
if multiple programs use the same DLL, the multiple programs will all benefit from the
update or the fix.
 DLL TYPES:

When we load a DLL in an application, two methods of linking call the exported DLL
functions.
The two methods of linking are load-time dynamic linking and run-time dynamic linking.

1. Load-time dynamic linking

In load-time dynamic linking, an application makes explicit calls to exported DLL


functions like local functions.
To use load-time dynamic linking, provide a header (.h) file and an import library (.lib)
file when we compile and link the application.
When we do this, the linker will provide the system with the information that is required
to load the DLL and resolve the exported DLL function locations
at load time.

2. Run-time dynamic linking

In run-time dynamic linking, an application calls either the LoadLibrary function or the
LoadLibraryEx function to load the DLL at run time.
After the DLL is successfully loaded, use the GetProcAddress function to obtain the
address of the exported DLL function that want to call.
When we use run-time dynamic linking, we do not need an import library file.

OLE DRAG & DROP IN VB6.0


 Drag and drop is actually the same as copy & paste using the mouse instead of the
keyboard.
 During either operation, a copy of the data is maintained in memory.
 Cut and paste uses the Clipboard; drag and drop uses a DataObject object, which is in
essence a private clipboard.
 One of the most powerful and useful features added to Visual Basic applications is the
ability to drag text or graphics from one control to another, or from a control to another
Windows application, and vice versa.
 With OLE drag and drop,moving data from one control or application to another control
or application.
 All Visual Basic controls support OLE drag-and-drop to some degree.
 Some standard and ActiveX controls (those provided in the Professional and Enterprise
editions of Visual Basic) provide automatic support for OLE drag-and-drop,which means
that the control supports automatic settings in both their OLEDragMode and
OLEDropMode properties, and that no code needs to be written to either drag from or
drop to the control.
 The controls that support both automatic OLEDragMode and OLEDropMode include the
PictureBox, Label, and TextBox controls,among others. To enable automatic OLE
dragging and dropping for these controls,set both the OLEDragMode and OLEDropMode
properties to Automatic.
 Some controls support automatic OLE dragging but only manual dropping, and some
support automatic OLE dropping but only manual dragging.
How OLE Drag and Drop Works:
 When an OLE drag-and-drop operation is performed, certain events are generated on the
source and target sides.
 The events associated with the source object are always generated, whether the drag-
and-drop operation is automatic or manual.
 The target-side events, however, are only generated in a manual drop operation.
Starting the Drag:

 When the user drags data from an OLE drag source (a text box control, for example) by
selecting and then holding down the left mouse
 button, the OLEStartDrag event is triggered and then either store the data or simply
specify the formats that the source supports.
 Also need to specify whether copying or moving the data, or both, is allowed by the
source.
Dragging Over the Target:

 when the user drags over the target, the target’s OLEDragOver event is triggered,
indicating that the source is within its boundaries.
 specify what the target would do if the data were dropped there — either copy, move, or
refuse the data.
 the default is move, but it may be copy.
 When the target specifies which drop effect will be performed if the source is dropped
there,
 the OLEGiveFeedback event is triggered.
 The OLEGiveFeedback event is used to provide visual feedback to the user on what
action will be taken when the selection is dropped.
 i.e., the mouse pointer will be changed to indicate a copy, move, or "no drop" action.
 As the source is moved around within the boundaries of the target — or if the user
presses the SHIFT, CTRL, or ALT keys while holding down the mouse button — the drop
effect may be changed.
 For example, instead of allowing a copy or a move, the data may be refused.
 If the user passes beyond the target or presses the ESC key,for example, then the drag
operation may be canceled or modified.
Completing the Drag:

 When the user drops the source onto the target, the target’s OLEDragDrop event is
triggered.
 The target queries the source for the format of the data it contains and then either
retrieves or rejects the data.
 If the data was stored when the drag started, the target retrieves the data by using the
GetData method.
 If the data wasn’t stored when the drag started, the data is retrieved by triggering the
source’s OLESetData event and then using the SetData method.
 When the data is accepted or rejected, the OLECompleteDrag event is triggered and the
source can then take the appropriate action:
 if the data is accepted and a move is specified, the source deletes the data.
VB6 supports several drag and drop types:
Standard and OLE drag and drop with manual and automatic modes for both types.

STANDARD DRAG AND DROP:

 Data is passed by using the source control as a drag and drop parameter.
 The drag operation sets the source control in drag and drop mode.
 DragOver and DragDrop event handlers in the target control receive the source control
so they can obtain the data to be copied or moved from the source control itself.
object.Drag-Start drag method
object_DragDrop-Drag drop event handler
object_DragOver-Drag Over event handler

OLE DRAG AND DROP:

 Data is passed by using the source control as a drag and drop parameter.
 The data to be copied or moved is set at the beginning of the drag and drop operation
inside the OLEStartDrag event handler or by demand by the OLESetData event handler.
 The OLEDragOver and OLEDragDrop event handlers received the data in a DataObject
parameter.
object.OLEDrag -Start drag method
object_OLEStartDrag-Start drag event handler
object_OLEDragDrop-Drag Drop event handler
object_OLEDragOver-Drag Over event handler

MOUSE EVENT PROCEDURES


Write down the Mouse Event Procedures of VB6.0
1.MouseDown-User clicks one of the mouse buttons.
2.MouseUp-User releases a mouse button.
3.MouseMove-user moves the mouse pointer to a control or to a blank area of the form.

Write about Mouse Event Procedures.

1.MouseDown-User clicks one of the mouse buttons.


2.MouseUp-User releases a mouse button.
3.MouseMove-user moves the mouse pointer to a control or to a blank area of the form.

Controls recognize a mouse event only when the mouse pointer is inside the control.
If a mouse button is pressed and held while the mouse pointer is inside a control or
form.that object captures the mouse.

Syntax:
objectname_MouseEvent(Button As Integer,Shift As Integer,X As single,Y As Single)

If the object is part of control array ,then


ObjectInControlArray_MouseEvent(Index As Integer,Button As Integer,Shift As Integer,X
As Single,Y As Single)

MouseUp,MouseDown Events:
Example:
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, y As
Single)
Circle (X, y), 75
End Sub

Private Sub Form_MouseUp(Button As Integer, Shift As Integer, X As Single, y As Single)


Circle (X, y), 75
End Sub
MouseMove Event:
Calls the MouseMove event procedure whenever the user moves the mouse.
It is the most powerful mouse event procedure,used to analyze the state of the mouse
buttons.
Example:
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, y As
Single)
DrawWidth = 3
PSet (X, y)
End Sub

MouseMove event uses the three lower bits of the value of the Button parameter to
identify the complete state of the mouse button.

You might also like