Sabtu, 24 Desember 2011
IRONIS,, SYIAH DIBILANG SESAT
Allah ta’ala berfirman:
يَا أَيُّهَا الَّذِينَ آمَنُوا كُونُوا أَنْصَارَ اللَّهِ كَمَا قَالَ عِيسَى ابْنُ مَرْيَمَ لِلْحَوَارِيِّينَ مَنْ أَنْصَارِي إِلَى اللَّهِ قَالَ الْحَوَارِيُّونَ نَحْنُ أَنْصَارُ اللَّهِ فَآمَنَتْ طَائِفَةٌ مِنْ بَنِي إِسْرَائِيلَ وَكَفَرَتْ طَائِفَةٌ فَأَيَّدْنَا الَّذِينَ آمَنُوا عَلَى عَدُوِّهِمْ فَأَصْبَحُوا ظَاهِرِينَ
Hai orang-orang yang beriman, jadilah kamu penolong-penolong (agama) Allah sebagaimana Isa putra Maryam telah berkata kepada pengikut-pengikutnya yang setia: "Siapakah yang akan menjadi penolong-penolongku (untuk menegakkan agama) Allah?" Pengikut-pengikut yang setia itu berkata: "Kami lah penolong-penolong agama Allah", lalu segolongan dari Bani Israel beriman dan segolongan (yang lain) kafir; maka kami berikan kekuatan kepada orang-orang yang beriman terhadap musuh-musuh mereka, lalu mereka menjadi orang-orang yang menang. (as-shoff : 14)
syi'ah meyakini bahwa imam mereka itu seperti tuhan yang jika mereka berkehendak untuk mengetahui, maka mereka pasti mengetahuinya
Al Kulaini meriwayatkan di Al Kafi : Bab "Sesungguhnya para imam, jika mereka berkehendak untuk mengetahui, maka mereka pastimengetahuinya". Dari Jafar ia berkata : "Sesungguhnya Imam jika ia berkehendak mengetahui, maka ia pasti mengetahui, dan sesungguhnya para imam mengetahui kapan mereka akan mati, dan sesungguhnya mereka tidak akan mati kecuali dengan pilihan mereka sendiri."
Usulul_Kafi, di dalam kitabul Hujjah : (1/258).
atas terbunuhnya Faruq Umar bin Khottob syi'ah rofidhoh didalam kitab mereka memberi nama pembunuh umar yaitu abu Lukluk al Majusi dengan nama "Baba Syujaa'uddin" (bapak) "pemberani dalam agama" (pahlawan agama)
Abbas Al Qummi, (Alkuna wal Alqaab) 2/55.
Kenapa Syi'ah Dinamakan Dengan Rofidhoh ?
Penamaan ini disebutkan oleh syeikh mereka Al Majlisi dalam bukunya "Al
Bihaar"
Ada yang mengatakan : mereka dinamakan rofidhoh, karena mereka datang ke Zaid bin Ali bin Husein, lalu mereka berkata : "Berlepas dirilah kamu dari Abu Bakr dan Umar sehingga kami bisa bersamamu!", lalu beliau menjawab :
"Mereka berdua (Abu Bakr dan Umar) adalah sahabat kakekku, bahkan aku setia kepada mereka". Mereka berkata : "Kalau begitu, kami menolakmu (rofadhnaak) maka dinamakanlah mereka Rofidhoh (yang menolak), dan orang yang membai'at dan sepakat dengan Zaid bin Ali bin Husein disebut Zaidiyah
Lihat buku : Al Bihaar, oleh Al Majlisi, hal : 68-96-97. (Dia ini merupakan salah seorang tempat bertanya orang-orang rafidhah (syi'ah) untuk zaman-zaman terakhir).
dinukil dari : At Ta'liiqaatu 'Ala Matni Lum'atil 'Itiqaad, oleh : Syeikh Alaamah Abdullah bin Abdurrahman Al Jibrin, hal : 108.
SYIAH MELAKNAT PARA SAHABAT DAN ISTRI NABI
Syi'ah meyakini bahwa para Sahabat sepeninggal Nabi shollallahu 'alaihi wasallam, mereka murtad, kecuali beberapa orang saja, seperti: Al-Miqdad bin Al-Aswad, Abu Dzar Al-Ghifary dan Salman Al-Farisy (Ar Raudhah minal Kafi juz VIII hal.245, Al-Ushul minal Kafi juz II hal 244)
Al Kulaini (salah seorang pentolan Syi’ah ) menyebutkan sebuah hadits dari Zurarah dari Abu Abdillah ‘alaihissalaam perihal pernikahan Ummu Kultsum putri 'ali bin abi tholib dengan sahabat umar bin khotthob, ia berkata: “Sesungguhnya itu adalah kemaluan yang telah dirampas dari kami.”
Silahkan baca Al Kafi dalam bab: Furu’ juz 2 halaman 141, edisi India.
pelecehan 'ulama' syi'ah terhadap 'aisyah rodhiallahu 'anha dan keyakinan mereka tentang salah satu sifat imam mahdi :
Berkata Al Majlisi di dalam Kitab "Haqul Yakin" dari Muhammad Al Baqir (berkata) :
"Jika Al Mahdi telah keluar, maka sesungguhnya ia akan menghidupkan 'Aisyah Ummul Mukminin dan ia melaksanakan (menjatuhkan) hukum had (hudud) atas diri Aisyah"
Haqul Yakiin, oleh Muhammad Al Baqir Al Majlisi, hal : 347.
Al-Imam Al-Auza’i rohimahullah berkata:
“Ilmu adalah apa yang telah datang dari shahabat-shahabat Nabi Muhammad shollallahu 'alaihi wasallam. Dan sesuatu yang tidak datang dari mereka tidaklah dinamakan ilmu.”
(Jami’u Bayanil ‘Ilmi wa Fadhlih, 1/29)
maka kita tidak sedikitpun mengatakan syi'ah rofidhoh diatas 'ilmu karena mereka tidak mengambil perkataan dari para sahabat nabi shollallahu 'alaihi wasallam..
ingatkanlah akan saudara-saudara kita yang PKS hari ini, mereka banyak mengagungkan dan memuji ahmadinejad dan memuji iran..
saudara-saudara HAMMAS di palestina bersekongkol dengan iran dan banyak aktivis PKS mengagumi iran...
ingatkan terus bahaya syi'ah ya ikhwan...nyatakan perang terhadap mereka yang mengkafirkan sahabat-sahabat nabi dan melecehkan ahlul bait rosulullah dengan slogan seakan-akan cinta ahlul bait tapi menikam ahlul bait dari dalam..
wahai qoum muslimin betapa banyak para sahabat dikafirkan syi'ah..? masihkah kalian mengakui syi'ah adalah bagian dari Islam..?
WAHABI “ SESAT “
Berpikir sebelum membaca dan pahami setelahnya agar kita tahu siapa itu wahabi??
إنَّ الحَمْدَ لله، نَحْمَدُه، ونستعينُه، ونستغفرُهُ، ونعوذُ به مِن شُرُورِ أنفُسِنَا، وَمِنْ سيئاتِ أعْمَالِنا، مَنْ يَهْدِه الله فَلا مُضِلَّ لَهُ، ومن يُضْلِلْ، فَلا هَادِي لَهُ. وأَشْهَدُ أنْ لا إلَهَ إلا اللهُ وَحْدَهُ لا شَرِيكَ لَهُ، وأشهدُ أنَّ مُحَمَّدًا عبْدُه ورَسُولُه.
قال الله تعالى:﴿يَاأَيُّهَا الَّذِينَ آمَنُوا اتَّقُوا الله حَقَّ تُقَاتِهِ وَلا تَمُوتُنَّ إِلا وَأَنْتُمْ مُسْلِمُونَ﴾
﴿يَاأَيُّهَا النَّاسُ اتَّقُوا رَبَّكُمُ الَّذِي خَلَقَكُمْ مِنْ نَفْسٍ وَاحِدَةٍ وَخَلَقَ مِنْهَا زَوْجَهَا وَبَثَّ مِنْهُمَا رِجَالا كَثِيرًا وَنِسَاءً وَاتَّقُوا الله الَّذِي تَسَاءَلُونَ بِهِ وَالأرْحَامَ إِنَّ الله كَانَ عَلَيْكُمْ رَقِيبًا﴾
﴿يَاأَيُّهَا الَّذِينَ آمَنُوا اتَّقُوا الله وَقُولُوا قَوْلا سَدِيدًا * يُصْلِحْ لَكُمْ أَعْمَالَكُمْ وَيَغْفِرْ لَكُمْ ذُنُوبَكُمْ وَمَنْ يُطِعِ الله وَرَسُولَهُ فَقَدْ فَازَ فَوْزًا عَظِيمًا﴾
أما بعد,
Sesungguhnya diantara musibah terbesar yang menimpa umat Islam adalah timbulnya perpecahan di antara mereka. Perpecahan seperti ini akan melemahkan kekuatan umat Islam, menyenangkan hati musuh-musuh Islam dan membuat peluang bagi mereka untuk mencabik-cabik persatuan umat Islam yang dengannya mereka dapat menjalankan misi mereka untuk memerangi umat Islam. Rasulullah Shallallahu ‘Alaihi Wasallam yang sangat menginginkan kebaikan kepada umatnya telah memperingatkan umatnya akan hal ini agar mereka menjauhinya sebagaimana
beliau Shallallahu ‘Alaihi Wasallam bersabda yang diriwayatkan oleh ‘Irbath bin Sariyah :
صَلَّى بِنَا رَسُولُ الله r ذَاتَ يَوْمٍ ثُمَّ أَقْبَلَ عَلَيْنَا فَوَعَظَنَا مَوْعِظَةً بَلِيغَةً ذَرَفَتْ مِنْهَا الْعُيُونُ وَوَجِلَتْ مِنْهَا الْقُلُوبُ فَقَالَ قَائِلٌ يَا رَسُولَ الله كَأَنَّ هَذِهِ مَوْعِظَةُ مُوَدِّعٍ فَمَاذَا تَعْهَدُ إِلَيْنَا فَقَالَ «أُوصِيكُمْ بِتَقْوَى الله وَالسَّمْعِ وَالطَّاعَةِ وَإِنْ عَبْدًا حَبَشِيًّا فَإِنَّهُ مَنْ يَعِشْ مِنْكُمْ بَعْدِى فَسَيَرَى اخْتِلاَفًا كَثِيرًا فَعَلَيْكُمْ بِسُنَّتِى وَسُنَّةِ الْخُلَفَاءِ الْمَهْدِيِّينَ الرَّاشِدِينَ تَمَسَّكُوا بِهَا وَعَضُّوا عَلَيْهَا بِالنَّوَاجِذِ وَإِيَّاكُمْ وَمُحْدَثَاتِ الأُمُورِ فَإِنَّ كُلَّ مُحْدَثَةٍ بِدْعَةٌ وَكُلَّ بِدْعَةٍ ضَلاَلَةٌ»
“Pada suatu hari Rasulullah Shallallahu ‘Alaihi Wasallam shalat bersama kami kemudian beliau menghadap kami dan memberikan nasehat yang sangat bagus, berlinang dengannya air mata kami dan bergetar hati-hati kami. Maka seseorang berkata: "Wahai Rasulullah, seakan-akan ini adalah nasihat perpisahan, maka apa yang Anda wasiatkan buat kami?" Maka beliau mengatakan: "Aku mewasiatkan kepada kalian dengan ketakwaan dan tunduk serta patuh walaupun yang memimpin kalian adalah seorang hamba. Maka barangsiapa yang berumur panjang di antara kalian, niscaya dia akan menyaksikan perselisihan yang banyak. Maka atas kalian sunnahku dan sunnah khulafaur rasyidin setelahku. Pegangilah dengannya dan gigitlah dengan gigi geraham. Hati-hatilah kalian dari perkara yang baru di dalam agama, karena setiap yang diada-adakan di dalam agama adalah bid’ah dan setiap bid’ah adalah sesat.” HR. Abu Dawud (4607) dan dihasankan oleh Syeikh Muqbil dalam As-Shahih Al-Musnad (2/21
Dalam hadits ini, Rasulullah Shallallahu ‘Alaihi Wasallam menerangkan tentang akan terjadinya perpecahan di antara umat ini. Setelah menjelaskan hal ini, beliau tidak meninggalkan umatnya begitu saja, akan tetapi menerangkan kepada mereka jalan keluarnya. Barangsiapa mengambilnya, maka sungguh dia telah selamat dunia dan akhirat. Sebaliknya barangsiapa yang mengabaikannya, maka sungguh dia telah celaka dunia dan akhirat. Jalan keluar itu adalah berpegang teguh dengan Al-Qur’an serta As-Sunnah yang shohih dengan pemahaman Salaf.
Al-‘Alim Al-Imam Robi’ bin Hadi –hafidzohulloh- berkata: ”Orang-orang kafir, Nashara dan Yahudi menginginkan kaum muslimin murtad dari agama mereka dan pada ahlul bid’ah bagian yang besar dari niat yang jelek ini. Begitu pula niat yang jelek bagi ahlul khoir. Maka dari sini, wajib bagi kita untuk sangat berhati-hati dari mereka."(Al-Mauqifus Shohih min Ahlil Bida’)
Semua ini menunjukkan bahwa seluruh dakwah ahlul batil tidaklah dibangun di atas ilmu Kitab dan Sunnah begitu pula tidak di atas keikhlasan kepada Alloh sebagaimana yang Alloh perintahkan. Alloh -subhanahu wa ta'ala - berfirman:
﴿قُلْ هَذِهِ سَبِيلِي أَدْعُو إِلَى الله عَلَى بَصِيرَةٍ أَنَا وَمَنِ اتَّبَعَنِي وَسُبْحَانَ الله وَمَا أَنَا مِنَ الْمُشْرِكِينَ﴾
”Katakanlah: "Inilah jalan (agama)ku, aku dan orang-orang yang mengikutiku mengajak (kamu) kepada Alloh dengan hujjah yang nyata. Maha suci Alloh, aku tiada termasuk orang-orang yang musyrik." [QS. Yusuf: 108]
Oleh karena itu, ketika Ahlus Sunnah wal Jama’ah bangkit menyeru manusia agar kembali kepada ajaran Islam yang murni serta memperingatkan mereka dari golongan-gologan yang sesat baik dari kalangan orang-orang kafir ataupun ahlu bida’, mereka (golongan-golongan yang sesat) –ketika tidak memiliki hujjah untuk menghadapi Ahlus Sunnah wal Jama'ah– mulai membuat makar terhadap Ahlus Sunnah wal Jama'ah. Salah satu bentuk makarnya adalahnya menjuluki Ahlus Sunnah wal Jama'ah dengan julukan-julukan yang tidak benar. Bahkan di antara mereka tidak segan-segan menghalalkan darah Ahlus Sunnah wal Jama'ah.
Rasulullah Shallallahu ‘Alaihi Wasallam dituduh oleh kaum musyrikin pada jaman beliau sebagai tukang sihir, orang gila, orang yang celaka dan lain-lain. Bahkan mereka berencana untuk membunuh beliau. Akan tetapi Alloh Robb semesta alam senantiasa menjaga beliau hingga meninggalkan dunia ini
Alloh ta'ala berfirman:
﴿وَإِذْ يَمْكُرُ بِكَ الَّذِينَ كَفَرُوا لِيُثْبِتُوكَ أَوْ يَقْتُلُوكَ أَوْ يُخْرِجُوكَ وَيَمْكُرُونَ وَيَمْكُرُ الله وَالله خَيْرُ الْمَاكِرِينَ﴾
"Ingatlah, ketika orang-orang kafir (Quraisy) memikirkan tipu daya terhadapmu untuk menangkap, membunuh atau mengusirmu. Mereka memikirkan tipu daya dan Alloh menggagalkan tipu daya itu. Alloh Sebaik-baik pembalas tipu daya. (QS. Al-Anfal: 30)
Begitu pula orang-orang yang mengikuti jejak Rasulullah Shallallahu ‘Alaihi Wasallam juga akan diuji. Oleh karena itu, wajib bagi setiap Ahlus Sunnah wal Jama'ah untuk tetap kokoh dalam berjalan di atas jalannya Rasulullah Shallallahu ‘Alaihi Wasallam hingga akhir jaman.
Upaya musuh-musuh Tauhid dan Sunnah dalam memerangi Ahlus Sunnah wal Jama'ah dengan menjuluki mereka dengan julukan-julukan yang tidak sesuai dengan kenyataan, baik pada jaman dahulu atapun sekarang. Diantara julukan-julukan yang mereka lemparkan terhadap Ahlus Sunnah wal Jama'ah pada akhir-akhir ini adalah apa yang kita dengar dengan sebutan Wahhabiyah. Bahkan siapa saja yang mereka lihat mulai berpegang teguh dengan Sunnah, mereka juluki sebagai Wahhabiy, nisbah kepada Syaikh Muhammad bin Abdul Wahab Al-Najdiy. Hal itu dikarenakan, mereka menuduh bahwa dakwah beliau adalah dakwah garis keras, menghalalkan darah kaum muslimin dan lain-lain. Bahkan beliau dituduh semasa hayatnya sebagai penerus dakwah kelompok Wahhabiyah (salah satu kelompok Khawarij yang muncul di Maghrib pada tahun 171 H). Oleh karena itu, setiap yang datang setelah Syaikh Muhammad bin Abdul Wahhab kemudian mendakwahkan kepada tauhid dan Sunnah serta membasmi kesyirikan, kebida’han, khurafat dan kemungkaran-kemungkaran yang lain, mereka menuduhnya sebagai pengekor beliau.
Alloh Ta'ala berfirman:
﴿مَا لَهُمْ بِهِ مِنْ عِلْمٍ وَلَا لِآبَائِهِمْ كَبُرَتْ كَلِمَةً تَخْرُجُ مِنْ أَفْوَاهِهِمْ إِنْ يَقُولُونَ إِلَّا كَذِبًا﴾
"Mereka sekali-kali tidak mempunyai pengetahuan tentang hal itu, begitu pula nenek moyang mereka. Alangkah buruknya kata-kata yang keluar dari mulut mereka. Mereka tidak mengatakan (sesuatu), kecuali kedustaan." (QS. Al-Kahfi: 5)
Semua ini mereka lakukan dalam rangka menjauhkan manusia dari berpegang teguh dengan Sunnah Nabi Shallallahu ‘Alaihi Wasallam. Wala haula wala quwwata illa billah.
Melihat kenyataan yang ada, maka Ahlus Sunnah wal Jama'ah bangkit menjelaskan kepada manusia tentang makar musuh-musuh Tauhid dan Sunnah ini, baik secara lisan maupun tulisan. Sehingga Alloh ta'ala membuka hati-hati manusia terutama umat Islam kepada kebenaran.
Alloh ta'ala berfirman:
﴿إِنَّ الَّذِينَ يُحَادُّونَ اللَّهَ وَرَسُولَهُ أُولَئِكَ فِي الْأَذَلِّينَ﴾
"Sesungguhnya orang-orang yang menentang Alloh dan Rasul-Nya, mereka termasuk orang-orang yang sangat hina." (QS. Al-Mujadalah: 20)
Orang-orang biasa menuduh “wahabi ” kepada setiap orang yang melanggar tradisi, kepercayaan dan bid’ah mereka, sekalipun kepercayaan-kepercayaan mereka itu rusak, bertentangan dengan Al-Qur’anul Karim dan hadits-hadits shahih. Mereka menentang dakwah kepada tauhid dan enggan berdo’a (memohon) hanya kepada Allah semata.
Sebagian orang menuduh salafi orang-orang wahabi. Ini termasuk tanaabuzun bil alqaab (memanggil dengan panggilan-panggilan yang buruk). Allah melarang kita dari hal itu dengan firmanNya,
“Artinya : Dan janganlah kamu panggil-memanggil dengan gelar-gelar yang buruk.” [Al-Hujurat: 11]
Dahulu, musuh Islam menuduh Imam Syafi’i dengan rafidhah. Beliau lalu membantah mereka dengan mengatakan, “Jika rafidah (berarti) mencintai keluarga Muhammad. Maka hendaknya jin dan manusia menyaksikan bahwa sesungguhnya aku adalah rafidhah.”
Maka, kita juga membantah orang-orang yang menuduh salafi itu wahabi,
seorang penyair berkata, “Jika pengikut Ahmad adalah wahabi. Maka aku berikrar bahwa sesungguhnya aku wahabi.”
Musuh-musuh Tauhid dan Sunnah memberi gelar wahabi kepada setiap muwahhid (yang mengesakan Allah), nisbat kepada Muhammad bin Abdul Wahab, Jika mereka jujur, mestinya mereka mengatakan Muhammadi nisbat kepada namanya yaitu Muhammad. Betapapun begitu, ternyata Allah menghendaki nama wahabi sebagai nisbat kepada Al-Wahhab (Yang Maha Pemberi), yaitu salah satu dari nama-nama Allah yang paling baik (Asmaa’ul Husnaa).
Jika shufi menisbatkan namanya kepada jama’ah yang memakai shuf (kain wol) maka sesungguhnya wahabi menisbatkan diri mereka dengan Al-Wahhab (Yang Maha Pemberi), yaitu Allah yang memberikan tauhid dan meneguhkannya untuk berdakwah kepada tauhid.
SIAPA MUHAMMAD BIN ABDUL WAHAB
Beliau dilahirkan di kota ‘Uyainah, Nejed pada tahun 1115 H. Hafal Al-Qur’an sebelum berusia sepuluh tahun. Belajar kepada ayahandanya tentang fiqih Hambali, belajar hadits dan tafsir kepada para syaikh dari berbagai negeri, terutama di kota Madinah. Beliau memahami tauhid dari Al-Kitab dan As-Sunnah. Perasaan beliau tersentak setelah menyaksikan apa yang terjadi di negerinya Nejed dengan negeri-negeri lainnya yang beliau kunjungi berupa kesyirikan, khurafat dan bid’ah. Demikian juga soal menyucikan dan mengkultuskan kubur, suatu hal yang bertentangan dengan ajaran Islam yang benar.
Ia mendengar banyak wanita di negerinya bertawassul dengan pohon kurma yang besar. Mereka berkata, “Wahai pohon kurma yang paling agung dan besar, aku menginginkan suami sebelum setahun ini.”
Di Hejaz, ia melihat pengkultusan kuburan para sahabat, keluarga Nabi (ahlul bait), serta kuburan Rasulullah Shalallaahu alaihi wasalam, hal yang sesungguhnya tidak boleh dilakukan kecuali hanya kepada Allah semata.
Di Madinah, ia mendengar permohonan tolong (istighaatsah) kepada Rasulullah Shalallaahu alaihi wasalam, serta berdo’a (memohon) kepada selain Allah, hal yang sungguh bertentangan dengan Al-Qur’an dan sabda Rasulullah Shalallaahu alaihi wasalam . Al-Qur’an menegaskan:
“Artinya : Dan janganlah kamu menyembah apa-apa yang tidak memberi manfa’at dan tidak (pula) memberi madharat kepadamu selain Allah, sebab jika kamu berbuat (yang demikian) itu, sesungguhnya kamu kalau begitu termasuk orang-orang yang zhalim.” [Yunus : 106]
Ya Rahman ampunilah dosa kami dan berilah hidayah dan petunjuk kepada Umat Islam..amiin
Note: diambil dari beberapa sumber dgn sedikit edit dan ringkasan
Minggu, 03 Juli 2011
Setting Server Gateway di Mikrotik
Mikrotik-Materi kali ini akan membahas mengenai setting Server Gateway di Mikrotik, materi ini berguna untuk pemula yang sedang mempelajari Mikrotik. Server Gateway seperti sebuah pintu masuk/gerbang tempat lalu lintas data keluar dan masuk. Selamat mempelajari.
Sabtu, 02 Juli 2011
Mengenal Jaringan LAN
untuk pemula yang ingin belajar jaringan network, video ini bagus untuk mendalami dasar-dasar jaringan..silakan menyimak
sumber: http://videobelajar.com/pengenalan-jaringan-lan/
sumber: http://videobelajar.com/pengenalan-jaringan-lan/
Mengenal Router
Apa itu router? Router adalah penghubung antara jaringan satu ke jaringan lainnya, yaitu agar host pada jaringan yang satu bisa berkomunikasi dengan host pada jaringan yang lain untuk meneruskan data dari satu jaringan ke jaringan lainnya. Router berbeda dengan switch. Switch merupakan penghubung beberapa alat untuk membentuk suatu Local Area Network (LAN).
Cara meng-konfigurasinya bisa melalui port console atau bisa juga melalui network.
1. Melalui port console
Console port adalah sebuah port pada router. Sebuah kabel Roll Over dibutuhkan untuk menghubungkan serial interface pada PC dan Console port pada router tersebut. Setelah Router terhubung dengan PC, Router dapat dikonfigurasi dengan menjalankan applikasi HyperTerminal dari PC.
2. Melalui Network
Cara ini bisa dikatakan lebih menguntungkan bagi para Network Administrator jaringan,karena router bisa di remote dari luar asalkan network interface routernya sudah diset untuk keperluan telnet.
Tingkat akses perintah pada router:
1.User mode ,biasanya ditandai dengan tanda “>”. pada tingkatan ini user hanya bisa melihat status/konfigurasinya saja tanpa ada hak akses untuk merubah konfigurasi didalamnya.
2.Privileged mode ,user akan masuk ke tingkat akses ini setelah mengetikkan ena di tingkat user mode. biasanya ditandai dengan “#”. jika pada interface ini sudah diberi password maka user harus meng-inputkan password agar bisa masuk dan merubah konfigurasi router. namun untuk memulai konfigurasi baru setelah masuk pada privileged mode ketikkan conf-t.
Cara me-routing router ada beberapa cara,ada dengan cara static dan ada juga dinamic.
Perbedaan antara static dan dinamic :
Static routing dikonfigurasi secara manual. Routing tabelnya diset manual dan disimpan dalam router. Tidak ada informasi sharing diantara sesama router. Hal ini mengakibatkan keterbatasan yang jelas karena ia tidak dapat secara otomatis menentukan route terbaik; ia selalu menggunakan rute yang sama yang kemungkinan bukan rute terbaik. Jika route berubah, static router harus diupdate secara manual. Karena static router menyediakan control penuh pada routing tabelnya, ia lebih aman dibanding dynamic router.
Dynamic routing mampu membuat routing tabelnya sendiri dengan berbicara ke sesama router. Untuk melakukannya ia menemukan route dan route alternatif yang berada pada network. Dynamic router bisa membuat keputusan pada route yang mana sebuah paket mencapai tujuan. Umumnya ia mengirimkan paket ke route yang paling efisien; salah satu yang menghasilkan jumlah hop lebih sedikit. Bagaimanapun, jika route macet,dynamic route dapat mengirimkan paket ke route alternatif.
Jenis-jenis router
Secara umum, router dibagi menjadi dua buah jenis, yakni:
Static router (router statis): adalah sebuah router yang memiliki tabel routing statis yang diset secara manual oleh para administrator jaringan.
Dynamic router (router dinamis): adalah sebuah router yang memiliki dab membuat tabel routing dinamis, dengan mendengarkan lalu lintas jaringan dan juga dengan saling berhubungan dengan router lainnya.
Produsen router
Beberapa produsen router termasuk:
* 2Wire (www.2wire.com)
* 3Com (www.3com.com)
* Adtran (www.adtran.com)
* Alcatel (www.alcatel.com)
* Apple Computer (termed 'AirPort Base Stations')
* Asus (www.asus.com)
* Belkin (www.belkin.com)
* Buffalo Technology (www.buffalotech.com)
* Billion (www.billion.com)
* CANYON (www.canyon-tech.com)
* CISCO SYSTEMS, INC. (www.cisco.com)
* Cyclades Corporation (www.cyclades.com)
* D-Link Systems (www.dlink.com)
* Draytek (www.draytek.com)
* Enterasys Networks (www.enterasys.com)
* Ericsson AB (www.ericsson.com)
* Extreme Networks (www.extremenetworks.com)
* Funkwerk Enterprise Communications GmbH (www.bintec.net)
* Foundry Networks (www.foundrynet.com)
* Hawking Technologies (www.hawkingtech.com)
* Hewlett-Packard (www.hp.com)
* Huawei Technologies (www.huawei.com)
* ImageStream (www.imagestream.com)
* Juniper Networks (www.juniper.net)
* Lightning MultiCom (www.lightning.ch)
* LINKSYS (www.linksys.com)
* Lucent Technologies (www.lucent.com)
* Marconi (www.marconi.com)
* Mikrotik (www.mikrotik.com)
* Motorola (www.motorola.com)
* MRV Communications (www.mrv.com)
* NetComm (www.netcomm.com)
* NETGEAR (www.netgear.com)
* Nortel (www.nortel.com)
* PacketFront (www.packetfront.com)
* Pivotal Networking (global.acer.com)
* Redback Networks (www.redback.com)
* Siemens AG (www.siemens.com)
* SMC Networks (www.smc.com)
* Tellabs (www.tellabs.com)
* U.S. Robotics (www.usr.com)
* Zoom Telephonics (www.zoom.com)
* Trendware (www.trendware.com)
* ZyXEL (www.us.zyxel.com)
Pada kesempatan ini kita coba untuk yang static routing.berikut cara men-setting router seperti gambar di atas:
Router1 :
Press Enter to Start
Router>
Router>ena
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#hostname Router1
Router1(config)#int s0
Router1(config-if)#ip addr 202.123.40.21 255.255.255.252
Router1(config-if)#clock rate 9600
Router(config-if)#no shut
%LINK-3-UPDOWN: Interface Serial0, changed state to up
Router1(config-if)#ex
%LINK-3-UPDOWN: Interface Serial0, changed state to down
%LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0, changed state to down
Router1(config)#int e0
Router1(config-if)#ip addr 192.168.1.1 255.255.255.0
Router1(config-if)#no shut
%LINK-3-UPDOWN: Interface Ethernet0, changed state to up
%LINK-3-UPDOWN: Interface Serial0, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0, changed state to up
Router1(config-if)#ip route 192.168.2.0 255.255.255.0 202.123.40.21
Router1(config)#end
Route1r#wr mem
Building configuration…
[OK]
Router2:
Press Enter to Start
Router>ena
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#hostname Router2
Router2(config)#int s0
Router2(config-if)#ip addr 202.123.40.22 255.255.255.252
Router2(config-if)#no shut
%LINK-3-UPDOWN: Interface Serial0, changed state to up
Router2(config-if)#ex
Router2(config)#int e0
Router2(config-if)#ip addr 192.168.2.1 255.255.255.0
Router2(config-if)#no shut
%LINK-3-UPDOWN: Interface Ethernet0, changed state to up
Router2(config-if)#ip route 192.168.1.0 255.255.255.0 202.123.40.22
Router2(config)#end
Router2#wr mem
Building configuration…
[OK]
PC Client01 :
ip addr 192.168.1.2
netmask 255.255.255.0
gateway 192.168.1.1
PC Client02 :
ip addr 192.168.2.2
netmask 255.255.255.0
gateway 192.168.2.1
kemudian test ping dari PC Client01 ke PC Client02 dan sebaliknya!jika muncul reply berarti konfigurasi sukses,namun jika tidak? dicoba kembali
sumber: http://awibline.wordpress.com/2007/02/03/router-cisco/
http://sopansetiawan.blogspot.com/2008/11/pengenalan-router_24.html
dengan sedikit edit
Cara meng-konfigurasinya bisa melalui port console atau bisa juga melalui network.
1. Melalui port console
Console port adalah sebuah port pada router. Sebuah kabel Roll Over dibutuhkan untuk menghubungkan serial interface pada PC dan Console port pada router tersebut. Setelah Router terhubung dengan PC, Router dapat dikonfigurasi dengan menjalankan applikasi HyperTerminal dari PC.
2. Melalui Network
Cara ini bisa dikatakan lebih menguntungkan bagi para Network Administrator jaringan,karena router bisa di remote dari luar asalkan network interface routernya sudah diset untuk keperluan telnet.
Tingkat akses perintah pada router:
1.User mode ,biasanya ditandai dengan tanda “>”. pada tingkatan ini user hanya bisa melihat status/konfigurasinya saja tanpa ada hak akses untuk merubah konfigurasi didalamnya.
2.Privileged mode ,user akan masuk ke tingkat akses ini setelah mengetikkan ena di tingkat user mode. biasanya ditandai dengan “#”. jika pada interface ini sudah diberi password maka user harus meng-inputkan password agar bisa masuk dan merubah konfigurasi router. namun untuk memulai konfigurasi baru setelah masuk pada privileged mode ketikkan conf-t.
Cara me-routing router ada beberapa cara,ada dengan cara static dan ada juga dinamic.
Perbedaan antara static dan dinamic :
Static routing dikonfigurasi secara manual. Routing tabelnya diset manual dan disimpan dalam router. Tidak ada informasi sharing diantara sesama router. Hal ini mengakibatkan keterbatasan yang jelas karena ia tidak dapat secara otomatis menentukan route terbaik; ia selalu menggunakan rute yang sama yang kemungkinan bukan rute terbaik. Jika route berubah, static router harus diupdate secara manual. Karena static router menyediakan control penuh pada routing tabelnya, ia lebih aman dibanding dynamic router.
Dynamic routing mampu membuat routing tabelnya sendiri dengan berbicara ke sesama router. Untuk melakukannya ia menemukan route dan route alternatif yang berada pada network. Dynamic router bisa membuat keputusan pada route yang mana sebuah paket mencapai tujuan. Umumnya ia mengirimkan paket ke route yang paling efisien; salah satu yang menghasilkan jumlah hop lebih sedikit. Bagaimanapun, jika route macet,dynamic route dapat mengirimkan paket ke route alternatif.
Jenis-jenis router
Secara umum, router dibagi menjadi dua buah jenis, yakni:
Static router (router statis): adalah sebuah router yang memiliki tabel routing statis yang diset secara manual oleh para administrator jaringan.
Dynamic router (router dinamis): adalah sebuah router yang memiliki dab membuat tabel routing dinamis, dengan mendengarkan lalu lintas jaringan dan juga dengan saling berhubungan dengan router lainnya.
Produsen router
Beberapa produsen router termasuk:
* 2Wire (www.2wire.com)
* 3Com (www.3com.com)
* Adtran (www.adtran.com)
* Alcatel (www.alcatel.com)
* Apple Computer (termed 'AirPort Base Stations')
* Asus (www.asus.com)
* Belkin (www.belkin.com)
* Buffalo Technology (www.buffalotech.com)
* Billion (www.billion.com)
* CANYON (www.canyon-tech.com)
* CISCO SYSTEMS, INC. (www.cisco.com)
* Cyclades Corporation (www.cyclades.com)
* D-Link Systems (www.dlink.com)
* Draytek (www.draytek.com)
* Enterasys Networks (www.enterasys.com)
* Ericsson AB (www.ericsson.com)
* Extreme Networks (www.extremenetworks.com)
* Funkwerk Enterprise Communications GmbH (www.bintec.net)
* Foundry Networks (www.foundrynet.com)
* Hawking Technologies (www.hawkingtech.com)
* Hewlett-Packard (www.hp.com)
* Huawei Technologies (www.huawei.com)
* ImageStream (www.imagestream.com)
* Juniper Networks (www.juniper.net)
* Lightning MultiCom (www.lightning.ch)
* LINKSYS (www.linksys.com)
* Lucent Technologies (www.lucent.com)
* Marconi (www.marconi.com)
* Mikrotik (www.mikrotik.com)
* Motorola (www.motorola.com)
* MRV Communications (www.mrv.com)
* NetComm (www.netcomm.com)
* NETGEAR (www.netgear.com)
* Nortel (www.nortel.com)
* PacketFront (www.packetfront.com)
* Pivotal Networking (global.acer.com)
* Redback Networks (www.redback.com)
* Siemens AG (www.siemens.com)
* SMC Networks (www.smc.com)
* Tellabs (www.tellabs.com)
* U.S. Robotics (www.usr.com)
* Zoom Telephonics (www.zoom.com)
* Trendware (www.trendware.com)
* ZyXEL (www.us.zyxel.com)
Pada kesempatan ini kita coba untuk yang static routing.berikut cara men-setting router seperti gambar di atas:
Router1 :
Press Enter to Start
Router>
Router>ena
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#hostname Router1
Router1(config)#int s0
Router1(config-if)#ip addr 202.123.40.21 255.255.255.252
Router1(config-if)#clock rate 9600
Router(config-if)#no shut
%LINK-3-UPDOWN: Interface Serial0, changed state to up
Router1(config-if)#ex
%LINK-3-UPDOWN: Interface Serial0, changed state to down
%LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0, changed state to down
Router1(config)#int e0
Router1(config-if)#ip addr 192.168.1.1 255.255.255.0
Router1(config-if)#no shut
%LINK-3-UPDOWN: Interface Ethernet0, changed state to up
%LINK-3-UPDOWN: Interface Serial0, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0, changed state to up
Router1(config-if)#ip route 192.168.2.0 255.255.255.0 202.123.40.21
Router1(config)#end
Route1r#wr mem
Building configuration…
[OK]
Router2:
Press Enter to Start
Router>ena
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#hostname Router2
Router2(config)#int s0
Router2(config-if)#ip addr 202.123.40.22 255.255.255.252
Router2(config-if)#no shut
%LINK-3-UPDOWN: Interface Serial0, changed state to up
Router2(config-if)#ex
Router2(config)#int e0
Router2(config-if)#ip addr 192.168.2.1 255.255.255.0
Router2(config-if)#no shut
%LINK-3-UPDOWN: Interface Ethernet0, changed state to up
Router2(config-if)#ip route 192.168.1.0 255.255.255.0 202.123.40.22
Router2(config)#end
Router2#wr mem
Building configuration…
[OK]
PC Client01 :
ip addr 192.168.1.2
netmask 255.255.255.0
gateway 192.168.1.1
PC Client02 :
ip addr 192.168.2.2
netmask 255.255.255.0
gateway 192.168.2.1
kemudian test ping dari PC Client01 ke PC Client02 dan sebaliknya!jika muncul reply berarti konfigurasi sukses,namun jika tidak? dicoba kembali
sumber: http://awibline.wordpress.com/2007/02/03/router-cisco/
http://sopansetiawan.blogspot.com/2008/11/pengenalan-router_24.html
dengan sedikit edit
Senin, 04 April 2011
Javascript Jam Digital Untuk Blog
Sebelumnya saya mohon maaf, jika terdapat penulisan kode javascript yang salah ataupun jika daftar JavaSriptnya masih sangat kurang. Apa yang saya tuliskan di sini sebagian besar hasil copas dari situs lain. Saya berharap, semoga koleksi JavaScript ini berguna buat sobat-sobat semua. Silahkan copas saja koleksi JavaScript di bawah. Salam kenal sob...
Silahkan copas kode disini ke site anda
Silahkan copas kode disini ke site anda
kode visual basic
Jam Analog
‘Buat Form dan 1 Timer
Option Explicit
Dim xgen, ygen, xmin, ymin, xsec, ysec, xhor, yhor As Double
Dim h, m, s As Date
‘control the minute ‘
Function mint()
If s >= 0 And s < 12 Then
Call findminangle(CDbl(m))
ElseIf s >= 12 And s < 24 Then
Call findminangle(CDbl(m) + 0.2)
ElseIf s >= 24 And s < 36 Then
Call findminangle(CDbl(m) + 0.4)
ElseIf s >= 36 And s <= 48 Then
Call findminangle(CDbl(m) + 0.6)
ElseIf s >= 48 And s <= 59 Then
Call findminangle(CDbl(m) + 0.8)
End If
xmin = xgen
ymin = ygen
Line (Form1.ScaleWidth / 2, Form1.ScaleHeight / 2)-(xmin, ymin), RGB(255, 24, 32)
End Function
‘control the second
Function secnd()
Call findminangle(CDbl(s))
xsec = xgen
ysec = ygen
Line (Form1.ScaleWidth / 2, Form1.ScaleHeight / 2)-(xsec, ysec), RGB(100, 100, 100)
End Function
‘control the hour
Function hr()
If m >= 0 And m < 12 Then
Call findminangle(CDbl(h) * 5)
ElseIf m >= 12 And m < 24 Then
Call findminangle(5 * (CDbl(h) + 0.2))
ElseIf m >= 24 And m < 36 Then
Call findminangle(5 * (CDbl(h) + 0.4))
ElseIf m >= 36 And m < 48 Then
Call findminangle(5 * (CDbl(h) + 0.6))
ElseIf m >= 48 And m <= 59 Then
Call findminangle(5 * (CDbl(h) + 0.8))
End If
xhor = xgen
yhor = ygen
If xhor >= Form1.ScaleWidth / 2 And yhor >= Form1.ScaleHeight / 2 Then
Line (Form1.ScaleWidth / 2, Form1.ScaleHeight / 2)-(xhor – 200, yhor – 200), RGB(0, 0, 255)
ElseIf xhor <= Form1.ScaleWidth / 2 And yhor >= Form1.ScaleHeight / 2 Then
Line (Form1.ScaleWidth / 2, Form1.ScaleHeight / 2)-(xhor + 200, yhor – 200), RGB(0, 0, 255)
ElseIf xhor <= Form1.ScaleWidth / 2 And yhor <= Form1.ScaleHeight / 2 Then
Line (Form1.ScaleWidth / 2, Form1.ScaleHeight / 2)-(xhor + 200, yhor + 200), RGB(0, 0, 255)
ElseIf xhor >= Form1.ScaleWidth / 2 And yhor <= Form1.ScaleHeight / 2 Then
Line (Form1.ScaleWidth / 2, Form1.ScaleHeight / 2)-(xhor – 200, yhor + 200), RGB(0, 0, 255)
End If
End Function
‘draw the clock
Function drawdig()
Dim i As Integer
Circle (Form1.ScaleWidth / 2, Form1.ScaleHeight / 2), 1411, RGB(255, 34, 34)
For i = 5 To 60
Call findminangle(CDbl(i))
Form1.CurrentX = xgen – TextWidth(i / 5) / 2
Form1.CurrentY = ygen – TextWidth(i / 5) / 2
Form1.Print i / 5
i = i + 4
Next
End Function
‘find the co-ordinate
Function findminangle(p As Double)
Dim temp As Double
temp = 60 – (p – 15)
temp = temp * 60 * 0.1
temp = (22 * temp) / (7 * 180)
xgen = (Form1.ScaleWidth / 2) + (1000 * Cos(temp))
ygen = (Form1.ScaleHeight / 2) – (1000 * Sin(temp))
End Function
Private Sub Timer1_Timer()
Form1.Cls
Call drawdig
Form1.Caption = Time()
h = Hour(Time())
m = Minute(Time())
s = Second(Time())
Call mint
Call secnd
Call hr
End Sub
Melihat Data Excell dengan VB
Private Sub Command1_Click()
Dim i As Integer
Dim j As Integer
Dim k As Integer
j = Val(Text2.Text)
k = Val(Text3.Text)
Set xlBook = GetObject(Text1.Text)
List1.Clear
For i = 1 To k
List1.AddItem xlBook.WorkSheets(1).Cells(i, j).Value
Next
End Sub
Private Sub Dir1_Change()
File1.Path = Dir1.Path
End Sub
Private Sub Drive1_Change()
Dir1.Path = Drive1.Drive
End Sub
Private Sub File1_Click()
Text1.Text = File1.Path & “\” & File1.FileName
End Sub
Private Sub Form_Load()
File1.Pattern = “*.xls”
End Sub
Melihat Code Character
Private Function ChrCode(txt As String) As String
Dim x As Long
Dim outstring As String
For x = 1 To Len(txt$)
outstring$ = outstring$ + “Chr(” + CStr(Asc(Mid(txt$, x, 1))) + “) + “
Next x
outstring$ = Trim(outstring$)
outstring$ = Mid(outstring$, 1, Len(outstring$) – 2)
ChrCode$ = outstring$
End Function
Private Sub Command1_Click()
If Text1 = “” Then Exit Sub
Text2.Text = ChrCode(Text1.Text)
End Sub
Private Sub Command2_Click()
Text1.Text = “”
End Sub
Private Sub Command3_Click()
If Text2 = “” Then Exit Sub
Clipboard.SetText Text2.Text
End Sub
Private Sub Command4_Click()
Text2.Text = “”
End Sub
Private Sub Form_Unload(Cancel As Integer)
Unload Me
End
End Sub
Posted by Administrator in 03:49:08 | Permalink | No Comments »
Friday, March 14, 2008
Belajar Input Teks di List
Private Sub cmdHapus_Click()
LstList.RemoveItem (LstList.ListIndex)
End Sub
Private Sub cmdHapusSemua_Click()
LstList.Clear
End Sub
Private Sub cmdInput_Click()
LstList.AddItem txtInput.Text
txtInput.Text = “”
End Sub
Private Sub cmdKeluar_Click()
End
End Sub
Posted by Administrator in 09:04:21 | Permalink | No Comments »
Monday, March 10, 2008
Counter Time
Private Sub Command1_Click()
intbatas = 5
Me.Timer1.Interval = 1000
Me.Timer1.Enabled = True
End Sub
Private Sub Command2_Click()
intbatas = 5
Dim inttout As Integer
Dim dtm As Date
dtm = DateAdd(“s”, intbatas, Now)
Do Until Now >= dtm
DoEvents
inttout = Second(dtm) – Second(Now)
Me.Caption = “TimeOut:” & inttout
Loop
Unload Me
End Sub
Private Sub Timer1_Timer()
intbatas = intbatas – 1
If intbatas <= 0 Then
Me.Timer1.Enabled = False
Unload Me
Else
Me.Caption = “TimeOut:” & intbatas
End If
End Sub
Posted by Administrator in 08:41:29 | Permalink | Comments (1) »
Program Load Gambar
Private Sub Command1_Click()
With Me.CommonDialog1
.DialogTitle = “Ambil Gambar”
.Filter = “JPEG|*.jpg”
.ShowOpen
If .FileName <> “” Then
Set Me.Picture1.Picture = Nothing
Me.Picture1.Picture = LoadPicture(.FileName)
End If
End With
End Sub
‘Private Sub Form_Load()
‘Me.Picture1.Picture = LoadPicture(“D:\gbr_motor\bikes_honda_01.jpg”)
‘End Sub
Posted by Administrator in 08:31:20 | Permalink | No Comments »
Saturday, March 8, 2008
Radio Tuner Dengan VB
‘Thank’s Mackay for your sharing about Radio Tuner with VB
‘by Peter
Form
Option Explicit
‘Sintonizador de emisoras de radios
‘latinas en internet.
‘Creado por E. Mackay D. feb. 2008
Dim nEmisora As String
Dim nRadioPais As String
Private Sub cmdEscuchar_Click()
On Local Error Resume Next
If cmdEscuchar.Caption = “Escuchar” Then
Image1(0) = Image1(1) ‘Rojo
Tuneador.Enabled = False
cmdEscuchar.Caption = “Detener”
WMPradio.URL = nEmisora
WMPradio.Controls.Play
Else
cmdEscuchar.Caption = “Escuchar”
Image1(0) = Image1(3) ‘Gris
Tuneador.Enabled = True
WMPradio.Controls.Stop
Escuchar.Panels(1).Text = “”
lblRadioPais.Caption = “”
End If
End Sub
Private Sub Form_Load()
Image1(0) = Image1(3) ‘Gris
Escuchar.Panels(1).Width = Me.Width – 100
Call Emisoras
‘Emisora buffer Radio HRN de Honduras
nEmisora = “http://206.17.135.195/VACILON_LIVE”
End Sub
Private Sub Emisoras()
Dim strVar As String
‘Abre archivo para leer
On Local Error Resume Next
’Sept. 2, 2007
Open UnArchivo For Input As #1
Do While Not EOF(1)
Line Input #1, strVar
‘Procesa linea a linea, si la linea es valida
If strVar <> “” Then Call Separar(strVar)
Loop
Close #1
End Sub
Private Sub Separar(sRlinea As String)
Dim sNum, iPos As Long
Dim strFinal, lesStr As String
lesStr = sRlinea
On Local Error Resume Next
For sNum = 1 To 4
iPos = InStr(lesStr, “|”)
strFinal = Trim(Left(lesStr, iPos – 1))
Select Case sNum
’Numero en la lista
Case 1
ListaURL.Add strFinal
’Nombre de emisora
Case 2
ListaURL.Add strFinal
’Pais de origen
Case 3
ListaURL.Add strFinal
’Url de emisora
Case 4
ListaURL.Add strFinal
End Select
lesStr = Right(sRlinea, Len(lesStr) – iPos)
Next sNum
’Programacion
ListaURL.Add lesStr
’
End Sub
Private Sub Tuneador_Scroll()
On Local Error GoTo Fuera
’Muestra instantaneamente la emisora y el pais
Escuchar.Panels(1).Text = ListaURL((Tuneador.Value * 5) + 2) & ” en ” & ListaURL((Tuneador.Value * 5) + 3)
nEmisora = ListaURL((Tuneador.Value * 5) + 4)
nRadioPais = Escuchar.Panels(1).Text
Exit Sub
Fuera:
MsgBox “Solo hay ” & ListaURL.Count / 5 & ” estaciones listadas.”, vbInformation + vbOKOnly, “AVISO”
Tuneador.Value = (ListaURL.Count / 5) – 1
End Sub
Private Sub WMPradio_OpenStateChange(ByVal NewState As Long)
Escuchar.Panels(1).Text = WMPradio.Status
If Left(WMPradio.Status, 3) = “Rep” Then
lblRadioPais.Caption = Trim(nRadioPais)
Image1(0) = Image1(2) ‘Verde
Else
lblRadioPais.Caption = “”
Image1(0) = Image1(1) ‘Rojo
End If
End Sub
Module
Option Explicit
‘Marzo 2008
‘hp1ml@hotmail.com
‘Para escuchar emisoras de radio latinas en internet
‘……………………..
‘Configuracion del string por paises
Public UnArchivo As String
Public Type TVNAME
nIdice As Long
Canal As String
dirURL As String
nBitrate As Integer
namePais As String
nRata As Integer
nStatus As Integer
End Type
Public ListaURL As New Collection
Public CanalPorPais As New Collection
Public Type POINTAPI
x As Long
y As Long
End Type
‘Para desplegar mas lineas en un combobox
Public Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Public Declare Function SendMessage Lib _
“user32″ Alias “SendMessageA” _
(ByVal hWnd As Long, _
ByVal wMsg As Long, _
ByVal wParam As Long, _
lParam As Any) As Long
Public Declare Function MoveWindow Lib _
“user32″ (ByVal hWnd As Long, _
ByVal x As Long, ByVal y As Long, _
ByVal nWidth As Long, _
ByVal nHeight As Long, _
ByVal bRepaint As Long) As Long
Public Declare Function GetWindowRect Lib _
“user32″ (ByVal hWnd As Long, _
lpRect As RECT) As Long
Public Const CB_SHOWDROPDOWN = &H14F
Public Const CB_GETITEMHEIGHT = &H154
Sub main()
UnArchivo = App.Path & “\allradio.dat” ‘channelTV.txt” ‘”\get3test.htm”
frmTuner.Show
End Sub
Membuat Animasi Huruf
Private Sub cmdkeluar_Click()
Unload Me
End Sub
Private Sub form_load()
Label1.FontBold = True
Label1.Left = 240
Label1.Top = 240
Timer1.Interval = 200
End Sub
Private Sub Timer1_Timer()
Label1.Top = Label1.Top + 100
If Label1.Top > 3000 Then
Label1.Top = 240
End If
End Sub
Belajar Fungsi VB
Private Sub OK_Click()
Dim userMsg As String
userMsg = InputBox(“What is your message?”, “Message Entry Form”, “Enter your messge here”, 500, 700)
If userMsg <> “” Then
message.Caption = userMsg
Else
message.Caption = “No Message”
End If
End Sub
Posted by Administrator in 07:54:24 | Permalink | No Comments »
Saturday, February 23, 2008
Program Menghitung Lama Parkir
Dim awal, akhir As Date
Dim lama As Double
Private Sub cmd_keluar_Click()
End
End Sub
Private Sub txt_bg_change()
Ado_parkir.RecordSource = “Select*from tb_parkir where no_polisi=” ‘”&txt_bg.text&”‘”
Ado_parkir.Refresh
With Ado_parkir.Recordset
If .PageCount <> 0 Then
If !Status = “T” Then
TXT_MULAI.Text = !jam_masuk
cmd_mulai.Caption = “&Stop”
cmd_mulai.SetFocus
Else
MsgBox “Nomor Polisi Yang Telah tersimpan Silahkan Anda Tekan Tombol Mulai”, vbInformation + vbOKOnly, “BG”
cmd_mulai.SetFocus
End If
Else
TXT_MULAI.Text = “”
TXT_SELESAI.Text = “”
TXT_TOTAL.Text = “”
TXT_BIAYA.Text = “”
cmd_mulai.Caption = “&Mulai”
End If
End With
End Sub
Private Sub txt_bg_keypress(KeyASCII As Integer)
If KeyASCII = 13 Then cmd_mulai.SetFocus
End Sub
Private Sub cmd_mulai_Click()
Dim biaya As Integer
If TXT_BG.Text = “” Then
MsgBox “Masukkan Nomor BG Terlebih Dahulu”, vbInformation + vbOKOnly, “Information”
TXT_BG.SetFocus
Else
If cmd_mulai.Caption = “&Mulai” Then
awal = Time
TXT_MULAI.Text = awal
cmd_mulai.Caption = “&Simpan”
ElseIf cmd_mulai.Caption = “&Simpan” Then
Ado_parkir.RecordSource = “Select*from tb_parkir”
Ado_parkir.Refresh
With Ado_parkir.Recordset
.AddNew
!no_polisi = TXT_BG.Text
!jam_masuk = TXT_MULAI.Text
.Update
End With
cmd_mulai.Caption = “&Mulai”
TXT_MULAI.Text = “”
TXT_BG.Text = “”
TXT_BG.SetFocus
ElseIf cmd_mulai.Caption = “&Stop” Then
akhir = Time
TXT_SELESAI.Text = akhir
cmd_mulai.Caption = “&Lama”
ElseIf cmd_mulai.Caption = “&Lama” Then
Ado_parkir.RecordSource = “Select jam_masuk from”
tb_parkir where no_polisi=’”&txt_bg.text&”‘”
Ado_parkir.Refresh
lama = akhir – Ado_parkir.Recordset!jam_masuk
TXT_TOTAL.Text = Format(lama, “hh:mm:ss”)
cmd_mulai.Caption = “&Biaya”
ElseIf cmd_mulai.Caption = “&Biaya” Then
biaya = 50000 * lama
TXT_BIAYA.Text = Format(biaya, “Rp #,#”)
Ado_parkir.RecordSource = “select*from tb_parkir”
where ado_parkir=’”&txt_bg.text&”‘”
Ado_parkir.Refresh
With Ado_parkir.Recordset
!jam_keluar = TXT_SELESAI.Text
!biaya = biaya
!Status = “Y”
.Update
End With
cmd_mulai.Caption = “&Parkir”
ElseIf cmd_mulai.Caption = “&Parkir” Then
TXT_MULAI.Text = “”
TXT_SELESAI.Text = “”
TXT_TOTAL.Text = “”
TXT_BG.Text = “”
TXT_BIAYA.Text = “”
TXT_BG.SetFocus
cmd_mulai.Caption = “&Mulai”
End If
End If
End Sub
Private Sub cmd_cari_click()
On Error GoTo Error:
Cari = InputBox(“Masukkan Nomor Polisi Yang Akan Dicari:”, “Cari No.Polisi”)
If Cari <> Empty Then
ado_parkir.RecordSource=”Select*from tb_parkir where no_polisi=’”&Cari”‘”
Ado_parkir.Refresh
With Ado_parkir.Recordset
If !Status = “T” Then
TXT_BG.Text = !no_polisi
TXT_MULAI.Text = !jam_masuk
cmd_mulai.Caption = “&Stop”
TXT_SELESAI.Text = “”
TXT_BIAYA.Text = “”
TXT_TOTAL.Text = “”
Else
TXT_BG.Text = !no_polisi
TXT_MULAI.Text = “”
TXT_SELESAI = “”
TXT_BIAYA = “”
TXT_TOTAL = “”
cmd_mulai.Caption = “&Mulai”
End If
Exit Sub
Error:
MsgBox “No.Polisi Yang Anda Cari Tidak Ada!”, vbQuestion + vbOKOnly, “Pencarian”
TXT_BG.SetFocus
End With
End If
End Sub
kode visual basic
Public Function FileExist(asPath as string) as Boolean
If UCase(Dir(asPath))=Ucase(trimPath(asPath)) then
FileExist=true
Else
FileExist=False
End If
End Function
Public Function TrimPath(ByVal asPath as string) as string
if Len(asPath)=0 then Exit Function
Dim x as integer
Do
x=Instr(asPath,”\”)
if x=0 then Exit Do
asPath=Right(asPath,Len(asPath)-x)
Loop
TrimPath=asPath
End Function
Private sub command1_Click()
if fileExist(Text1.text) then
Label1=”YES”
else
Label1=”NO”
End if
End Sub
Private sub form_Load()
End sub
Low and Upper Case
‘add 2 command buttons and 1 text
Private Sub Command1_Click()
Text1.Text = CapFirst$(Text1.Text)
End Sub
Private Sub Command2_Click()
Text1.Text = LCase$(Text1.Text)
End Sub
‘add 1 module
Declare Function CapFirst$ Lib “CAPFIRST.DLL” Alias “CAPFIRST” (ByVal St$)
Show Your IP Address
Add Microsoft Winsock Control 6.0 component
Insert 1 Textbox
Insert 2 Command Buttons Rename Caption as Display and Clear
Private Sub Command1_Click()
If Text1.Text = “” Then
Command1.Enabled = False
Text1.Text = Winsock1.LocalIP
Else
Command1.Enabled = True
End If
End Sub
Private Sub Command2_Click()
Text1.Text = “”
If Text1.Text = “” Then
Command1.Enabled = True
Else
Command1.Enabled = False
End If
End Sub
Private Sub Form_Load()
Text1.Text = “”
If Text1.Text = “” Then
Command1.Enabled = False
Else
Command1.Enabled = True
End If
Text1.Text = Winsock1.LocalIP
End Sub
Permutasi
Option Explicit
Dim id As Integer
Dim N As Integer
Dim perm() As Integer
Function Engine(i As Integer)
Dim t As Integer
Dim j As Integer
id = id + 1
perm(i) = id
If (id = N) Then stampaj
For j = 1 To N
If (perm(j) = 0) Then
Engine (j)
End If
DoEvents
Next j
id = id – 1
perm(i) = 0
End Function
Private Sub cmdClear_Click()
List1.Clear
End Sub
Private Sub cmdGen_Click()
If Val(txtLength.Text) > Len(txtChar.Text) Then
MsgBox “Jumlah Permutasi Salah”
Exit Sub
End If
If Len(txtChar.Text) = 0 Or (Val(txtLength.Text) = 0) Then Exit Sub
Dim i As Integer
N = Val(txtLength.Text)
ReDim perm(N)
For i = 1 To N
perm(i) = 0
Next i
If ChSave.Value = 1 Then
MsgBox “Disimpan pada hasil.txt”
Open App.Path + “\hasil.txt” For Output As #1
End If
Engine 0
If ChSave.Value = 1 Then Close #1
End Sub
Sub Form_Load()
On Error Resume Next
id = -1
End Sub
Sub stampaj()
Dim i As Integer
Dim result As String
result = “”
For i = 1 To N
result = result & CStr(Mid$(txtChar.Text, perm(i), 1))
Next i
List1.AddItem result
If ChSave.Value = 1 Then Print #1, result
End Sub
Enkripsi Searah
Public Function Hash(ByVal text As String) As String
a = 1
For i = 1 To Len(text)
a = Sqr(a * i * Asc(Mid(text, i, 1))) ‘Numeric Hash
Next i
Rnd (-1)
Randomize a ‘seed PRNG
For i = 1 To 16
Hash = Hash & Chr(Int(Rnd * 256))
Next i
End Function
Private Sub Form_Load()
MsgBox Hash(“EmZ-2509″) ‘Yang dihasilkan: ‰°’r¿¾ ©Ì¿ÂX*¤W
End
End Sub
Enkripsi
Function EncDec(inData As Variant, Optional inPW As Variant = “”) As Variant
On Error Resume Next
Dim arrSBox(0 To 255) As Integer
Dim arrPW(0 To 255) As Integer
Dim Bi As Integer, Bj As Integer
Dim mKey As Integer
Dim i As Integer, j As Integer
Dim x As Integer, y As Integer
Dim mCode As Byte, mCodeSeries As Variant
EncDec = “”
If Trim(inData) = “” Then
Exit Function
End If
If inPW <> “” Then
j = 1
For i = 0 To 255
arrPW(i) = Asc(Mid$(inPW, j, 1))
j = j + 1
If j > Len(inPW) Then
j = 1
End If
Next i
Else
For i = 0 To 255
arrPW(i) = 0
Next i
End If
For i = 0 To 255
arrSBox(i) = i
Next i
j = 0
For i = 0 To 255
j = (arrSBox(i) + arrPW(i)) Mod 256
x = arrSBox(i)
arrSBox(i) = arrSBox(j)
arrSBox(j) = x
Next i
mCodeSeries = “”
Bi = 0: Bj = 0
For i = 1 To Len(inData)
Bi = (Bi + 1) Mod 256
Bj = (Bj + arrSBox(Bi)) Mod 256
‘ Tukar
x = arrSBox(Bi)
arrSBox(Bi) = arrSBox(Bj)
arrSBox(Bj) = x
‘siapkan kunci untuk XOR
mKey = arrSBox((arrSBox(Bi) + arrSBox(Bj)) Mod 256)
‘gunakan operasi XOR
mCode = Asc(Mid$(inData, i, 1)) Xor mKey
mCodeSeries = mCodeSeries & Chr(mCode)
Next i
EncDec = mCodeSeries
End Function
Private Sub Form_Load()
Dim Encrypt As String, Decrypt As String
Encrypt = EncDec(“admin”, “win”)
Decrypt = EncDec(“™D`>”, “win”)
MsgBox “Hasil enkripsi : ” & Encrypt & _
vbCrLf & “Hasil dekripsi : ” & Decrypt
End
End Sub
Posted by Administrator in 04:55:41 | Permalink | No Comments »
Wednesday, May 14, 2008
Menu Pop Up
Option Explicit
Private Declare Function SendMessage Lib “user32″ Alias _
“SendMessageA” (ByVal hwnd As Long, ByVal wMsg As Long, _
ByVal wParam As Long, lParam As Any) As Long
Private Const LB_GETITEMRECT = &H198
Private Const LB_ERR = (-1)
Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Public Function GetRClickedItem(MyList As Control, _
X As Single, Y As Single) As Long
‘PURPOSE: Determine which item was right clicked in a list
‘box, from the list_box’s mouse down event. YOU MUST CALL THIS
‘FROM THE MOUSEDOWN EVENT, PASSING THE X AND Y VALUES FROM THAT
‘EVENT TO THIS FUNCTION
‘MYLIST: ListBox Control
‘X, Y: X and Y position from MyList_MouseDown
‘RETURNS: ListIndex of selected item, or -1 if
‘a) There is no selected item, or b) an error occurs.
Dim clickX As Long, clickY As Long
Dim lRet As Long
Dim CurRect As RECT
Dim l As Long
‘Control must be a listbox
If Not TypeOf MyList Is ListBox Then
GetRClickedItem = LB_ERR
Exit Function
End If
‘get x and y in pixels
clickX = X Screen.TwipsPerPixelX
clickY = Y Screen.TwipsPerPixelY
‘Check all items in the list to see if it was clicked on
For l = 0 To MyList.ListCount – 1
‘get current selection as rectangle
lRet = SendMessage(MyList.hwnd, LB_GETITEMRECT, l, CurRect)
‘If the position of the click is in the this list item
‘then that’s our Item
If (clickX >= CurRect.Left) And (clickX <= CurRect.Right) _
And (clickY >= CurRect.Top) And _
(clickY <= CurRect.Bottom) Then
GetRClickedItem = l
Exit Function
End If
Next l
End Function
Private Sub Form_Load()
List1.AddItem “Merah”
List1.AddItem “Kuning”
List1.AddItem “Hijau”
mnuPopUp.Visible = False
End Sub
Private Sub List1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim lItem As Long
If Button = vbRightButton Then
lItem = GetRClickedItem(List1, X, Y)
If lItem <> -1 Then
List1.ListIndex = lItem
PopupMenu mnuPopUp
End If
End If
End Sub
Load Picture
Private Sub Command1_Click()
With Me.CommonDialog1
.DialogTitle = “Ambil Gambar”
.Filter = “JPEG|*.jpg”
.ShowOpen
If .FileName <> “” Then
Set Me.Picture1.Picture = Nothing
Me.Picture1.Picture = LoadPicture(.FileName)
End If
End With
End Sub
‘Private Sub Form_Load()
‘Me.Picture1.Picture = LoadPicture(“D:\gbr_motor\bikes_honda_01.jpg”)
‘End Sub
Sleep With Visual Basic
Option Explicit
Private Declare Sub Sleep Lib “kernel32″ (ByVal dwMilliseconds As Long)
Private Sub Form_Click()
Me.Caption = “Sleeping”
Call Sleep(20000)
Me.Caption = “Awake”
End Sub
Private Sub Label1_Click()
Me.Caption = “Sleeping”
Call Sleep(20000)
Me.Caption = “Awake”
End Sub
Posted by Administrator in 08:18:13 | Permalink | No Comments »
Find Something
Form
Option Explicit
Private Declare Function GetWindowText Lib “user32″ Alias “GetWindowTextA” (ByVal hWnd As Long, ByVal lpString As String, ByVal cch As Long) As Long
Private Sub cmdActivate_Click()
Dim nRet As Long
Dim Title As String
nRet = AppActivatePartial(Trim(txtTitle.Text), _
Val(frmMethod.Tag), CBool(chkCase.Value))
If nRet Then
lblResults.Caption = “Found: &&H” & Hex$(nRet)
Title = Space$(256)
nRet = GetWindowText(nRet, Title, Len(Title))
If nRet Then
lblResults.Caption = lblResults.Caption & _
“, “”" & Left$(Title, nRet) & “”"”
End If
Else
lblResults.Caption = “Search Failed”
End If
End Sub
Private Sub Form_Load()
txtTitle.Text = “”
lblResults.Caption = “”
optMethod(0).Value = True
End Sub
Private Sub optMethod_Click(Index As Integer)
frmMethod.Tag = Index
End Sub
Module
Option Explicit
Private Declare Function EnumWindows Lib “user32″ (ByVal lpEnumFunc As Long, ByVal lParam As Long) As Long
Private Declare Function GetClassName Lib “user32″ Alias “GetClassNameA” (ByVal hWnd As Long, ByVal lpClassName As String, ByVal nMaxCount As Long) As Long
Private Declare Function GetWindowText Lib “user32″ Alias “GetWindowTextA” (ByVal hWnd As Long, ByVal lpString As String, ByVal cch As Long) As Long
Private Declare Function IsIconic Lib “user32″ (ByVal hWnd As Long) As Long
Private Declare Function IsWindowVisible Lib “user32″ (ByVal hWnd As Long) As Long
Private Declare Function ShowWindow Lib “user32″ (ByVal hWnd As Long, ByVal nCmdShow As Long) As Long
Private Declare Function SetForegroundWindow Lib “user32″ (ByVal hWnd As Long) As Long
Private Const SW_RESTORE = 9
Private m_hWnd As Long
Private m_Method As FindWindowPartialTypes
Private m_CaseSens As Boolean
Private m_Visible As Boolean
Private m_AppTitle As String
Public Enum FindWindowPartialTypes
FwpStartsWith = 0
FwpContains = 1
FwpMatches = 2
End Enum
Public Function AppActivatePartial(AppTitle As String, Optional Method As FindWindowPartialTypes = FwpStartsWith, Optional CaseSensitive As Boolean = False) As Long
Dim hWndApp As Long
hWndApp = FindWindowPartial(AppTitle, Method, CaseSensitive, True)
If hWndApp Then
If IsIconic(hWndApp) Then
Call ShowWindow(hWndApp, SW_RESTORE)
End If
Call SetForegroundWindow(hWndApp)
AppActivatePartial = hWndApp
End If
End Function
Public Function FindWindowPartial(AppTitle As String, _
Optional Method As FindWindowPartialTypes = FwpStartsWith, _
Optional CaseSensitive As Boolean = False, _
Optional MustBeVisible As Boolean = False) As Long
m_hWnd = 0
m_Method = Method
m_CaseSens = CaseSensitive
m_AppTitle = AppTitle
If m_CaseSens = False Then
m_AppTitle = UCase$(m_AppTitle)
End If
Call EnumWindows(AddressOf EnumWindowsProc, MustBeVisible)
FindWindowPartial = m_hWnd
End Function
Private Function EnumWindowsProc(ByVal hWnd As Long, ByVal lParam As Long) As Long
Static WindowText As String
Static nRet As Long
If lParam Then
If IsWindowVisible(hWnd) = False Then
EnumWindowsProc = True
Exit Function
End If
End If
WindowText = Space$(256)
nRet = GetWindowText(hWnd, WindowText, Len(WindowText))
If nRet Then
WindowText = Left$(WindowText, nRet)
If m_CaseSens = False Then
WindowText = UCase$(WindowText)
End If
Select Case m_Method
Case FwpStartsWith
If InStr(WindowText, m_AppTitle) = 1 Then
m_hWnd = hWnd
End If
Case FwpContains
If InStr(WindowText, m_AppTitle) <> 0 Then
m_hWnd = hWnd
End If
Case FwpMatches
If WindowText = m_AppTitle Then
m_hWnd = hWnd
End If
End Select
End If
EnumWindowsProc = (m_hWnd = 0)
End Function
Bermain Animasi Dengan VB
Dim FrameCount As Long
Private Sub Command1_Click()
Timer1.Enabled = False
If LoadGif(Text1, Image1) Then
FrameCount = 0
Timer1.Interval = CLng(Image1(0).Tag)
Timer1.Enabled = True
End If
End Sub
Private Sub Command2_Click()
Timer1.Enabled = False
End Sub
Private Sub Command3_Click()
Timer1.Enabled = True
End Sub
Private Sub Form_Load()
Text1.Text = App.Path & IIf(Right(App.Path, 1) = “\”, “”, “\”) & “clip.gif”
Timer1.Enabled = False
End Sub
Private Sub Timer1_Timer()
If FrameCount < TotalFrames Then
Image1(FrameCount).Visible = False
FrameCount = FrameCount + 1
Image1(FrameCount).Visible = True
Timer1.Interval = CLng(Image1(FrameCount).Tag)
Else
FrameCount = 0
For i = 1 To Image1.Count – 1
Image1(i).Visible = False
Next i
Image1(FrameCount).Visible = True
Timer1.Interval = CLng(Image1(FrameCount).Tag)
End If
End Sub
Posted by Administrator in 07:38:13 | Permalink | Comments (5)
Animasi Bola
Dim FrameCount As Long
Private Sub Command1_Click()
Timer1.Enabled = False
If LoadGif(Text1, Image1) Then
FrameCount = 0
Timer1.Interval = CLng(Image1(0).Tag)
Timer1.Enabled = True
End If
End Sub
Private Sub Command2_Click()
Timer1.Enabled = False
End Sub
Private Sub Command3_Click()
Timer1.Enabled = True
End Sub
Private Sub Form_Load()
Text1.Text = App.Path & IIf(Right(App.Path, 1) = “\”, “”, “\”) & “ball.gif”
Timer1.Enabled = False
End Sub
Private Sub Timer1_Timer()
If FrameCount < TotalFrames Then
Image1(FrameCount).Visible = False
FrameCount = FrameCount + 1
Image1(FrameCount).Visible = True
Timer1.Interval = CLng(Image1(FrameCount).Tag)
Else
FrameCount = 0
For i = 1 To Image1.Count – 1
Image1(i).Visible = False
Next i
Image1(FrameCount).Visible = True
Timer1.Interval = CLng(Image1(FrameCount).Tag)
End If
End Sub
Posted by Administrator in 04:48:26 | Permalink | Comments (1) »
Saturday, April 26, 2008
Mouse Limit
Option Explicit Private Type RECT left As Integer top As Integer right As Integer bottom As Integer End Type Private Type POINT x As Long y As Long End Type Private Declare Sub ClipCursor Lib “user32″ (lpRect As Any) Private Declare Sub GetClientRect Lib “user32″ (ByVal hWnd As _ Long, lpRect As RECT) Private Declare Sub ClientToScreen Lib “user32″ (ByVal hWnd As _ Long, lpPoint As POINT) Private Declare Sub OffsetRect Lib “user32″ (lpRect As RECT, _ ByVal x As Long, ByVal y As Long) Public Sub LimitCursorMovement(ctl As Object) Dim client As RECT Dim upperleft As POINT Dim lHwnd As Long On Error Resume Next lHwnd = ctl.hWnd If lHwnd = 0 Then Exit Sub GetClientRect ctl.hWnd, client upperleft.x = client.left upperleft.y = client.top ClientToScreen ctl.hWnd, upperleft OffsetRect client, upperleft.x, upperleft.y ClipCursor client End Sub Public Sub ReleaseLimit() ‘Releases the cursor limits ‘Be sure to call on unloading the form ClipCursor ByVal 0& End Sub Private Sub cmdNormal_Click() ReleaseLimit End Sub Private Sub cmdSetLimit_Click() LimitCursorMovement Me End Sub Private Sub Form_Load() ReleaseLimit End Sub Private Sub Form_Unload(Cancel As Integer) ReleaseLimit End Sub
Posted by Administrator in 05:59:00 | Permalink | Comments (3)
Spash Screen
Option Explicit
Private Sub Form_KeyPress(KeyAscii As Integer)
Unload Me
End Sub
Private Sub Form_Load()
‘ lblVersion.Caption = “Version ” & App.Major & “.” & App.Minor & “.” & App.Revision
‘ lblProductName.Caption = App.Title
End Sub
Private Sub Frame1_Click()
Unload Me
End Sub
Private Sub Timer1_Timer()
Dim counter As Double
counter = 0
Do
counter = counter + 0.005
Label2.Width = counter
Loop While Not (Label1.Width = Label2.Width)
frmSplash.Hide
Form5.Show
Timer1.Enabled = False
End Sub
Posted by Administrator in 04:10:21 | Permalink | No Comments »
Folder Customizer
Dim opcolor As String
Dim opcolor2 As String
Private Sub cmdfolder_Click()
folder = BrowseForFolder(folder, Me.hwnd, “&Select a directory:”)
Command4_Click
End Sub
Private Sub Command1_Click()
folder = BrowseForFolder(folder, Me.hwnd, “&Select a directory:”)
If folder = “” Then
Exit Sub
End If
wrt$ = “{BE098140-A513-11D0-A3A4-00C04FD706EC}”
r% = WritePrivateProfileString(wrt$, “IconArea_Image”, vbNullString, (folder.Text) + “\desktop.ini”)
r% = WritePrivateProfileString(wrt$, “IconArea_text”, vbNullString, (folder.Text) + “\desktop.ini”)
If r% = 1 Then
FileAttribHide folder.Text & “\desktop.ini”
setFolderRead folder.Text
Label18.Caption = “XXXXXXXXXXXXXXXXXXXXXXXXXXXXX”
End If
End Sub
Private Sub Command2_Click()
If Command2.Caption <> “&Finish” Then
If MsgBox(“Exit the wizard without completion !”, 64 + vbYesNo) = vbYes Then
End
End If
Else
MsgBox “This Wizard has been developed by Ramky for more goodies visit http://www.programmervb.wordpress.com “, 64
End
End If
End Sub
Private Sub Command3_Click()
If folder.Text = “” Then
cmdfolder_Click
Else
wrt$ = “{BE098140-A513-11D0-A3A4-00C04FD706EC}”
r% = WritePrivateProfileString(wrt$, “IconArea_Image”, (img.Text), (folder.Text) + “\desktop.ini”)
r% = WritePrivateProfileString(wrt$, “IconArea_text”, opcolor, (folder.Text) + “\desktop.ini”)
If r% = 1 Then
FileAttribHide folder.Text & “\desktop.ini”
setFolderRead folder.Text
Command3.Enabled = False
Command2.Caption = “&Finish”
Label14.Visible = False
Label9.Visible = False
Label10.Visible = False
Label11.Visible = False
Label14.Visible = False
textcolor.Visible = False
img.Visible = False
folder.Visible = False
Command5.Visible = False
Command4.Visible = False
Line3.Visible = False
cmdfolder.Visible = False
Label18.Visible = True
Label19.Visible = True
Label13.Visible = True
End If
If r% <> 1 Then MsgBox “Error in writing”, vbCritical
GoTo nex
back = 1
nex:
If back = 1 Then
Command1.Enabled = True
cmdfolder.Enabled = True
Frame1.Visible = False
Frame2.Top = -120
Frame2.Left = -120
Frame2.Visible = True
back = 2
End If
End If
End Sub
Private Sub Command4_Click()
CommonDialog1.CancelError = False
CommonDialog1.DialogTitle = “Select Your Picture”
CommonDialog1.Filter = “jpeg(*.jpg)|*.jpg|png(*.png)|*.png|Gif(*.Gif)|*.Gif|Bitmap(*.bmp)|*.bmp” ‘|MID(*.mid)|*.mid|AU(*.au)|*.au|”
CommonDialog1.FileName = “”
CommonDialog1.ShowOpen
img = CommonDialog1.FileName
Command5_Click
End Sub
Private Sub Command5_Click()
CommonDialog1.CancelError = False
CommonDialog1.Flags = 3
CommonDialog1.ShowColor
opcolor = CommonDialog1.Color
textcolor.ForeColor = CommonDialog1.Color
End Sub
Private Sub Command6_Click()
CommonDialog1.CancelError = False
CommonDialog1.Flags = 3
CommonDialog1.ShowColor
opcolor2 = CommonDialog1.Color
End Sub
Private Sub Form_Load()
Height = 6330
Width = 8160
End Sub
Private Sub Frame2_DragDrop(Source As Control, X As Single, Y As Single)
End Sub
Posted by Administrator in 03:44:10 | Permalink | No Comments »
Friday, April 25, 2008
Create Domain
Private Sub Check1_Click()
If Check1.Value = 1 Then
lblDomainName.Visible = True
txtDomainName.Visible = True
End If
If Check1.Value = 0 Then
lblDomainName.Visible = False
txtDomainName.Visible = False
End If
End Sub
Private Sub cmdGenerate_Click()
Dim responce
Dim i As Integer
If Check1.Value = 1 Then
responce = MsgBox(“Do you want to create ” & txtDomainName.Text & ” DOMAIN user”, vbYesNo)
If responce = vbYes Then
For i = Val(txtUserStart.Text) To Val(txtUserEnd.Text)
Shell “net user ” & txtUserPrefix & Format(i, “0000″) & txtUserPostfix & ” ” & txtPassPrefix & Format(i, “0000″) & txtPassPostfix & ” /ADD ” & txtDomainName.Text & ” /DOMAIN”, vbHide
Next i
End If
Else
responce = MsgBox(“Do you want to create LOCAL user”, vbYesNo)
If responce = vbYes Then
For i = Val(txtUserStart.Text) To Val(txtUserEnd.Text)
Shell “net user ” & txtUserPrefix & Format(i, “0000″) & txtUserPostfix & ” ” & txtPassPrefix & Format(i, “0000″) & txtPassPostfix & ” /ADD”, vbHide
Next i
End If
End If
End Sub
Private Sub Label11_Click()
End Sub
Private Sub txtUserEnd_Change()
txtPassEnd.Text = txtUserEnd.Text
End Sub
Private Sub txtUserStart_Change()
txtPassStart.Text = txtUserStart.Text
End Sub
Posted by Administrator in 05:49:57 | Permalink | No Comments »
Saturday, April 19, 2008
Change Your Desktop
Private Declare Function SystemParametersInfo Lib “user32″ Alias “SystemParametersInfoA” (ByVal uAction As Long, ByVal uParam As Long, ByVal lpvParam As String, ByVal fuWinIni As Long) As Long
‘constants to be used with the above api
Private Const SPI_SETDESKWALLPAPER = 20
Private Const SPIF_UPDATEINIFILE = &H1
‘will hold the path to the image
Private imagePath As String
Private Sub cmdBrowse_Click()
‘just your basic code to get a dialog box open to
‘select a image and get the path
‘
‘the picture must be a BITMAP Image File
‘
dlg.Filter = “Image Files (*.bmp)|*.bmp”
‘set a custom title to the dialog
dlg.DialogTitle = “Select the image to load.”
‘show the dialog
dlg.ShowOpen
‘the path to get the image from
imagePath = dlg.FileName
‘view the selected picture into the picturebox
‘control
pic.Picture = LoadPicture(imagePath)
End Sub
Private Sub cmdSetWallPaper_Click()
‘set the parameters to change the wallpaper to
‘the image you selected
SystemParametersInfo SPI_SETDESKWALLPAPER, 0, imagePath, SPIF_UPDATEINIFILE
End Sub
Posted by Administrator in 05:14:27 | Permalink | Comments (1) »
Thursday, April 17, 2008
Create Domain With VB
Private Sub Check1_Click()
If Check1.Value = 1 Then
lblDomainName.Visible = True
txtDomainName.Visible = True
End If
If Check1.Value = 0 Then
lblDomainName.Visible = False
txtDomainName.Visible = False
End If
End Sub
Private Sub cmdGenerate_Click()
Dim responce
Dim i As Integer
If Check1.Value = 1 Then
responce = MsgBox(“Do you want to create ” & txtDomainName.Text & ” DOMAIN user”, vbYesNo)
If responce = vbYes Then
For i = Val(txtUserStart.Text) To Val(txtUserEnd.Text)
Shell “net user ” & txtUserPrefix & Format(i, “0000″) & txtUserPostfix & ” ” & txtPassPrefix & Format(i, “0000″) & txtPassPostfix & ” /ADD ” & txtDomainName.Text & ” /DOMAIN”, vbHide
Next i
End If
Else
responce = MsgBox(“Do you want to create LOCAL user”, vbYesNo)
If responce = vbYes Then
For i = Val(txtUserStart.Text) To Val(txtUserEnd.Text)
Shell “net user ” & txtUserPrefix & Format(i, “0000″) & txtUserPostfix & ” ” & txtPassPrefix & Format(i, “0000″) & txtPassPostfix & ” /ADD”, vbHide
Next i
End If
End If
End Sub
Private Sub Label11_Click()
End Sub
Private Sub txtUserEnd_Change()
txtPassEnd.Text = txtUserEnd.Text
End Sub
Private Sub txtUserStart_Change()
txtPassStart.Text = txtUserStart.Text
End Sub
Posted by Administrator in 09:12:53 | Permalink | No Comments »
VbFtp
Module:
Option Explicit
Declare Function GetProcessHeap Lib “kernel32″ () As Long
Declare Function HeapAlloc Lib “kernel32″ (ByVal hHeap As Long, ByVal dwFlags As Long, ByVal dwBytes As Long) As Long
Declare Function HeapFree Lib “kernel32″ (ByVal hHeap As Long, ByVal dwFlags As Long, lpMem As Any) As Long
Public Const HEAP_ZERO_MEMORY = &H8
Public Const HEAP_GENERATE_EXCEPTIONS = &H4
Declare Sub CopyMemory1 Lib “kernel32″ Alias “RtlMoveMemory” ( _
hpvDest As Any, ByVal hpvSource As Long, ByVal cbCopy As Long)
Declare Sub CopyMemory2 Lib “kernel32″ Alias “RtlMoveMemory” ( _
hpvDest As Long, hpvSource As Any, ByVal cbCopy As Long)
Public Const MAX_PATH = 260
Public Const NO_ERROR = 0
Public Const FILE_ATTRIBUTE_READONLY = &H1
Public Const FILE_ATTRIBUTE_HIDDEN = &H2
Public Const FILE_ATTRIBUTE_SYSTEM = &H4
Public Const FILE_ATTRIBUTE_DIRECTORY = &H10
Public Const FILE_ATTRIBUTE_ARCHIVE = &H20
Public Const FILE_ATTRIBUTE_NORMAL = &H80
Public Const FILE_ATTRIBUTE_TEMPORARY = &H100
Public Const FILE_ATTRIBUTE_COMPRESSED = &H800
Public Const FILE_ATTRIBUTE_OFFLINE = &H1000
Type FILETIME
dwLowDateTime As Long
dwHighDateTime As Long
End Type
Type WIN32_FIND_DATA
dwFileAttributes As Long
ftCreationTime As FILETIME
ftLastAccessTime As FILETIME
ftLastWriteTime As FILETIME
nFileSizeHigh As Long
nFileSizeLow As Long
dwReserved0 As Long
dwReserved1 As Long
cFileName As String * MAX_PATH
cAlternate As String * 14
End Type
Public Const ERROR_NO_MORE_FILES = 18
Public Declare Function InternetFindNextFile Lib “wininet.dll” Alias “InternetFindNextFileA” _
(ByVal hFind As Long, lpvFindData As WIN32_FIND_DATA) As Long
Public Declare Function FtpFindFirstFile Lib “wininet.dll” Alias “FtpFindFirstFileA” _
(ByVal hFtpSession As Long, ByVal lpszSearchFile As String, _
lpFindFileData As WIN32_FIND_DATA, ByVal dwFlags As Long, ByVal dwContent As Long) As Long
Public Declare Function FtpGetFile Lib “wininet.dll” Alias “FtpGetFileA” _
(ByVal hFtpSession As Long, ByVal lpszRemoteFile As String, _
ByVal lpszNewFile As String, ByVal fFailIfExists As Boolean, ByVal dwFlagsAndAttributes As Long, _
ByVal dwFlags As Long, ByVal dwContext As Long) As Boolean
Public Declare Function FtpPutFile Lib “wininet.dll” Alias “FtpPutFileA” _
(ByVal hFtpSession As Long, ByVal lpszLocalFile As String, _
ByVal lpszRemoteFile As String, _
ByVal dwFlags As Long, ByVal dwContext As Long) As Boolean
Public Declare Function FtpSetCurrentDirectory Lib “wininet.dll” Alias “FtpSetCurrentDirectoryA” _
(ByVal hFtpSession As Long, ByVal lpszDirectory As String) As Boolean
‘ Initializes an application’s use of the Win32 Internet functions
Public Declare Function InternetOpen Lib “wininet.dll” Alias “InternetOpenA” _
(ByVal sAgent As String, ByVal lAccessType As Long, ByVal sProxyName As String, _
ByVal sProxyBypass As String, ByVal lFlags As Long) As Long
‘ User agent constant.
Public Const scUserAgent = “vb wininet”
‘ Use registry access settings.
Public Const INTERNET_OPEN_TYPE_PRECONFIG = 0
Public Const INTERNET_OPEN_TYPE_DIRECT = 1
Public Const INTERNET_OPEN_TYPE_PROXY = 3
Public Const INTERNET_INVALID_PORT_NUMBER = 0
Public Const FTP_TRANSFER_TYPE_ASCII = &H1
Public Const FTP_TRANSFER_TYPE_BINARY = &H1
Public Const INTERNET_FLAG_PASSIVE = &H8000000
‘ Opens a HTTP session for a given site.
Public Declare Function InternetConnect Lib “wininet.dll” Alias “InternetConnectA” _
(ByVal hInternetSession As Long, ByVal sServerName As String, ByVal nServerPort As Integer, _
ByVal sUsername As String, ByVal sPassword As String, ByVal lService As Long, _
ByVal lFlags As Long, ByVal lContext As Long) As Long
Public Const ERROR_INTERNET_EXTENDED_ERROR = 12003
Public Declare Function InternetGetLastResponseInfo Lib “wininet.dll” Alias “InternetGetLastResponseInfoA” ( _
lpdwError As Long, _
ByVal lpszBuffer As String, _
lpdwBufferLength As Long) As Boolean
‘ Number of the TCP/IP port on the server to connect to.
Public Const INTERNET_DEFAULT_FTP_PORT = 21
Public Const INTERNET_DEFAULT_GOPHER_PORT = 70
Public Const INTERNET_DEFAULT_HTTP_PORT = 80
Public Const INTERNET_DEFAULT_HTTPS_PORT = 443
Public Const INTERNET_DEFAULT_SOCKS_PORT = 1080
Public Const INTERNET_OPTION_CONNECT_TIMEOUT = 2
Public Const INTERNET_OPTION_RECEIVE_TIMEOUT = 6
Public Const INTERNET_OPTION_SEND_TIMEOUT = 5
Public Const INTERNET_OPTION_USERNAME = 28
Public Const INTERNET_OPTION_PASSWORD = 29
Public Const INTERNET_OPTION_PROXY_USERNAME = 43
Public Const INTERNET_OPTION_PROXY_PASSWORD = 44
‘ Type of service to access.
Public Const INTERNET_SERVICE_FTP = 1
Public Const INTERNET_SERVICE_GOPHER = 2
Public Const INTERNET_SERVICE_HTTP = 3
‘ Opens an HTTP request handle.
Public Declare Function HttpOpenRequest Lib “wininet.dll” Alias “HttpOpenRequestA” _
(ByVal hHttpSession As Long, ByVal sVerb As String, ByVal sObjectName As String, ByVal sVersion As String, _
ByVal sReferer As String, ByVal something As Long, ByVal lFlags As Long, ByVal lContext As Long) As Long
‘ Brings the data across the wire even if it locally cached.
Public Const INTERNET_FLAG_RELOAD = &H80000000
Public Const INTERNET_FLAG_KEEP_CONNECTION = &H400000
Public Const INTERNET_FLAG_MULTIPART = &H200000
Public Const GENERIC_READ = &H80000000
Public Const GENERIC_WRITE = &H40000000
‘ Sends the specified request to the HTTP server.
Public Declare Function HttpSendRequest Lib “wininet.dll” Alias “HttpSendRequestA” (ByVal _
hHttpRequest As Long, ByVal sHeaders As String, ByVal lHeadersLength As Long, ByVal sOptional As _
String, ByVal lOptionalLength As Long) As Integer
‘ Queries for information about an HTTP request.
Public Declare Function HttpQueryInfo Lib “wininet.dll” Alias “HttpQueryInfoA” _
(ByVal hHttpRequest As Long, ByVal lInfoLevel As Long, ByRef sBuffer As Any, _
ByRef lBufferLength As Long, ByRef lIndex As Long) As Integer
‘ The possible values for the lInfoLevel parameter include:
Public Const HTTP_QUERY_CONTENT_TYPE = 1
Public Const HTTP_QUERY_CONTENT_LENGTH = 5
Public Const HTTP_QUERY_EXPIRES = 10
Public Const HTTP_QUERY_LAST_MODIFIED = 11
Public Const HTTP_QUERY_PRAGMA = 17
Public Const HTTP_QUERY_VERSION = 18
Public Const HTTP_QUERY_STATUS_CODE = 19
Public Const HTTP_QUERY_STATUS_TEXT = 20
Public Const HTTP_QUERY_RAW_HEADERS = 21
Public Const HTTP_QUERY_RAW_HEADERS_CRLF = 22
Public Const HTTP_QUERY_FORWARDED = 30
Public Const HTTP_QUERY_SERVER = 37
Public Const HTTP_QUERY_USER_AGENT = 39
Public Const HTTP_QUERY_SET_COOKIE = 43
Public Const HTTP_QUERY_REQUEST_METHOD = 45
Public Const HTTP_STATUS_DENIED = 401
Public Const HTTP_STATUS_PROXY_AUTH_REQ = 407
‘ Add this flag to the about flags to get request header.
Public Const HTTP_QUERY_FLAG_REQUEST_HEADERS = &H80000000
Public Const HTTP_QUERY_FLAG_NUMBER = &H20000000
‘ Reads data from a handle opened by the HttpOpenRequest function.
Public Declare Function InternetReadFile Lib “wininet.dll” _
(ByVal hFile As Long, ByVal sBuffer As String, ByVal lNumBytesToRead As Long, _
lNumberOfBytesRead As Long) As Integer
Public Declare Function InternetWriteFile Lib “wininet.dll” _
(ByVal hFile As Long, ByVal sBuffer As String, _
ByVal lNumberOfBytesToRead As Long, _
lNumberOfBytesRead As Long) As Integer
Public Declare Function FtpOpenFile Lib “wininet.dll” Alias _
“FtpOpenFileA” (ByVal hFtpSession As Long, _
ByVal sFileName As String, ByVal lAccess As Long, _
ByVal lFlags As Long, ByVal lContext As Long) As Long
Public Declare Function FtpDeleteFile Lib “wininet.dll” _
Alias “FtpDeleteFileA” (ByVal hFtpSession As Long, _
ByVal lpszFileName As String) As Boolean
Public Declare Function InternetSetOption Lib “wininet.dll” Alias “InternetSetOptionA” _
(ByVal hInternet As Long, ByVal lOption As Long, ByRef sBuffer As Any, ByVal lBufferLength As Long) As Integer
Public Declare Function InternetSetOptionStr Lib “wininet.dll” Alias “InternetSetOptionA” _
(ByVal hInternet As Long, ByVal lOption As Long, ByVal sBuffer As String, ByVal lBufferLength As Long) As Integer
‘ Closes a single Internet handle or a subtree of Internet handles.
Public Declare Function InternetCloseHandle Lib “wininet.dll” _
(ByVal hInet As Long) As Integer
‘ Queries an Internet option on the specified handle
Public Declare Function InternetQueryOption Lib “wininet.dll” Alias “InternetQueryOptionA” _
(ByVal hInternet As Long, ByVal lOption As Long, ByRef sBuffer As Any, ByRef lBufferLength As Long) As Integer
‘ Returns the version number of Wininet.dll.
Public Const INTERNET_OPTION_VERSION = 40
‘ Contains the version number of the DLL that contains the Windows Internet
‘ functions (Wininet.dll). This structure is used when passing the
‘ INTERNET_OPTION_VERSION flag to the InternetQueryOption function.
Public Type tWinInetDLLVersion
lMajorVersion As Long
lMinorVersion As Long
End Type
‘ Adds one or more HTTP request headers to the HTTP request handle.
Public Declare Function HttpAddRequestHeaders Lib “wininet.dll” Alias “HttpAddRequestHeadersA” _
(ByVal hHttpRequest As Long, ByVal sHeaders As String, ByVal lHeadersLength As Long, _
ByVal lModifiers As Long) As Integer
‘ Flags to modify the semantics of this function. Can be a combination of these values:
‘ Adds the header only if it does not already exist; otherwise, an error is returned.
Public Const HTTP_ADDREQ_FLAG_ADD_IF_NEW = &H10000000
‘ Adds the header if it does not exist. Used with REPLACE.
Public Const HTTP_ADDREQ_FLAG_ADD = &H20000000
‘ Replaces or removes a header. If the header value is empty and the header is found,
‘ it is removed. If not empty, the header value is replaced
Public Const HTTP_ADDREQ_FLAG_REPLACE = &H80000000
Form:
Dim bActiveSession As Boolean
Dim hOpen As Long, hConnection As Long
Dim dwType As Long
Dim EnumItemNameBag As New Collection
Dim EnumItemAttributeBag As New Collection
Private Sub Form_Load()
bActiveSession = False
hOpen = 0
hConnection = 0
chkPassive.Value = 1
optBin.Value = 1
dwType = FTP_TRANSFER_TYPE_BINARY
Dim imgI As ListImage
Set imgI = ImageList1.ListImages.Add(, “open”, LoadPicture(“open.bmp”))
Set imgI = ImageList1.ListImages.Add(, “closed”, LoadPicture(“closed.bmp”))
Set imgI = ImageList1.ListImages.Add(, “leaf”, LoadPicture(“leaf.bmp”))
Set imgI = ImageList1.ListImages.Add(, “root”, LoadPicture(“root.bmp”))
TreeView1.ImageList = ImageList1
TreeView1.Style = tvwTreelinesPictureText
EnableUI (False)
End Sub
Private Sub Form_Unload(Cancel As Integer)
cmdClosehOpen_Click
End Sub
Private Sub cmdInternetOpen_Click()
If Len(txtProxy.Text) <> 0 Then
hOpen = InternetOpen(scUserAgent, INTERNET_OPEN_TYPE_PROXY, txtProxy.Text, vbNullString, 0)
Else
hOpen = InternetOpen(scUserAgent, INTERNET_OPEN_TYPE_DIRECT, vbNullString, vbNullString, 0)
End If
If hOpen = 0 Then ErrorOut Err.LastDllError, “InternetOpen”
EnableUI (True)
End Sub
Private Sub cmdClosehOpen_Click()
If hConnection <> 0 Then InternetCloseHandle (hConnection)
If hOpen <> 0 Then InternetCloseHandle (hOpen)
hConnection = 0
hOpen = 0
If bActiveSession Then TreeView1.Nodes.Remove txtServer.Text
bActiveSession = False
ClearTextBoxAndBag
EnableUI (False)
End Sub
Private Sub cmdConnect_Click()
If Not bActiveSession And hOpen <> 0 Then
If txtServer.Text = “” Then
MsgBox “Please enter a server name!”
Exit Sub
End If
Dim nFlag As Long
If chkPassive.Value Then
nFlag = INTERNET_FLAG_PASSIVE
Else
nFlag = 0
End If
hConnection = InternetConnect(hOpen, txtServer.Text, INTERNET_INVALID_PORT_NUMBER, _
txtUser, txtPassword, INTERNET_SERVICE_FTP, nFlag, 0)
If hConnection = 0 Then
bActiveSession = False
ErrorOut Err.LastDllError, “InternetConnect”
Else
bActiveSession = True
EnableUI (CBool(hOpen))
FillTreeViewControl (txtServer.Text)
FtpEnumDirectory (“”)
If EnumItemNameBag.Count = 0 Then Exit Sub
FillTreeViewControl (txtServer.Text)
End If
End If
End Sub
Private Sub cmdDisconnect_Click()
bDirEmpty = True
If hConnection <> 0 Then InternetCloseHandle hConnection
hConnection = 0
ClearBag
TreeView1.Nodes.Remove txtServer.Text
bActiveSession = False
EnableUI (True)
End Sub
Private Sub ClearTextBoxAndBag()
txtServer.Text = “”
txtUser.Text = “”
txtPassword.Text = “”
txtProxy.Text = “”
ClearBag
End Sub
Private Sub ClearBag()
Dim Num As Integer
For Num = 1 To EnumItemNameBag.Count
EnumItemNameBag.Remove 1
Next Num
For Num = 1 To EnumItemAttributeBag.Count
EnumItemAttributeBag.Remove 1
Next Num
End Sub
Private Sub FillTreeViewControl(strParentKey As String)
Dim nodX As Node
Dim strImg As String
Dim nCount As Integer, i As Integer
Dim nAttr As Integer
Dim strItem As String
If EnumItemNameBag.Count = 0 And strParentKey = txtServer.Text Then
Set nodX = TreeView1.Nodes.Add(, tvwFirst, txtServer.Text, txtServer.Text, “root”)
Exit Sub
End If
nCount = EnumItemAttributeBag.Count
If nCount = 0 Then Exit Sub
For i = 1 To nCount
nAttr = EnumItemAttributeBag.Item(i)
strItem = EnumItemNameBag(i)
If nAttr = FILE_ATTRIBUTE_DIRECTORY Then
strImg = “closed”
Else
strImg = “leaf”
End If
Set nodX = TreeView1.Nodes.Add(strParentKey, tvwChild, strParentKey & “/” & strItem, _
strParentKey & “/” & strItem, strImg)
Next
nodX.EnsureVisible
End Sub
Private Sub cmdGet_Click()
Dim bRet As Boolean
Dim szFileRemote As String, szDirRemote As String, szFileLocal As String
Dim szTempString As String
Dim nPos As Long, nTemp As Long
Dim nodX As Node
Set nodX = TreeView1.SelectedItem
If bActiveSession Then
If nodX Is Nothing Then
MsgBox “Please select the item to GET!”
Exit Sub
End If
szTempString = TreeView1.SelectedItem.Text
szFileRemote = szTempString
nPos = 0
nTemp = 0
Do
nTemp = InStr(1, szTempString, “/”, vbBinaryCompare)
If nTemp = 0 Then Exit Do
szTempString = Right(szTempString, Len(szTempString) – nTemp)
nPos = nTemp + nPos
Loop
szDirRemote = Left(szFileRemote, nPos)
szFileRemote = Right(szFileRemote, Len(szFileRemote) – nPos)
szFileLocal = File1.Path
rcd szDirRemote
bRet = FtpGetFile(hConnection, szFileRemote, szFileLocal & “/” & szFileRemote, False, _
INTERNET_FLAG_RELOAD, dwType, 0)
File1.Refresh
If bRet = False Then ErrorOut Err.LastDllError, “FtpGetFile”
Else
MsgBox “Not in session”
End If
End Sub
Private Sub cmdPut_Click()
Dim bRet As Boolean
Dim szFileRemote As String, szDirRemote As String, szFileLocal As String
Dim szTempString As String
Dim nPos As Long, nTemp As Long
Dim nodX As Node
Set nodX = TreeView1.SelectedItem
If bActiveSession Then
If nodX Is Nothing Then
MsgBox “Please select a remote directory to PUT to!”
Exit Sub
End If
If nodX.Image = “leaf” Then
MsgBox “Please select a remote directory to PUT to!”
Exit Sub
End If
If File1.FileName = “” Then
MsgBox “Please select a local file to put”
Exit Sub
End If
szTempString = nodX.Text
szDirRemote = Right(szTempString, Len(szTempString) – Len(txtServer.Text))
szFileRemote = File1.FileName
szFileLocal = File1.Path & “\” & File1.FileName
If (szDirRemote = “”) Then szDirRemote = “\”
rcd szDirRemote
bRet = FtpPutFile(hConnection, szFileLocal, szFileRemote, _
dwType, 0)
If bRet = False Then
ErrorOut Err.LastDllError, “FtpPutFile”
Exit Sub
End If
Dim nodChild As Node, nodNextChild As Node
Set nodChild = nodX.Child
Do
If nodChild Is Nothing Then Exit Do
Set nodNextChild = nodChild.Next
TreeView1.Nodes.Remove nodChild.Index
If nodNextChild Is Nothing Then Exit Do
Set nodChild = nodNextChild
Loop
If nodX.Image = “closed” Then
nodX.Image = “open”
End If
FtpEnumDirectory (nodX.Text)
FillTreeViewControl (nodX.Text)
End If
End Sub
Private Sub Dir1_Change()
File1.Path = Dir1.Path
End Sub
Private Sub Drive1_Change()
On Error GoTo ErrProc
Dir1.Path = Drive1.Drive
Exit Sub
ErrProc:
Drive1.Drive = “c:”
Dir1.Path = Drive1.Drive
End Sub
Private Sub rcd(pszDir As String)
If pszDir = “” Then
MsgBox “Please enter the directory to CD”
Exit Sub
Else
Dim sPathFromRoot As String
Dim bRet As Boolean
If InStr(1, pszDir, txtServer.Text) Then
sPathFromRoot = Mid(pszDir, Len(txtServer.Text) + 1, Len(pszDir) – Len(txtServer.Text))
Else
sPathFromRoot = pszDir
End If
If sPathFromRoot = “” Then sPathFromRoot = “/”
bRet = FtpSetCurrentDirectory(hConnection, sPathFromRoot)
If bRet = False Then ErrorOut Err.LastDllError, “rcd”
End If
End Sub
Function ErrorOut(dError As Long, szCallFunction As String)
Dim dwIntError As Long, dwLength As Long
Dim strBuffer As String
If dError = ERROR_INTERNET_EXTENDED_ERROR Then
InternetGetLastResponseInfo dwIntError, vbNullString, dwLength
strBuffer = String(dwLength + 1, 0)
InternetGetLastResponseInfo dwIntError, strBuffer, dwLength
MsgBox szCallFunction & ” Extd Err: ” & dwIntError & ” ” & strBuffer
End If
If MsgBox(szCallFunction & ” Err: ” & dError & _
vbCrLf & “Close Connection and Session?”, vbYesNo) = vbYes Then
If hConnection Then InternetCloseHandle hConnection
If hOpen Then InternetCloseHandle hOpen
hConnection = 0
hOpen = 0
If bActiveSession Then TreeView1.Nodes.Remove txtServer.Text
bActiveSession = False
ClearTextBoxAndBag
EnableUI (False)
End If
End Function
Private Sub EnableUI(bEnabled As Boolean)
txtServer.Enabled = bEnabled
txtUser.Enabled = bEnabled
txtPassword.Enabled = bEnabled
cmdConnect.Enabled = bEnabled And Not bActiveSession
cmdDisconnect.Enabled = bEnabled And bActiveSession
chkPassive.Enabled = bEnabled
cmdClosehOpen.Enabled = bEnabled
cmdInternetOpen.Enabled = Not bEnabled
txtProxy.Enabled = Not bEnabled
optBin.Enabled = bEnabled
optAscii.Enabled = bEnabled
cmdGet.Enabled = bEnabled And bActiveSession
cmdPut.Enabled = bEnabled And bActiveSession
End Sub
Private Sub FtpEnumDirectory(strDirectory As String)
ClearBag
Dim hFind As Long
Dim nLastError As Long
Dim dError As Long
Dim ptr As Long
Dim pData As WIN32_FIND_DATA
If Len(strDirectory) > 0 Then rcd (strDirectory)
pData.cFileName = String(MAX_PATH, 0)
hFind = FtpFindFirstFile(hConnection, “*.*”, pData, 0, 0)
nLastError = Err.LastDllError
If hFind = 0 Then
If (nLastError = ERROR_NO_MORE_FILES) Then
MsgBox “This directory is empty!”
Else
ErrorOut nLastError, “FtpFindFirstFile”
End If
Exit Sub
End If
dError = NO_ERROR
Dim bRet As Boolean
Dim strItemName As String
EnumItemAttributeBag.Add pData.dwFileAttributes
strItemName = Left(pData.cFileName, InStr(1, pData.cFileName, String(1, 0), vbBinaryCompare) – 1)
EnumItemNameBag.Add strItemName
Do
pData.cFileName = String(MAX_PATH, 0)
bRet = InternetFindNextFile(hFind, pData)
If Not bRet Then
dError = Err.LastDllError
If dError = ERROR_NO_MORE_FILES Then
Exit Do
Else
ErrorOut dError, “InternetFindNextFile”
InternetCloseHandle (hFind)
Exit Sub
End If
Else
EnumItemAttributeBag.Add pData.dwFileAttributes
strItemName = Left(pData.cFileName, InStr(1, pData.cFileName, String(1, 0), vbBinaryCompare) – 1)
EnumItemNameBag.Add strItemName
End If
Loop
InternetCloseHandle (hFind)
End Sub
Private Sub optAscii_Click()
dwType = FTP_TRANSFER_TYPE_ASCII
End Sub
Private Sub optBin_Click()
dwType = FTP_TRANSFER_TYPE_BINARY
End Sub
Private Sub TreeView1_DblClick()
Dim nodX As Node
Set nodX = TreeView1.SelectedItem
If Not bActiveSession Then
MsgBox “No in session!”
Exit Sub
End If
If nodX Is Nothing Then
MsgBox “no Selection to enumerate”
End If
If nodX.Image = “closed” Then
nodX.Image = “open”
FtpEnumDirectory (nodX.Text)
FillTreeViewControl (nodX.Text)
Else
If nodX.Image = “open” Then
nodX.Image = “closed”
Dim nodChild As Node, nodNextChild As Node
Set nodChild = nodX.Child
Do
Set nodNextChild = nodChild.Next
TreeView1.Nodes.Remove nodChild.Index
If nodNextChild Is Nothing Then Exit Do
Set nodChild = nodNextChild
Loop
End If
End If
End Sub
Posted by Administrator in 07:28:56 | Permalink | No Comments »
Ping Network dgn VB
Option Explicit
Const SYNCHRONIZE = &H100000
Const INFINITE = &HFFFF
Const WAIT_OBJECT_0 = 0
Const WAIT_TIMEOUT = &H102
Dim stopflag As Boolean
Dim errorflag As Boolean
Dim mindelay As Integer
Dim maxdelay As Integer
Dim totaldelay As Long
Dim avgdelay As Integer
Dim lcount As Long
Dim pingMessage(26) As String
Dim ctrl
Private Declare Function SendMessage Lib “User32″ Alias “SendMessageA” (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Declare Function OpenProcess Lib “kernel32″ (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As Long
Private Declare Function WaitForSingleObject Lib “kernel32″ (ByVal hHandle As Long, ByVal dwMilliseconds As Long) As Long
Private Declare Function CloseHandle Lib “kernel32″ (ByVal hObject As Long) As Long
Private Sub cmdClear_Click()
Open “C:\log.txt” For Output As #1
Close #1
txtoutput.Text = “”
txtpinglog.Text = “”
End Sub
Private Sub chklog_Click()
End Sub
Private Sub cmdExit_Click()
Unload Me
End
End Sub
Private Sub cmdlog_Click()
Load frmlog
frmlog.Show 1
End Sub
Private Sub cmdPing_Click()
DoEvents
If cmdPing.Caption = “Ping” Then
lblstatus.Caption = “Pinging ” & txtIP.Text & ” with ” & txtbuffer.Text & “KB of data”
txtIP.Locked = True
cmdPing.BackColor = &HFF&
cmdlog.Enabled = False
cmdPing.Caption = “Stop”
stopflag = False
Else
stopflag = True
cmdPing.Caption = “Ping”
txtIP.Locked = False
cmdPing.BackColor = &H80FF80
cmdlog.Enabled = True
lblstatus.Caption = “Stopped”
End If
While stopflag = False
DoEvents
Dim ShellX As String
Dim lPid As Long
Dim lHnd As Long
Dim lRet As Long
Dim VarX As String
Dim Ptime As Integer
Dim pttl As Integer
Dim pbyte As Integer
Dim i As Integer
Dim pingresult As String
Dim tmin As Integer
Dim tmax As Integer
Dim tavg As Integer
If txtIP.Text <> “” Then
DoEvents
ShellX = Shell(“command.com /c ping -n 1 -l ” & txtbuffer.Text & ” ” & txtIP.Text & ” > C:\log.txt”, vbHide)
lPid = ShellX
If lPid <> 0 Then
lHnd = OpenProcess(SYNCHRONIZE, 0, lPid)
If lHnd <> 0 Then
lRet = WaitForSingleObject(lHnd, INFINITE)
CloseHandle (lHnd)
End If
frmmain.MousePointer = 0
Open “C:\log.txt” For Input As #1
txtoutput.Text = Input(LOF(1), 1)
pingresult = Trim(Mid(txtoutput.Text, InStr(1, txtoutput.Text, “:”) + 1, Len(txtoutput.Text) – (InStr(1, txtoutput.Text, “:”) + Len(Mid(txtoutput.Text, InStr(1, txtoutput.Text, “Ping “))))))
‘check for error
If InStr(1, pingresult, “Reply”) = 0 Then
Dim message As String
If InStr(1, pingresult, “Hardware”) <> 0 Then
message = “HARDWARE FAULT”
Else
If InStr(1, pingresult, “Request”) <> 0 Then
message = “Request time out”
Else
If InStr(1, pingresult, “Destination”) <> 0 Then
message = “Destination Computer is not reachable”
Else
message = pingresult
End If
End If
End If
pingresult = “ERROR with ” & txtIP.Text & “:” & message
‘pingmessage
txtpinglog.Text = “”
For i = 0 To 22
pingMessage(i) = pingMessage(i + 1)
If pingMessage(i + 1) <> “” Then
If txtpinglog.Text <> “” Then
txtpinglog.Text = txtpinglog.Text & vbCrLf
End If
txtpinglog.Text = txtpinglog.Text & pingMessage(i + 1)
End If
Next
pingMessage(23) = pingresult
If txtpinglog.Text <> “” Then
txtpinglog.Text = txtpinglog.Text & vbCrLf
End If
txtpinglog.Text = txtpinglog.Text & pingresult
For i = 0 To 31
pbrtime(i).Value = pbrtime(i + 1).Value
Next
pbrtime(32).Value = 0
‘loging
If chklog.Value = 1 Then
If errorflag = False Then
errorflag = True
Open “c:\pinglog.txt” For Append As #2
Print #2, Now
Print #2, pingresult
Print #2, String(91, “*”)
Close #2
End If
End If
lcount = 0
mindelay = 0
maxdelay = 0
avgdelay = 0
totaldelay = 0
lblmin = mindelay
lblmax = maxdelay
lblavg = avgdelay
Else
lcount = lcount + 1
Ptime = CInt(Mid(txtoutput.Text, InStr(1, txtoutput.Text, “time”) + 5, InStr(1, txtoutput.Text, “ms “) – InStr(1, txtoutput.Text, “time”) – 5))
pbyte = CInt(Mid(txtoutput.Text, InStr(1, txtoutput.Text, “bytes=”) + 6, InStr(1, txtoutput.Text, ” time”) – InStr(1, txtoutput.Text, “bytes=”) – 6))
pttl = CInt(Mid(pingresult, InStr(1, pingresult, “TTL=”) + 4, Len(pingresult) – InStr(1, pingresult, “TTL=”) – 5))
tmin = CInt(Mid(txtoutput.Text, InStr(1, txtoutput.Text, “Minimum = “) + 10, InStr(InStr(1, txtoutput.Text, “Minimum = “), txtoutput.Text, “ms,”) – InStr(1, txtoutput.Text, “Minimum = “) – 10))
tmax = CInt(Mid(txtoutput.Text, InStr(1, txtoutput.Text, “Maximum = “) + 10, InStr(InStr(1, txtoutput.Text, “Maximum = “), txtoutput.Text, “ms,”) – InStr(1, txtoutput.Text, “Maximum = “) – 10))
tavg = CInt(Mid(txtoutput.Text, InStr(1, txtoutput.Text, “Average = “) + 10, InStr(InStr(1, txtoutput.Text, “Average = “), txtoutput.Text, “ms”) – InStr(1, txtoutput.Text, “Average = “) – 10))
If mindelay = 0 Then mindelay = tmin
If tmin < mindelay Then
mindelay = tmin
End If
If tmax > maxdelay Then
maxdelay = tmax
End If
totaldelay = totaldelay + tavg
avgdelay = CInt(totaldelay / lcount)
lblmin = mindelay
lblmax = maxdelay
lblavg = avgdelay
If avgdelay > 0 Then
For Each ctrl In frmmain
If TypeOf ctrl Is ProgressBar Then
ctrl.Max = avgdelay * 10
End If
Next
End If
pingresult = “Reply from ” & txtIP.Text & “: bytes=” & pbyte & ” time=” & Ptime & “ms TTL=” & pttl
txtpinglog.Text = “”
For i = 0 To 22
pingMessage(i) = pingMessage(i + 1)
If pingMessage(i + 1) <> “” Then
If txtpinglog.Text <> “” Then
txtpinglog.Text = txtpinglog.Text & vbCrLf
End If
txtpinglog.Text = txtpinglog.Text & pingMessage(i + 1)
End If
Next
pingMessage(23) = pingresult
If txtpinglog.Text <> “” Then
txtpinglog.Text = txtpinglog.Text & vbCrLf
End If
txtpinglog.Text = txtpinglog.Text & pingresult
‘loging
If chklog.Value = 1 Then
If errorflag = True Then
errorflag = False
Open “c:\pinglog.txt” For Append As #2
Print #2, Now
Print #2, “Reconnected with ” & txtIP.Text
Print #2, String(91, “*”)
Close #2
End If
End If
On Error Resume Next
Ptime = CInt(Mid(txtoutput.Text, InStr(1, txtoutput.Text, “time=”) + 5, InStr(1, txtoutput.Text, “ms “) – InStr(1, txtoutput.Text, “time=”) – 5))
For i = 0 To 31
pbrtime(i).Value = pbrtime(i + 1).Value
Next
pbrtime(32).Value = Ptime
End If
Close #1
End If
Else
frmmain.MousePointer = 0
VarX = MsgBox(“You have not entered an ip address or the number of times you want to ping.”, vbCritical, “Error has occured”)
End If
Wend
End Sub
Private Sub Command1_Click()
Load frmAbout
frmAbout.Show 1
End Sub
Private Sub Form_Load()
errorflag = False
totaldelay = 0
mindelay = 0
maxdelay = 0
avgdelay = 0
lcount = 0
Open “C:\log.txt” For Output As #1
Close #1
End Sub
Private Sub SelectText(ByRef textObj As RichTextBox)
textObj.SelStart = 0
textObj.SelLength = Len(textObj)
End Sub
Private Sub Label6_Click()
End Sub
Private Sub Form_Unload(Cancel As Integer)
End
End Sub
Private Sub Label2_Click()
End Sub
Private Sub Slider1_Change()
Select Case Slider1.Value
Case 0: txtbuffer.Text = 1000
Case 1: txtbuffer.Text = 2000
Case 2: txtbuffer.Text = 3000
Case 3: txtbuffer.Text = 4000
End Select
lcount = 0
mindelay = 0
maxdelay = 0
avgdelay = 0
totaldelay = 0
lblmin = mindelay
lblmax = maxdelay
lblavg = avgdelay
End Sub
Private Sub Timer1_Timer()
End Sub
Private Sub txtIP_GotFocus()
Call SelectText(txtIP)
End Sub
Private Sub txtOutput_GotFocus()
‘ Call SelectText(txtoutput)
End Sub
Private Sub txtStatus_Click()
txtIP.SetFocus
End Sub
Posted by Administrator in 05:37:03 | Permalink | No Comments »
Langganan:
Postingan (Atom)