MESSAGE BOX USING DCOM

ACTIVE X
Public Enum micon mquestion = 0 mcancel = 1 minformation = 2 mexclamation = 3 End Enum Public Enum mbutton mok = 0 mcan = 1 mretry = 2 mignore = 3 End Enum Public Enum mresult rok = 0 rcancel = 1 rretry = 2 rignore = 3 End Enum

Public Function mymes(tit As String, mes As String, ico As micon, but As mbutton) As String n = Form1.showmes(tit, mes, ico, but) Select Case n Case rok: mymes = "Ok" Case rcancel:

mymes = "Cancel" Case rretry: mymes = "Retry" Case rignore: mymes = "Ignore" End Select End Function

FORM:
Dim re As mresult Public Function showmes(tit As String, mes As String, ico As micon, but As mbutton) As mresult Form1.Caption = tit Label1.Caption = mes Picture1(ico).Visible = True Select Case but Case mok: Command1(0).Visible = True Case mcan: Command1(0).Visible = True Command1(1).Visible = True Case mretry: Command1(0).Visible = True Command1(1).Visible = True Command1(2).Visible = True Case mignore: Command1(0).Visible = True Command1(1).Visible = True Command1(2).Visible = True

Command1(3).Visible = True End Select Form1.Show vbModal showmes = re End Function Private Sub Command1_Click(Index As Integer) re = Index Unload Me End Sub

STANDARD EXE:
re = u1.mymes(Text1.Text, Text2.Text, Combo1.ListIndex, Combo2.ListIndex) MsgBox "you have clicked" & re

ACTIVEX CONTROL FOR FILE OPERATION: ACTIVE X CONTROL:
Dim dname As Variant Public Function openf() As Variant cmd.ShowOpen rt.FileName = cmd.FileName End Function Public Function clearf() As Variant rt.Text = "" End Function

Public Function savef() As Variant cmd.ShowSave rt.SaveFile cmd.FileName End Function Public Function copyf() As Variant cmd.ShowOpen rt.FileName = cmd.FileName dname = InputBox("Enter the destination file") FileCopy cmd.FileName, dname End Function Public Function deletef() As Variant dname = InputBox("Enter the file to delete") Kill dname End Function

STANDARD EXE:
Dim a As Variant Private Sub Command1_Click() a = u1.savef End Sub Private Sub Command2_Click() a = u1.openf End Sub Private Sub Command3_Click()

u1.deletef MsgBox "file deleted" End Sub Private Sub Command4_Click() a = u1.clearf End Sub Private Sub Command5_Click() u1.copyf MsgBox "file copied" End Sub

OUTPUT:

Sign up to vote on this title
UsefulNot useful