Archive

Archive for July, 2009

A Simple Show and Hide Assistant Example

Private Sub CommandButton1_Click()
With Assistant
.Visible = True
.Animation = msoAnimationGreeting
End With
End Sub

Private Sub CommandButton2_Click()
With Assistant
.Visible = False
.Animation = msoAnimationGreeting
End With

End Sub

Private Sub CommandButton3_Click()
With Assistant.NewBalloon
.BalloonType = msoBalloonTypeBullets
.Icon = msoIconTip
.Button = msoButtonSetOK
.Heading = “Tips for Saving Information.”
.Labels(1).Text = “Save your work often.”
.Labels(2).Text = “Install a surge protector.”
.Labels(3).Text = “Exit your application properly.”
.Show
End With

End Sub

Categories: control

How to communicate directly with IIS in a VB DLL

ow to communicate directly with IIS in a VB DLL

The following article describes how to to communicate directly with IIS’s intrinsic objects from your VB DLL.

For example, suppose on your ASP page you instanciate an object called “myDll.myObject”:

<%
DIM oMyObject
Set oMyObject = Server.CreateObject(“myDll.myObject”)
‘Other code here
%>

If you want this DLL to be able to talk directly to the IIS objects (eg. the Reponse and Request objects) then you will need to add a reference to ‘Microsoft Active Server Pages Object Library’ in the DLL. Next, use the following code as a template in the DLL:

Option Explicit
Private zoRequest As ASPTypeLibrary.Request
Private zoResponse As ASPTypeLibrary.Response
private zoAspScripting As ASPTypeLibrary.ScriptingContext

‘This is automatically called when your DLL is instantiated by the ASP page
Sub OnStartPage(AspScripting As ASPTypeLibrary.ScriptingContext)
On Error GoTo ErrFailed
‘Store the various ASP object you want to use
Set zoAspScripting = AspScripting
Set zoResponse = zoAspScripting .Response
Set zoRequest  = zoAspScripting .Request

Exit Sub

ErrFailed:
‘Error handling here
End Sub

‘This is also automatically called when the ASP page releases its
‘reference to your DLL.
Sub OnEndPage()
‘Release references to the ASP objects
Set zoResponse = Nothing
Set zoRequest  = Nothing
Set zoAspScripting = Nothing
End Sub

Using this code you can write directly from you DLL to the web browser of the client using the Response Object.

source:http://www.visualbasic.happycodings.com

Categories: forms

Index Control

Private Sub Form_Click()

Dim intNextIndex as Integer
IntNextIndex=CommandArray.UBound+1

Load CommandArray(IntNextIndex)

CommandArray(intNextIndex).Visible=True

CommandArray(intNextIndex).Caption=”New Button”

CommandArray(intNextIndex).Move ScaleWidth/2-

CommandArray(intNextIndex).Width /2, ScaleHeight /2-

CommandArray(intNextIndex).Height /2

End Sub

Private sub CommandArray_Click(Index as Integer)

MsgBox “You clicked button” & Index

End Sub

Note:

create 1 Form and 4 buttons

Categories: control Tags:

Tiles a bitmap across a form

Description: Tiles a bitmap across a form

‘Private Declare Function BitBlt Lib “GDI32″ (ByVal hDestDC As Integer, ByVal X As Integer, ByVal Y As Integer, ByVal nWidth As Integer, ByVal nHeight As Integer, ByVal hSrcDC As Integer, ByVal XSrc As Integer, ByVal YSrc As Integer, ByVal dwRop As Long) As Integer

Dim maxhgt As Long, maxwid As Long
Dim pwid As Integer, phgt As Integer

‘Sub Form_Load ()
picture1.ScaleMode = 3
picture1.Visible = False
picture1.AutoSize = True
picture1.AutoRedraw = True
pwid = picture1.ScaleWidth
phgt = picture1.ScaleHeight
‘End Sub

‘Sub Form_Paint ()
phDC& = picture1.hDC
frmhdc& = hdc
For j% = 0 To maxhgt Step phgt
For i% = 0 To maxwid Step pwid
X% = BitBlt(frmhdc&, i%, j%, pwid, phgt, phDC&, 0, 0, &HCC0020)
Next
Next
‘End Sub

‘Sub Form_Resize ()
maxhgt = Height \ screen.TwipsPerPixelY
maxwid = Width \ screen.TwipsPerPixelX
‘End Sub

Categories: forms