• Tidak ada hasil yang ditemukan

Aplikasi Penjadwalan Laboratorium D3 Teknik Informatika Univeritas Sumatera Utara

N/A
N/A
Protected

Academic year: 2017

Membagikan "Aplikasi Penjadwalan Laboratorium D3 Teknik Informatika Univeritas Sumatera Utara"

Copied!
43
0
0

Teks penuh

(1)

A. Forms

1. frmCetakJadwal

Private Sub cmbPilihan_Click()

If cmbPilihan.Text = "PerKelas" Then

frKelas.Visible = True

muatKelas

frMK.Visible = False

ElseIf cmbPilihan.Text = "PerMata Kuliah" Then

frKelas.Visible = False

frMK.Visible = True

muatMK

Else

frKelas.Visible = False

frMK.Visible = False

End If

End Sub

Private Sub Command1_Click()

End Sub

Private Sub cmdCetak_Click()

If cmbPilihan.Text = "PerKelas" Then

sql = "SELECT * FROM jadwal where kelas='" & cmbKls.Text & "'"

Set rptKelas.DataSource = Adodc1

'Set rptKelas.DataMember = ""

rptKelas.Sections(1).Controls.Item(1).Caption = cmbKls.Text

Adodc1.RecordSource = sql

Adodc1.Refresh

rptKelas.Refresh

rptKelas.Show

ElseIf cmbPilihan.Text = "PerMata Kuliah" Then

sql = "SELECT * FROM jadwal where mata_kuliah='" & cmbMK.Text & "' ORDER

BY kelas"

Set rptMK.DataSource = Adodc1

rptMK.Sections(1).Controls.Item(1).Caption = cmbMK.Text

Adodc1.RecordSource = sql

(2)

rptMK.Refresh

rptMK.Show

Else

MsgBox "Tidak Ada Data yg akan ditampilkan"

End If

End Sub

Private Sub Form_Load()

Call koneksi

Adodc1.ConnectionString = "Driver={MySQL ODBC 5.2w

Driver};SERVER=localhost;PWD=;UID=root;PORT=3306;DATABASE=db_penjadwalan_lab;

"

Adodc1.RecordSource = "jadwal"

Adodc1.Refresh

'Set DataGrid1.DataSource = Adodc1

'DataGrid1.AllowUpdate = False

'DataGrid1.TabStop = False

'DataGrid1.Refresh

End Sub

Sub muatMK()

Dim rsMK As New ADODB.Recordset

rsMK.Open "Select * FROM mata_kuliah ", CN, , , adCmdText

jlh = 0

Do While Not rsMK.EOF

cmbMK.AddItem rsMK!nama_mk

rsMK.MoveNext

Loop

rsMK.Close

End Sub

Sub muatKelas()

Dim rsKelas As New ADODB.Recordset

rsKelas.Open "Select * FROM kelas ", CN, , , adCmdText

jlh = 0

Do While Not rsKelas.EOF

cmbKls.AddItem rsKelas!nama

(3)

Loop

rsKelas.Close

End Sub

Private Sub Image1_Click()

End Sub

1. frmJadwal

Private DbFile As String

Private CN As New ADODB.Connection

Private rs As New ADODB.Recordset

Private rsJadwal As New ADODB.Recordset

Private SQLstmt As String

Private RetVal As Variant

Dim tempID As Variant

Dim tempWkt As Variant

Dim tempMK As Variant

Dim tempKelas As Variant

Dim tempRuang As Variant

Private Sub cmbKelas_Click()

cmbWaktu.Clear

Dim rsWaktu As New ADODB.Recordset

rsWaktu.Open "select hari, jam_mulai, jam_selesai from waktu where not

exists(select waktu from jadwal where left(waktu.hari,3)=left(jadwal.waktu,3)

and waktu.jam_mulai=mid(jadwal.waktu,5,5) and

waktu.jam_selesai=right(jadwal.waktu,5))", CN, , , adCmdText

jlh = 0

Do While Not rsWaktu.EOF

cmbWaktu.AddItem Left(rsWaktu!Hari, 3) & "-" & rsWaktu!jam_mulai & "-" &

rsWaktu!jam_selesai

rsWaktu.MoveNext

Loop

rsWaktu.Close

(4)

Private Sub cmbMk_Click()

cmbKelas.Clear

Dim rsKelas As New ADODB.Recordset

rsKelas.Open "select nama from kelas where not exists(select kelas,

mata_kuliah from jadwal where kelas.nama=jadwal.kelas and jadwal.mata_kuliah

='" & cmbMK.Text & "')", CN, , , adCmdText

jlh = 0

Do While Not rsKelas.EOF

cmbKelas.AddItem rsKelas!nama

rsKelas.MoveNext

Loop

rsKelas.Close

End Sub

Private Sub cmbSemester_Click()

cmbMK.Clear

If cmbSemester.Text = "Semua" Then

'muatMK

Else

Dim rsMK As New ADODB.Recordset

rsMK.Open "Select * FROM mata_kuliah WHERE semester ='" & cmbSemester.Text &

"'", CN, , , adCmdText

jlh = 0

Do While Not rsMK.EOF

cmbMK.AddItem rsMK!nama_mk

rsMK.MoveNext

Loop

rsMK.Close

End If

End Sub

Private Sub cmdBatal_Click()

Adodc1.Refresh

'Form_Load

End Sub

Private Sub cmdHapus_Click()

(5)

MsgBox "Tidak ada Item yg terpilih"

Else

tanya = MsgBox("Yakin akan menghapus Jadwal Kelas" & tempKelas & " ",

vbYesNo, "Hapus Jadwal")

If tanya = vbYes Then

'hapus

prosedur_hapus

cmdBatal_Click

End If

End If

End Sub

Private Sub cmdKeluar_Click()

Unload Me

End Sub

Private Sub cmdSimpan_Click()

'Panggil prosedur simpan

SimpanJadwal

MsgBox "Berhasil disimpan"

Adodc1.Refresh

End Sub

Private Sub DataGrid1_MouseMove(Button As Integer, Shift As Integer, X As

Single, Y As Single)

On Error Resume Next

With rs

tempID = !id

tempWaktu.Text = !waktu

tempWkt = !waktu

tempRuang = !ruang

tempKelas = !kelas

End With

End Sub

Private Sub Form_Load()

Call koneksi

(6)

Open_cn

Set DataGrid1.DataSource = rs

aturTataLetakDgrid

End Sub

Private Sub Open_cn()

Set CN = New ADODB.Connection

CN.CursorLocation = adUseClient

CN.ConnectionString = "Driver={MySQL ODBC 5.2w

Driver};SERVER=localhost;PWD=;UID=root;PORT=3306;DATABASE=db_penjadwalan_lab;

"

CN.Open

'Once this Connection is opened, it can

'be used throughout the application

SQLstmt = "SELECT * FROM jadwal"

'Get the Records

Set rs = New ADODB.Recordset

