Sunday, June 17, 2012

VB6 WebBrowser - Menampilkan Pop Up

Private Sub WebBrowser1_NewWindow2(ppDisp As Object, Cancel As Boolean)
Dim frm As Form1
Set frm = New Form1
Set ppDisp = frm.WebBrowser1.Object
frm.Show
End Sub
READ MORE - VB6 WebBrowser - Menampilkan Pop Up

Membuat Aplikasi Console Sederhana Menggunakan VB6

Option Explicit
'
'Reference to Microsoft Scripting Runtime.
'

Public SIn As Scripting.TextStream
Public SOut As Scripting.TextStream

'--- Only required for testing in IDE or Windows Subsystem ===
Private Declare Function AllocConsole Lib "kernel32" () As Long
Private Declare Function GetConsoleTitle Lib "kernel32" _
Alias "GetConsoleTitleA" ( _
ByVal lpConsoleTitle As String, _
ByVal nSize As Long) As Long
Private Declare Function FreeConsole Lib "kernel32" () As Long

Private Allocated As Boolean

Private Sub Setup()
Dim Title As String

Title = Space$(260)
If GetConsoleTitle(Title, 260) = 0 Then
AllocConsole
Allocated = True
End If
End Sub

Private Sub TearDown()
If Allocated Then
SOut.Write "Press enter to continue..."
SIn.ReadLine
FreeConsole
End If
End Sub
'--- End testing ---------------------------------------------

Private Sub Main()
Setup 'Omit for Console Subsystem.

With New Scripting.FileSystemObject
Set SIn = .GetStandardStream(StdIn)
Set SOut = .GetStandardStream(StdOut)
End With

SOut.WriteLine "Any output you want"
SOut.WriteLine "Goes here"

TearDown 'Omit for Console Subsystem.
End Sub
READ MORE - Membuat Aplikasi Console Sederhana Menggunakan VB6

Cara Membulatkan Angka Yang Berada Di belakang Koma

Mengenai cara membulatkan angka yang berada di belakang koma - Adapun cara membulatkan angka di belakang koma adalah sebagai berikut:
Text1.Text = Format (0.026, "#0.##")
Maka dari kode di atas akan diperoleh 0.03
READ MORE - Cara Membulatkan Angka Yang Berada Di belakang Koma

Contoh Fungsi API GetTickCount Dalam VB6

Private Declare Function GetTickCount Lib "kernel32" () As Long

Private Sub Command1_Click()

Dim StartTime As Long
Dim EndTime As Long
Dim M As Long
Dim K As Long
Dim X As Double


For M = 1 To 10

StartTime = GetTickCount

For K = 1 To 10000000
X = X * 1.01
X = X / 1.01
Next K

EndTime = GetTickCount

List1.AddItem EndTime - StartTime
DoEvents

Next M

End Sub
READ MORE - Contoh Fungsi API GetTickCount Dalam VB6