rs.Open SQLstmt, CN, adLockOptimistic, , adCmdText

End Sub

Sub muatWaktu()

Dim rsWaktu As New ADODB.Recordset

rsWaktu.Open "Select * FROM waktu ", CN, , , adCmdText

jlh = 0

Do While Not rsWaktu.EOF

cmbWaktu.AddItem Left(rsWaktu!Hari, 3) & "-" & rsWaktu!jam_mulai & "-" &

rsWaktu!jam_selesai

rsWaktu.MoveNext

Loop

rsWaktu.Close

End Sub

Sub muatKelas()

Dim rsKelas As New ADODB.Recordset

rsKelas.Open "Select * FROM kelas ", CN, , , adCmdText

jlh = 0

Do While Not rsKelas.EOF

(7)

rsKelas.MoveNext

Loop

rsKelas.Close

End Sub

Sub muatRuang()

Dim rsRuang As New ADODB.Recordset

rsRuang.Open "Select * FROM ruang ", CN, , , adCmdText

jlh = 0

Do While Not rsRuang.EOF

cmbRuang.AddItem rsRuang!nama

rsRuang.MoveNext

Loop

rsRuang.Close

End Sub

Sub SimpanJadwal()

Set rsJadwal = New ADODB.Recordset

rsJadwal.LockType = adLockOptimistic

rsJadwal.CursorType = adOpenDynamic

rsJadwal.Open "SELECT * FROM jadwal", CN, , , adCmdText

With rsJadwal

.AddNew

!id = Null

!waktu = cmbWaktu.Text

!kelas = cmbKelas.Text

!ruang = cmbRuang.Text

!mata_kuliah = cmbMK.Text

.Update

End With

End Sub

Sub isiListview()

Dim lstItem As ListItem, A As Integer

Set rsJadwal = New ADODB.Recordset

rsJadwal.LockType = adLockOptimistic

rsJadwal.CursorType = adOpenDynamic

rsJadwal.Open "SELECT * FROM jadwal", CN, , , adCmdText

(8)

Do While Not rsJadwal.EOF

A = A + 1

Set lstItem = lstJadwal.ListItems.Add(, , A)

lstItem.SubItems(1) = "text"

rsJadwal.MoveNext

Loop

End Sub

Sub aturTataLetakDgrid()

DataGrid1.Columns(0).Width = 0

DataGrid1.Columns(1).Caption = " Waktu"

DataGrid1.Columns(1).Alignment = dbgCenter

DataGrid1.Columns(2).Caption = " Kelas"

DataGrid1.Columns(2).Alignment = dbgCenter

DataGrid1.Columns(3).Caption = " Mata Kuliah"

DataGrid1.Columns(3).Alignment = dbgCenter

DataGrid1.Columns(4).Caption = " Ruang"

DataGrid1.Columns(4).Alignment = dbgCenter

End Sub

Sub prosedur_hapus()

Set rsJadwal = New ADODB.Recordset

rsJadwal.LockType = adLockOptimistic

rsJadwal.CursorType = adOpenDynamic

rsJadwal.Open "DELETE FROM jadwal WHERE id='" & tempID & "'", CN, , ,

adCmdText

End Sub

2. frmKelas

Private Sub cmdBatal_Click()

txtKls.Text = ""

txtJmhs.Text = ""

txtKls.SetFocus

End Sub

Private Sub cmdKeluar_Click()

Unload Me

(9)

Private Sub cmdSimpan_Click()

SimpanKls

MsgBox "Sukses"

cmdBatal_Click

End Sub

Sub SimpanKls()

Set rsKls = New ADODB.Recordset

rsKls.LockType = adLockOptimistic

rsKls.CursorType = adOpenDynamic

rsKls.Open "SELECT * FROM kelas", CN, , , adCmdText

With rsKls

.AddNew

!id = Null

!nama = txtKls.Text

!jlh_mhs = txtJmhs.Text

.Update

End With

End Sub

Private Sub Form_Load()

Call koneksi

End Sub

3. frmMK

Private Sub cmdBatal_Click()

txtMK.Text = ""

cmbSemester.Text = ""

cmbSks.Text = ""

txtDP.Text = ""

End Sub

Private Sub cmdKeluar_Click()

Unload Me

(10)

Private Sub cmdSimpan_Click()

simpanMK

MsgBox "Sukses"

cmdBatal_Click

Adodc1.Refresh

End Sub

Private Sub Form_Load()

Call koneksi

End Sub

Sub simpanMK()

Set rsMK = New ADODB.Recordset

rsMK.LockType = adLockOptimistic

rsMK.CursorType = adOpenDynamic

rsMK.Open "SELECT * FROM mata_kuliah", CN, , , adCmdText

With rsMK

.AddNew

!id = Null

!nama_mk = txtMK.Text

!semester = cmbSemester.Text

!sks = cmbSks.Text

!dosen = txtDP.Text

.Update

End With

End Sub

4. frmWaktu

Dim indeks As Integer

Dim A As Boolean

Dim arrHari(5) As String

Dim arrHari2(5) As String

Dim indeks2 As Integer

Private Sub chkJum_Click()

If chkJum.Value = 1 Then

arrHari2(4) = "Jumat"

(11)

arrHari2(4) = ""

End If

End Sub

Private Sub chkKam_Click()

If chkKam.Value = 1 Then

arrHari2(3) = "Kamis"

Else

arrHari2(3) = ""

End If

End Sub

Private Sub chkRab_Click()

If chkRab.Value = 1 Then

arrHari2(2) = "Rabu"

Else

arrHari2(2) = ""

End If

End Sub

Private Sub chkSab_Click()

If chkSab.Value = 1 Then

arrHari2(5) = "Sabtu"

Else

arrHari2(5) = ""

End If

End Sub

Private Sub chkSel_Click()

If chkSel.Value = 1 Then

arrHari2(1) = "Selasa"

Else

arrHari2(1) = ""

End If

End Sub

(12)

If chkSemua.Value = 1 Then

chkSen.Value = 1

chkSel.Value = 1

chkRab.Value = 1

chkKam.Value = 1

chkJum.Value = 1

chkSab.Value = 1

chkSemua.Caption = "Lepas semua"

Else

chkSen.Value = 0

chkSel.Value = 0

chkRab.Value = 0

chkKam.Value = 0

chkJum.Value = 0

chkSab.Value = 0

chkSemua.Caption = "Semua"

End If

End Sub

Private Sub chkSen_Click()

If chkSen.Value = 1 Then

arrHari2(0) = "senin"

Else

arrHari2(0) = ""

End If

End Sub

Private Sub chkSen_DragOver(Source As Control, X As Single, Y As Single,

State As Integer)

chkSen.Top = Me.Top

chkSen.Left = Me.Left

End Sub

Private Sub cmbJAM_Change()

If Len(cmbJAM.Text) > 2 Then

cmbJAM.Text = Left((cmbJAM.Text), 2)

cmbJAM.SelStart = 2

(13)

cmbJAM.Text = 23

cmbJAM.SelStart = 2

End If

jam = Val(cmbJAM.Text) + 1

cmbMnt.Text = "00"

If Len(jam) < 2 Then

cmbjam2.Text = "0" & jam

Else

cmbjam2.Text = jam

End If

End Sub

Private Sub cmbJAM_Click()

If Len(cmbJAM.Text) > 2 Then

cmbJAM.Text = Left((cmbJAM.Text), 2)

cmbJAM.SelStart = 2

ElseIf Val(cmbJAM.Text) > 23 Then

cmbJAM.Text = 23

cmbJAM.SelStart = 2

End If

jam = Val(cmbJAM.Text) + 1

cmbMnt.Text = "00"

If Len(jam) < 2 Then

cmbjam2.Text = "0" & jam

Else

cmbjam2.Text = jam

End If

End Sub

Private Sub cmbMnt_Change()

If Len(cmbMnt.Text) > 2 Then

cmbMnt.Text = Left((cmbMnt.Text), 2)

cmbMnt.SelStart = 2

ElseIf Val(cmbMnt.Text) > 59 Then

cmbMnt.Text = 59

cmbMnt.SelStart = 2

End If

(14)

If Len(jam) < 2 Then

cmbmnt2.Text = "0" & jam

Else

cmbmnt2.Text = jam

End If

End Sub

Private Sub cmbMnt_Click()

jam = Val(cmbMnt.Text)

If Len(jam) < 2 Then

cmbmnt2.Text = "0" & jam

Else

cmbmnt2.Text = jam

End If

End Sub

Private Sub cmbpil_Click()

If cmbpil.Text = "Hari" Then

pil1.Visible = True

pil2.Visible = False

pil1.Clear

pil1.AddItem "Senin"

pil1.AddItem "Selasa"

pil1.AddItem "Rabu"

pil1.AddItem "Kamis"

pil1.AddItem "Jumat"

pil1.AddItem "Sabtu"

ElseIf cmbpil.Text = "Jam" Then

pil1.Visible = True

pil2.Visible = True

pil1.Clear

pil2.Clear

Setjam2

ElseIf cmbpil.Text = "Hari dan Jam" Then

End If

End Sub

(15)

On Error Resume Next

LV.ListItems.Remove LV.SelectedItem.Index

Dim conn As New ADODB.Connection

Dim rs As New ADODB.Recordset

Set conn = New ADODB.Connection

Set rs = New ADODB.Recordset

conn.Open "Driver={MySQL ODBC 5.2w

Driver};SERVER=localhost;PWD=;UID=root;PORT=3306;DATABASE=db_penjadwalan_lab;

"

conn.Execute "DELETE FROM waktu where hari='" & Hari & "' AND jam_mulai='" &

jam_mulai & "' "

End Sub

Private Sub cmdTambah_Click()

If Len(cmbJAM.Text) > 0 Then

Dim lst As ListItem

Dim Dup(5) As String 'variabel array yg digunakan untuk mengecek duplikasi

data

jam_m = cmbJAM.Text & ":" & cmbMnt.Text

jam_m2 = cmbjam2.Text & ":" & cmbmnt2.Text

'MsgBox jam_m

For hh = 0 To 5

If Len(arrHari2(hh)) <> 0 Then

Dim conn As New ADODB.Connection

Dim rs As New ADODB.Recordset

Set conn = New ADODB.Connection

Set rs = New ADODB.Recordset

conn.Open "Driver={MySQL ODBC 5.2w

Driver};SERVER=localhost;PWD=;UID=root;PORT=3306;DATABASE=db_penjadwalan_lab;

"

rs.Open "SELECT * FROM waktu WHERE hari='" & arrHari2(hh) & "' AND

jam_mulai='" & jam_m & "'", conn

If rs.EOF Then

'MsgBox "data ditemukan"

conn.Execute "INSERT INTO waktu (id, hari, jam_mulai,

jam_selesai, ket) VALUES ('','" & arrHari2(hh) & "','" & cmbJAM.Text & ":" &

cmbMnt.Text & "', '" & cmbjam2.Text & ":" & cmbmnt2.Text & "', '" &

(16)

'Dim lst As ListItem

'Set lst = LV.ListItems.Add

Set lst = LV.ListItems.Add

lst.SubItems(1) = arrHari2(hh)

lst.SubItems(2) = cmbJAM.Text & ":" & cmbMnt.Text

lst.SubItems(3) = cmbjam2.Text & ":" & cmbmnt2.Text

lst.SubItems(4) = txtKet.Text

Else

'redundant data

Dup(hh) = arrHari2(hh) & " " & jam_m & "-" & jam_m2

'MsgBox "Anda menggunakan waktu yg sama, yaitu : " & arrHari2(hh) & "

" & jam_m & "-" & jam_m2 & " sistem secara otomatis hanya menyimpan 1 waktu

yg sama", vbInformation, "Duplikasi waktu"

End If

End If

Next hh

End If

gabung = vbNewLine & ""

No = 1

For R = 0 To 5

If Len(Dup(R)) <> 0 Then

gabung = gabung & No & ". " & Dup(R) & vbNewLine

No = No + 1

End If

Next R

If UBound(Dup) > 1 Then

If Len(gabung) <> 0 Then

'MsgBox "Duplikasi data =>" & gabung + vbNewLine & "Data diatas sudah

pernah disimpan sebelumnya", vbInformation, "Duplikasi Data"

End If

End If

End Sub

Private Sub Command1_Click()

LV.ListItems.Clear

End Sub

(17)

Index = 0

setLV

IsiLV

setJam

Shape3.Top = LV.Top

Shape3.Left = LV.Left

Shape3.Width = LV.Width

Shape3.Height = LV.Height

arrHari(0) = ""

arrHari(1) = ""

arrHari(2) = ""

arrHari(3) = ""

arrHari(4) = ""

arrHari(5) = ""

End Sub

Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single,

Y As Single)

Shape1.Visible = False

Shape2.Visible = False

End Sub

Private Sub Frame1_MouseMove(Button As Integer, Shift As Integer, X As

Single, Y As Single)

'Text1.Text = Frame1.Name

Shape1.Visible = True

Shape1.Top = Frame1.Top

Shape1.Left = Frame1.Left

Shape1.Width = Frame1.Width

Shape1.Height = Frame1.Height

End Sub

Function anim(ctr As Frame)

End Function

Private Sub Frame2_MouseMove(Button As Integer, Shift As Integer, X As

(18)

Shape1.Visible = True

Shape1.Top = Frame2.Top

Shape1.Left = Frame2.Left

Shape1.Width = Frame2.Width

Shape1.Height = Frame2.Height

End Sub

Private Sub chksen_MouseMove(Button As Integer, Shift As Integer, X As

Single, Y As Single)

Shape2.Visible = True

Shape2.Top = chkSen.Top

Shape2.Left = chkSen.Left

Shape2.Width = chkSen.Width

Shape2.Height = chkSen.Height

End Sub

Private Sub chksel_MouseMove(Button As Integer, Shift As Integer, X As

Single, Y As Single)

Shape2.Visible = True

Shape2.Top = chkSel.Top

Shape2.Left = chkSel.Left

Shape2.Width = chkSel.Width

Shape2.Height = chkSel.Height

End Sub

Private Sub chksab_MouseMove(Button As Integer, Shift As Integer, X As

Single, Y As Single)

Shape2.Visible = True

Shape2.Top = chkSab.Top

Shape2.Left = chkSab.Left

Shape2.Width = chkSab.Width

Shape2.Height = chkSab.Height

End Sub

Private Sub chkkam_MouseMove(Button As Integer, Shift As Integer, X As

Single, Y As Single)

Shape2.Visible = True

(19)

Shape2.Left = chkKam.Left

Shape2.Width = chkKam.Width

Shape2.Height = chkKam.Height

End Sub

Private Sub chkjum_MouseMove(Button As Integer, Shift As Integer, X As

Single, Y As Single)

Shape2.Visible = True

Shape2.Top = chkJum.Top

Shape2.Left = chkJum.Left

Shape2.Width = chkJum.Width

Shape2.Height = chkJum.Height

End Sub

Private Sub chkrab_MouseMove(Button As Integer, Shift As Integer, X As

Single, Y As Single)

Shape2.Visible = True

Shape2.Top = chkRab.Top

Shape2.Left = chkRab.Left

Shape2.Width = chkRab.Width

Shape2.Height = chkRab.Height

End Sub

Private Sub chksenin_Click()

End Sub

Sub setLV()

With LV

.View = lvwReport

.GridLines = True

.MultiSelect = True

.FullRowSelect = True

.HotTracking = True

.HoverSelection = True

' tambahkan kolom2 ke, , Judul,lebar,aligment

.ColumnHeaders.Add 1, , "No", 0

.ColumnHeaders.Add 2, , "Hari", 1250

.ColumnHeaders.Add 3, , "Mulai", 1250

(20)

.ColumnHeaders.Add 5, , "Keterangan", 3500

.Width = 7000

End With

End Sub

Sub setJam()

For jam = 0 To 23

If Len(jam) < 2 Then

cmbJAM.AddItem "0" & jam

cmbjam2.AddItem "0" & jam

Else

cmbJAM.AddItem jam

cmbjam2.AddItem jam

End If

Next jam

For menit = 0 To 59

If Len(menit) < 2 Then

cmbMnt.AddItem "0" & menit

cmbmnt2.AddItem "0" & menit

Else

cmbMnt.AddItem menit

cmbmnt2.AddItem menit

End If

Next menit

End Sub

Sub Setjam2()

For jam = 0 To 23

If Len(jam) < 2 Then

pil1.AddItem "0" & jam

pil2.AddItem "0" & jam

Else

pil1.AddItem jam

pil2.AddItem jam

End If

Next jam

(21)

If Len(menit) < 2 Then

pil1.AddItem "0" & menit

pil2.AddItem "0" & menit

Else

pil1.AddItem menit

pil2.AddItem menit

End If

Next menit

End Sub

Private Sub LV_Click()

On Error Resume Next

cmdHapus.Enabled = True

Text1.Text = LV.ListItems(LV.SelectedItem.Index).ListSubItems(1).Text

End Sub

Private Sub txtKet_Change()

lblket.Visible = True

End Sub

Private Sub txtKet_LostFocus()

lblket.Visible = False

End Sub

Sub IsiLV()

LV.ListItems.Clear

On Error Resume Next

Set conn = New ADODB.Connection

Set rs = New ADODB.Recordset

conn.Open "Driver={MySQL ODBC 5.2w

Driver};SERVER=localhost;PWD=;UID=root;PORT=3306;DATABASE=db_penjadwalan_lab;

"

kueri = "SELECT * FROM waktu order by id"

rs.Open kueri, conn

Dim lst As ListItem, NMR As Integer

With rs

LV.ListItems.Clear 'Bersihkan Listview

(22)

Set lst = LV.ListItems.Add

lst.SubItems(1) = rs!Hari

lst.SubItems(2) = rs!jam_mulai

lst.SubItems(3) = rs!jam_selesai

lst.SubItems(4) = rs!ket

rs.MoveNext

Loop

End With

Set rs = Nothing

End Sub

5. menu_utama

Private Sub bg_MouseMove(Button As Integer, Shift As Integer, X As Single, Y

As Single)

Shape1.Visible = False

End Sub

Private Sub btnAdmin_Click()

End

End Sub

Private Sub btnAdmin_MouseMove(Button As Integer, Shift As Integer, X As

Single, Y As Single)

Shape1.Visible = False

With Shape1

.Visible = True

.Top = btnAdmin.Top

.Left = btnAdmin.Left

.Width = btnAdmin.Width

.Height = btnAdmin.Height

End With

End Sub

Private Sub btnCetakJdl_Click()

frmCetakJadwal.Show

(23)

Private Sub btnCetakJdl_MouseMove(Button As Integer, Shift As Integer, X As

Single, Y As Single)

Shape1.Visible = False

With Shape1

.Visible = True

.Top = btnCetakJdl.Top

.Left = btnCetakJdl.Left

.Width = btnCetakJdl.Width

.Height = btnCetakJdl.Height

End With

End Sub

Private Sub btnJdl_Click()

frmJadwal.Show

End Sub

Private Sub btnJdl_MouseMove(Button As Integer, Shift As Integer, X As

Single, Y As Single)

Shape1.Visible = False

With Shape1

.Visible = True

.Top = btnJdl.Top

.Left = btnJdl.Left

.Width = btnJdl.Width

.Height = btnJdl.Height

End With

End Sub

Private Sub btnKelas_Click()

frmKelas.Show

End Sub

Private Sub btnKelas_MouseMove(Button As Integer, Shift As Integer, X As

Single, Y As Single)

Shape1.Visible = False

With Shape1

.Visible = True

(24)

.Left = btnKelas.Left

.Width = btnKelas.Width

.Height = btnKelas.Height

End With

End Sub

Private Sub btnLihJdl_MouseMove(Button As Integer, Shift As Integer, X As

Single, Y As Single)

Shape1.Visible = False

With Shape1

.Visible = True

.Top = btnLihJdl.Top

.Left = btnLihJdl.Left

.Width = btnLihJdl.Width

.Height = btnLihJdl.Height

End With

End Sub

Private Sub btnMK_Click()

frmMK.Show

End Sub

Private Sub btnMK_MouseMove(Button As Integer, Shift As Integer, X As Single,

Y As Single)

Shape1.Visible = False

With Shape1

.Visible = True

.Top = btnMK.Top

.Left = btnMK.Left

.Width = btnMK.Width

.Height = btnMK.Height

End With

End Sub

Private Sub btnRuangan_MouseMove(Button As Integer, Shift As Integer, X As

Single, Y As Single)

Shape1.Visible = False

(25)

.Visible = True

.Top = btnRuangan.Top

.Left = btnRuangan.Left

.Width = btnRuangan.Width

.Height = btnRuangan.Height

End With

End Sub

Private Sub btnTentang_MouseMove(Button As Integer, Shift As Integer, X As

Single, Y As Single)

Shape1.Visible = False

With Shape1

.Visible = True

.Top = btnTentang.Top

.Left = btnTentang.Left

.Width = btnTentang.Width

.Height = btnTentang.Height

End With

End Sub

Private Sub btnwaktu_Click()

frmWaktu.Show

End Sub

Private Sub btnwaktu_MouseMove(Button As Integer, Shift As Integer, X As

Single, Y As Single)

Shape1.Visible = False

With Shape1

.Visible = True

.Top = btnwaktu.Top

.Left = btnwaktu.Left

.Width = btnwaktu.Width

.Height = btnwaktu.Height

End With

End Sub

Private Sub Image5_Click()

(26)

Private Sub Form_Load()

lblTime.Caption = Hari(DateValue(Now)) & ", " & Format(Now, "dd/MM/yyyy")

Label3.Caption = TimeValue(Now)

End Sub

Private Sub imgCetakJdl_Click()

frmCetakJadwal.Show

End Sub

Private Sub imgjdl_Click()

frmJadwal.Show

End Sub

Private Sub imgkelas_Click()

frmKelas.Show

End Sub

Private Sub imgMK_Click()

frmMK.Show

End Sub

Private Sub imgwaktu_Click()

frmWaktu.Show

End Sub

Private Sub lblCetakJdl_Click()

frmCetakJadwal.Show

End Sub

Private Sub lblJdl_Click()

frmJadwal.Show

End Sub

Private Sub lblKelas_Click()

frmKelas.Show

(27)

Private Sub lblMK_Click()

frmMK.Show

End Sub

Private Sub lblwaktu_Click()

frmWaktu.Show

End Sub

Private Sub Timer1_Timer()

lblTime.Caption = Hari(DateValue(Now)) & ", " & Format(Now, "dd/MM/yyyy")

Label3.Caption = TimeValue(Now)

End Sub

Public Function Hari(ByVal Tanggal As Date) As String

Select Case Weekday(Tanggal)

Case 1: Hari = "Minggu"

Case 2: Hari = "Senin"

Case 3: Hari = "Selasa"

Case 4: Hari = "Rabu"

Case 5: Hari = "Kamis"

Case 6: Hari = "Jum'at"

Case 7: Hari = "Sabtu"

End Select

End Function

Public Function bulan(ByVal bln As Date) As String

Select Case MonthName(bln)

Case 1: bulan = "Januari"

Case 2: bulan = "Februari"

Case 3: bulan = "Maret"

Case 4: bulan = "April"

Case 5: bulan = "Mei"

Case 6: bulan = "Juni"

Case 7: bulan = "Juli"

Case 8: bulan = "Agustus"

Case 9: bulan = "September"

Case 10: bulan = "Oktober"

Case 11: bulan = "November"

(28)

End Select

End Function

B. Modules

1. Koneksi Database

Option Explicit

Public CN As New ADODB.Connection

Public CN2 As New ADODB.Connection

Dim rsJadwal As ADODB.Recordset

Dim rsWaktu As ADODB.Recordset

Dim rsMK As ADODB.Recordset

Public ID_global As Variant

Sub koneksi()

Dim Reply As VbMsgBoxResult

On Error GoTo ERR_CONNECTION

Set CN = New ADODB.Connection

CN.CursorLocation = adUseClient

CN.ConnectionString = "Driver={MySQL ODBC 5.2w

Driver};SERVER=localhost;PWD=;UID=root;PORT=3306;DATABASE=db_penjadwalan_lab;

"

CN.Open

Exit Sub

ERR_CONNECTION:

Reply = MsgBox("Error Number:" & Err.Number & vbNewLine & "Description:" &

Err.Description, vbExclamation + vbRetryCancel, "Connection Failure")

End Sub

Sub ClosemySQL()

CN.Close

Set CN = Nothing

End Sub

2. Interface

Option Explicit

'***************************************************************

'*** This module allows usage of the Mouse Scroll Wheel. ***

(29)

'*** the a DataGrid Item must have the Focus. ***

'*** This is achieved by Highlighting the left most column ***

'*** of the DataGrid Control i.e, where the arrow is on ***

'*** program startup. ***

'***************************************************************

Public Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA"

(ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long

Public Declare Function CallWindowProc Lib "user32" Alias "CallWindowProcA"

(ByVal lpPrevWndFunc As Long, ByVal hwnd As Long, ByVal Msg As Long, ByVal

wParam As Long, ByVal lParam As Long) As Long

Public Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory"

(Destination As Any, Source As Any, ByVal Length As Long)

Public Const GWL_WNDPROC = (-4)

Public lpPrevWndProc As Long

Const WM_MOUSEWHEEL = &H20A

Const WHEEL_DELTA = 120

Dim Count As Integer

Function WndProc(ByVal hwnd As Long, ByVal Msg As Long, ByVal wParam As Long,

ByVal lParam As Long) As Long

If Msg = WM_MOUSEWHEEL Then

Dim Delta As Long

Static Travel As Long

Delta = HiWord(wParam)

Travel = Travel + Delta

MouseWheel Travel \ WHEEL_DELTA, LoWord(lParam), HiWord(lParam)

Travel = Travel Mod WHEEL_DELTA

End If

WndProc = CallWindowProc(lpPrevWndProc, hwnd, Msg, wParam, lParam)

End Function

Function HiWord(DWord As Long) As Integer

CopyMemory HiWord, ByVal VarPtr(DWord) + 2, 2

(30)

Function LoWord(DWord As Long) As Integer

CopyMemory LoWord, DWord, 2

End Function

Sub MouseWheel(Travel As Integer, X As Long, Y As Long)

'Scroll one row per wheel step.

'To scroll more than 1 row per step change the next

'line to:

'YourFormsName.DataGrid1.Scroll 0, -Travel * NumberOfRowsDesired

frmPenjadwalan.DataGrid1.Scroll 0, -Travel * 1

End Sub

C. User Controls

1. UcProgresCircular

Option Explicit

'---

'Autor: Leandro Ascierto

'Web: www.leandroascierto.com.ar

'Date: 23/11/2010

'---

Private Declare Function GdipCreateFromHDC Lib "gdiplus" (ByVal hdc As Long,

ByRef graphics As Long) As Long

Private Declare Function GdipDeleteGraphics Lib "gdiplus" (ByVal graphics As

Long) As Long

Private Declare Function GdiplusStartup Lib "gdiplus" (Token As Long,

inputbuf As GDIPlusStartupInput, Optional ByVal outputbuf As Long = 0) As

Long

Private Declare Function GdiplusShutdown Lib "gdiplus" (ByVal Token As Long)

As Long

Private Declare Function GdipSetSmoothingMode Lib "GdiPlus.dll" (ByVal

mGraphics As Long, ByVal mSmoothingMode As Long) As Long

Private Declare Function GdipDrawLine Lib "GdiPlus.dll" (ByVal mGraphics As

Long, ByVal mPen As Long, ByVal mX1 As Single, ByVal mY1 As Single, ByVal mX2

As Single, ByVal mY2 As Single) As Long

Private Declare Function GdipCreatePen1 Lib "GdiPlus.dll" (ByVal mColor As

Long, ByVal mWidth As Single, ByVal mUnit As Long, ByRef mPen As Long) As

(31)

Private Declare Function GdipDeletePen Lib "GdiPlus.dll" (ByVal mPen As Long)

As Long

Private Declare Function GdipSetPenStartCap Lib "gdiplus" (ByVal pen As Long,

ByVal startCap As LineCap) As Long

Private Declare Function GdipSetPenEndCap Lib "gdiplus" (ByVal pen As Long,

ByVal endCap As LineCap) As Long

Private Declare Function OleTranslateColor Lib "oleaut32.dll" (ByVal

lOleColor As Long, ByVal lHPalette As Long, ByVal lColorRef As Long) As Long

Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory"

(Destination As Any, Source As Any, ByVal Length As Long)

'---GDI PLUS SAFE MODE (By LaVolpe)

Private Declare Function CreateWindowExA Lib "user32.dll" (ByVal dwExStyle As

Long, ByVal lpClassName As String, ByVal lpWindowName As String, ByVal

dwStyle As Long, ByVal X As Long, ByVal Y As Long, ByVal nWidth As Long,

ByVal nHeight As Long, ByVal hWndParent As Long, ByVal hMenu As Long, ByVal

hInstance As Long, ByRef lpParam As Any) As Long

Private Declare Sub RtlMoveMemory Lib "kernel32" (ByVal Destination As Long,

ByVal Source As Long, ByVal Length As Long)

Private Declare Function VirtualAlloc Lib "kernel32" (ByVal lpAddress As

Long, ByVal dwSize As Long, ByVal flAllocationType As Long, ByVal flProtect

As Long) As Long

Private Declare Function VirtualFree Lib "kernel32" (ByVal lpAddress As Long,

ByVal dwSize As Long, ByVal dwFreeType As Long) As Long

Private Declare Function GetModuleHandleA Lib "kernel32" (ByVal lpModuleName

As String) As Long

Private Declare Function GetProcAddress Lib "kernel32" (ByVal hModule As

Long, ByVal lpProcName As String) As Long

Private Declare Function LoadLibrary Lib "kernel32.dll" Alias "LoadLibraryA"

(ByVal lpLibFileName As String) As Long

Private Declare Function SetWindowLong Lib "user32.dll" Alias

"SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong

As Long) As Long

Private Declare Function GetParent Lib "user32.dll" (ByVal hwnd As Long) As

Long

Private Declare Function GetWindow Lib "user32.dll" (ByVal hwnd As Long,

(32)

Private Declare Function FindWindowEx Lib "user32.dll" Alias "FindWindowExA"

(ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2

As String) As Long

Private Declare Function VarPtrArray Lib "msvbvm60.dll" Alias "VarPtr" (Ptr()

As Any) As Long

Private Const GWL_WNDPROC As Long = -4

Private Const GW_OWNER As Long = 4

Private Const WS_CHILD As Long = &H40000000

'---

Private Type GDIPlusStartupInput

GdiPlusVersion As Long

DebugEventCallback As Long

SuppressBackgroundThread As Long

SuppressExternalCodecs As Long

End Type

Public Enum LineCap

LineCapFlat = &H0

LineCapSquare = &H1

LineCapRound = &H2

LineCapTriangle = &H3

LineCapNoAnchor = &H10

LineCapSquareAnchor = &H11

LineCapRoundAnchor = &H12

LineCapDiamondAnchor = &H13

LineCapArrowAnchor = &H14

End Enum

Public Enum enuNumberOfLines

FortyEightLines = &H0

TwentyFourLines = &H1

TwelveLines = &H2

EightLine = &H3

SixtLine = &H4

FourLine = &H5

(33)

Private Const SmoothingModeAntiAlias As Long = &H4

Private Const UnitPixel As Long = &H2

Private Const PI180 = 3.14159 / 180

'Private GdipToken As Long

Private CurrentPos As Long

Private mDrawWidth As Long

Private mBackColor As OLE_COLOR

Private mForeColor As OLE_COLOR

Private mLineStart As LineCap

Private mLineEnd As LineCap

Private mTotalLines As Long

Private mNumberOfLines As enuNumberOfLines

Private mInterval As Long

Public Property Get NumberOfLines() As enuNumberOfLines

NumberOfLines = mNumberOfLines

End Property

Public Property Let NumberOfLines(ByVal lngNumber As enuNumberOfLines)

Select Case lngNumber

Case FortyEightLines: mTotalLines = 7.5

Case TwentyFourLines: mTotalLines = 15

Case TwelveLines: mTotalLines = 30

Case EightLine: mTotalLines = 45

Case SixtLine: mTotalLines = 60

Case FourLine: mTotalLines = 90

Case Else

lngNumber = TwelveLines

mTotalLines = 12

End Select

mNumberOfLines = lngNumber

PropertyChanged "NumberOfLines"

Call Draw

(34)

Public Property Get Interval() As Long

Interval = mInterval

End Property

Public Property Let Interval(ByVal lngValue As Long)

mInterval = lngValue

PropertyChanged "Interval"

If Ambient.UserMode Then

Timer1.Interval = lngValue

End If

End Property

Public Property Get ForeColor() As OLE_COLOR

ForeColor = mForeColor

End Property

Public Property Let ForeColor(ByVal lngForeColor As OLE_COLOR)

mForeColor = lngForeColor

PropertyChanged "ForeColor"

Call Draw

End Property

Public Property Get BackColor() As OLE_COLOR

BackColor = mBackColor

End Property

Public Property Let BackColor(ByVal lngBackColor As OLE_COLOR)

mBackColor = lngBackColor

UserControl.BackColor = mBackColor

PropertyChanged "BackColor"

Call Draw

End Property

Public Property Get LineStart() As LineCap

LineStart = mLineStart

(35)

Public Property Let LineStart(ByVal enuLineStart As LineCap)

mLineStart = enuLineStart

PropertyChanged "LineStart"

Call Draw

End Property

Public Property Get LineEnd() As LineCap

LineEnd = mLineEnd

End Property

Public Property Let LineEnd(ByVal enuLineEnd As LineCap)

mLineEnd = enuLineEnd

PropertyChanged "LineEnd"

Call Draw

End Property

Public Property Get DrawWidth() As Long

DrawWidth = mDrawWidth

End Property

Public Property Let DrawWidth(ByVal lDrawWidth As Long)

mDrawWidth = lDrawWidth

PropertyChanged "DrawWidth"

Call Draw

End Property

Private Sub UserControl_Initialize()

'InitGDI

CurrentPos = 360

UserControl.ScaleMode = vbPixels

UserControl.AutoRedraw = True

End Sub

Private Sub UserControl_InitProperties()

mLineStart = LineCapRound

mLineEnd = LineCapRound

mBackColor = Ambient.BackColor

(36)

mForeColor = Ambient.ForeColor

mInterval = 100

mDrawWidth = 6

Me.NumberOfLines = TwelveLines

Call ManageGDIToken(UserControl.ContainerHwnd)

End Sub

Private Sub UserControl_ReadProperties(PropBag As PropertyBag)

Call ManageGDIToken(UserControl.ContainerHwnd)

With PropBag

mForeColor = .ReadProperty("ForeColor", vbWindowText)

mBackColor = .ReadProperty("BackColor", vbButtonFace)

mLineStart = .ReadProperty("LineStart", LineCapRound)

mLineEnd = .ReadProperty("Lineend", LineCapRound)

mDrawWidth = .ReadProperty("DrawWidth", 6)

mInterval = .ReadProperty("Interval", 100)

UserControl.BackColor = mBackColor

Me.NumberOfLines = .ReadProperty("NumberOfLines", TwelveLines) 'And

call Draw

End With

If Ambient.UserMode Then

Timer1.Interval = mInterval

End If

End Sub

Private Sub UserControl_WriteProperties(PropBag As PropertyBag)

With PropBag

.WriteProperty "BackColor", mBackColor, vbButtonFace

.WriteProperty "ForeColor", mForeColor, vbWindowText

.WriteProperty "LineStart", mLineStart, LineCapRound

.WriteProperty "LineEnd", mLineEnd, LineCapRound

.WriteProperty "DrawWidth", mDrawWidth, 6

.WriteProperty "NumberOfLines", mNumberOfLines, TwelveLines

.WriteProperty "Interval", mInterval, 100

End With

(37)

Private Sub UserControl_Resize()

If UserControl.ScaleWidth > UserControl.ScaleHeight Then

UserControl.Height = UserControl.Width

Else

UserControl.Width = UserControl.Height

End If

Draw

End Sub

Private Sub UserControl_Terminate()

'TerminateGDI

End Sub

Private Sub Draw()

Dim lPercent As Long

Dim hGraphics As Long

Dim hPen As Long

Dim i As Long

Dim SL As Single, ST As Single

Dim S As Single, C As Single

Dim MidSize As Single, Size As Single

UserControl.Cls

If GdipCreateFromHDC(UserControl.hdc, hGraphics) = 0 Then

Call GdipSetSmoothingMode(hGraphics, SmoothingModeAntiAlias)

If mLineEnd = LineCapDiamondAnchor Or mLineEnd = LineCapRoundAnchor

Then

MidSize = mDrawWidth

Else

MidSize = (mDrawWidth / 2)

End If

Size = (UserControl.ScaleWidth / 2) - MidSize - 1

SL = Size + MidSize

ST = Size + MidSize

(38)

For i = 360 To mTotalLines Step -mTotalLines

S = Sin(i * PI180)

C = Cos(i * PI180)

lPercent = ((CurrentPos + i + 20) Mod 360) * 100 / 360

lPercent = lPercent * 255 / 100

GdipCreatePen1 CombineColors(mForeColor, mBackColor, lPercent),

mDrawWidth, UnitPixel, hPen

GdipSetPenStartCap hPen, mLineStart

GdipSetPenEndCap hPen, mLineEnd

Call GdipDrawLine(hGraphics, hPen, SL + (S * MidSize), ST - (C *

MidSize), S * Size + SL, -C * Size + ST)

GdipDeletePen hPen

Next i

GdipDeleteGraphics hGraphics

End If

UserControl.Refresh

End Sub

'Función para combinar dos colores y asignar el color alpha.

Private Function CombineColors(ByVal clrFirst As Long, ByVal clrSecond As

Long, ByVal lPercent As Long, Optional ByVal lAlpha As Long = 255) As Long

Dim clrFore(3) As Byte

Dim clrBack(3) As Byte

Dim clrFinal(3) As Byte

OleTranslateColor clrFirst, 0, VarPtr(clrFore(0))

OleTranslateColor clrSecond, 0, VarPtr(clrBack(0))

clrFinal(0) = (clrFore(2) * lPercent + clrBack(2) * (255 - lPercent)) /

255

clrFinal(1) = (clrFore(1) * lPercent + clrBack(1) * (255 - lPercent)) /

255

clrFinal(2) = (clrFore(0) * lPercent + clrBack(0) * (255 - lPercent)) /

255

clrFinal(3) = lAlpha

CopyMemory CombineColors, clrFinal(0), 4

End Function

(39)

Private Sub Timer1_Timer()

CurrentPos = CurrentPos - 30

If CurrentPos <= 0 Then CurrentPos = 360

Draw

End Sub

'Private Sub InitGDI()

' Dim GdipStartupInput As GDIPlusStartupInput

' GdipStartupInput.GdiPlusVersion = 1&

' Call GdiplusStartup(GdipToken, GdipStartupInput, ByVal 0)

'End Sub

'---

'Private Sub TerminateGDI()

' If GdipToken Then Call GdiplusShutdown(GdipToken)

'End Sub

'---

'GDI Plus Safe Mode (By LaVolpe)

'Avira Antivir detecta este codigo como malicioso, asi que no preocuparse

porque es inofencivo.

'puede ser subplantado por las funciones InitGDI y TerminateGDI pero es

recomendable avilitarlas solo cuando se compile el proyecto.

Private Function ManageGDIToken(ByVal projectHwnd As Long) As Long

If projectHwnd = 0& Then Exit Function

Dim hwndGDIsafe As Long 'API window to monitor IDE

shutdown

Do

hwndGDIsafe = GetParent(projectHwnd)

If Not hwndGDIsafe = 0& Then projectHwnd = hwndGDIsafe

Loop Until hwndGDIsafe = 0&

' ok, got the highest level parent, now find highest level owner

Do

hwndGDIsafe = GetWindow(projectHwnd, GW_OWNER)

(40)

Loop Until hwndGDIsafe = 0&

hwndGDIsafe = FindWindowEx(projectHwnd, 0&, "Static", "GDI+Safe Patch")

If hwndGDIsafe Then

ManageGDIToken = hwndGDIsafe ' we already have a manager running

for this VB instance

Exit Function ' can abort

End If

Dim gdiSI As GDIPlusStartupInput 'GDI+ startup info

Dim gToken As Long 'GDI+ instance token

On Error Resume Next

gdiSI.GdiPlusVersion = 1 ' attempt to start GDI+

GdiplusStartup gToken, gdiSI

If gToken = 0& Then ' failed to start

If Err Then Err.Clear

Exit Function

End If

On Error GoTo 0

Dim z_ScMem As Long 'Thunk base address

Dim z_Code() As Long 'Thunk machine-code

initialised here

Dim nAddr As Long 'hwndGDIsafe prev window

procedure

Const WNDPROC_OFF As Long = &H30 'Offset where window proc

starts from z_ScMem

Const PAGE_RWX As Long = &H40& 'Allocate executable memory

Const MEM_COMMIT As Long = &H1000& 'Commit allocated memory

Const MEM_RELEASE As Long = &H8000& 'Release allocated memory

flag

Const MEM_LEN As Long = &HD4 'Byte length of thunk

z_ScMem = VirtualAlloc(0, MEM_LEN, MEM_COMMIT, PAGE_RWX) 'Allocate

(41)

If z_ScMem <> 0 Then 'Ensure the

allocation succeeded

' we make the api window a child so we can use FindWindowEx to locate

it easily

hwndGDIsafe = CreateWindowExA(0&, "Static", "GDI+Safe Patch",

WS_CHILD, 0&, 0&, 0&, 0&, projectHwnd, 0&, App.hInstance, ByVal 0&)

If hwndGDIsafe <> 0 Then

ReDim z_Code(0 To MEM_LEN \ 4 - 1)

z_Code(12) = &HD231C031: z_Code(13) = &HBBE58960: z_Code(14) =

&H12345678: z_Code(15) = &H3FFF631: z_Code(16) = &H74247539: z_Code(17) =

&H3075FF5B: z_Code(18) = &HFF2C75FF: z_Code(19) = &H75FF2875

z_Code(20) = &H2C73FF24: z_Code(21) = &H890853FF: z_Code(22) =

&HBFF1C45: z_Code(23) = &H2287D81: z_Code(24) = &H75000000: z_Code(25) =

&H443C707: z_Code(26) = &H2&: z_Code(27) = &H2C753339: z_Code(28) =

&H2047B81: z_Code(29) = &H75000000

z_Code(30) = &H2C73FF23: z_Code(31) = &HFFFFFC68: z_Code(32) =

&H2475FFFF: z_Code(33) = &H681C53FF: z_Code(34) = &H12345678: z_Code(35) =

&H3268&: z_Code(36) = &HFF565600: z_Code(37) = &H43892053: z_Code(38) =

&H90909020: z_Code(39) = &H10C261

z_Code(40) = &H562073FF: z_Code(41) = &HFF2453FF: z_Code(42) =

&H53FF1473: z_Code(43) = &H2873FF18: z_Code(44) = &H581053FF: z_Code(45) =

&H89285D89: z_Code(46) = &H45C72C75: z_Code(47) = &H800030: z_Code(48) =

&H20458B00: z_Code(49) = &H89145D89

z_Code(50) = &H81612445: z_Code(51) = &H4C4&: z_Code(52) =

&HC63FF00

z_Code(1) = 0 '

shutDown mode; used internally by ASM

z_Code(2) = zFnAddr("user32", "CallWindowProcA") '

function pointer CallWindowProc

z_Code(3) = zFnAddr("kernel32", "VirtualFree") '

function pointer VirtualFree

z_Code(4) = zFnAddr("kernel32", "FreeLibrary") '

(42)

z_Code(5) = gToken '

Gdi+ token

z_Code(10) = LoadLibrary("gdiplus") '

library pointer (add reference)

z_Code(6) = GetProcAddress(z_Code(10), "GdiplusShutdown") '

function pointer GdiplusShutdown

z_Code(7) = zFnAddr("user32", "SetWindowLongA") '

function pointer SetWindowLong

z_Code(8) = zFnAddr("user32", "SetTimer") '

function pointer SetTimer

z_Code(9) = zFnAddr("user32", "KillTimer") '

function pointer KillTimer

z_Code(14) = z_ScMem '

ASM ebx start point

z_Code(34) = z_ScMem + WNDPROC_OFF '

subclass window procedure location

RtlMoveMemory z_ScMem, VarPtr(z_Code(0)), MEM_LEN

'Copy the thunk code/data to the allocated memory

nAddr = SetWindowLong(hwndGDIsafe, GWL_WNDPROC, z_ScMem +

WNDPROC_OFF) 'Subclass our API window

RtlMoveMemory z_ScMem + 44, VarPtr(nAddr), 4& ' Add prev window

procedure to the thunk

gToken = 0& ' zeroize so final check below does not release it

ManageGDIToken = hwndGDIsafe ' return handle of our GDI+

manager

Else

VirtualFree z_ScMem, 0, MEM_RELEASE ' failure - release

memory

z_ScMem = 0&

End If

Else

VirtualFree z_ScMem, 0, MEM_RELEASE ' failure - release

memory

(43)

End If

If gToken Then GdiplusShutdown gToken ' release token if error

occurred

End Function

Private Function zFnAddr(ByVal sDLL As String, ByVal sProc As String) As Long

zFnAddr = GetProcAddress(GetModuleHandleA(sDLL), sProc) 'Get the

specified procedure address

Referensi

Dokumen terkait

Kata kunci: Perkawinan, Adat Jawa,dan Muharram. Penelitian ini terfokus pada masyarakat yang menjalankan tradisi larangan menikah pada bulan Muharram. Adapun fokus penelitian

Serotipe ini memiliki struktur filogentik yang berbeda, menghasilkan rangkaian antibodi yang khas, dan titer virus 4 kali lebih tinggi pada infeksi sekunder

Hasil penelitian setelah dilakukan mandi dengan air hangat terhadap kualitas tidur lansia pada kelompok eksperimen, tingkat kualitas tidur lansia terlihat menurun,

Rekam medis tidak hanya sekedar mempunyai pengertian sebagai kegiatan pencatatan saja, akan tetapi mempunyai pengertian sebagai suatu sistem penyelenggaraan rekam medis penelitian

bahwa tertib Inventarisasi Barang Daerah akan tercapai apabila diikuti dengan usaha menertibkan administrasi pada pelaksanaan setiap tahap siklus administrasi

Kepuasan pasien dalam pelayanan kesehatan sangat penting untuk diperhatikan karena dapat menggambarkan kualitas pelayanan kesehatan tersebut.Mengetahui kepuasan pasien

Pendidikan Tinggi sebagaimaria diatur daram suiat Keputusan pimpinan Pusat Muhammadiyah Nomor r70lKEpir.0/B/20id';entang penetapan Nornenklatur Unsur pernbantu pirnpina,

Hasil penelitian adalah sebagai berikut; (1) bahwa gaya kepemimpinan situasional kepala sekolah berpengaruh positif terhadap komitmen organisasi guru di SMK Pasundan 1 Kota