How to Debug a Windows Vista Sidebar Gadget With Visual Studio Cara Debug Windows Vista Sidebar Gadget Dengan Visual Studio
One of the ancillary benefits of our Salah satu manfaat tambahan dari kami Vista Gadget breaking Vista Gadget melanggar and my email filling up with complaints was that I learned how to debug a Vista Gadget in Visual Studio, so I'm sharing the wealth with everybody. dan email saya mengisi dengan keluhan adalah bahwa saya belajar bagaimana untuk men-debug sebuah Vista Gadget dalam Visual Studio, jadi aku berbagi kekayaan dengan semua orang.
For this exercise you'll need a copy of Visual Studio 2005 and a broken Vista Gadget, but you can probably adapt it to work with a different tool if you try. Untuk latihan ini Anda akan memerlukan salinan Visual Studio 2005 dan patah Vista Gadget, tapi Anda mungkin bisa beradaptasi untuk bekerja dengan alat yang berbeda jika Anda mencoba.
Critical Step: Enable Script Debugging Langkah Kritis: Aktifkan Script Debugging
Open up Internet Explorer's Options panel, find the Advanced tab and uncheck the boxes for “Disable script debugging”. Buka Internet Explorer's Pilihan panel, cari tab Advanced kemudian hapus centang pada kotak untuk "Disable script debugging".

After you are done debugging you'll probably want to turn this off, as it can get quite annoying while browsing. Setelah anda selesai melakukan debugging Anda mungkin ingin mengubah ini off, karena bisa sangat mengganggu saat browsing.
Open Your Gadget Code Buka Kode Gadget Anda
After installing your gadget, Windows will unpack and copy the files to a folder in your user profile. Setelah menginstal gadget Anda, Windows akan membongkar dan menyalin file ke folder dalam profil pengguna Anda. We'll need to find this folder and open the javascript file that makes up the logic for your gadget. Kita akan perlu untuk menemukan folder ini dan membuka file javascript yang membentuk logika untuk gadget Anda.
Just paste the following into the Explorer address bar: Hanya paste berikut ini pada kolom alamat Explorer:
%LOCALAPPDATA%\Microsoft\Windows Sidebar\Gadgets % LOCALAPPDATA% \ Microsoft \ Windows Sidebar \ Gadgets

You'll see a list of directories for all the gadgets installed into your profile. Anda akan melihat daftar direktori untuk semua gadget diinstal ke profil Anda. Open up the main javascript file in Visual Studio. Bukalah file javascript utama dalam Visual Studio.
Attach to Sidebar Process Lampirkan ke Sidebar Proses
Next we'll need to attach to the specific sidebar process for your gadget. Selanjutnya kita harus melekat pada proses sidebar khusus untuk gadget Anda. (Make sure your gadget is running before you do this step) (Pastikan gadget Anda sedang berjalan sebelum Anda melakukan langkah ini)
Go to Tools \ Attach to Process or hit Ctrl+Alt+P to bring up the dialog. Go to Tools \ Lampirkan untuk Proses atau tekan Ctrl + Alt + P untuk membuka dialog.

Now you should look for a process named “sidebar.exe” with the title set to the name of your gadget, and then click the Attach button. Sekarang Anda harus mencari sebuah proses yang bernama "sidebar.exe" dengan judul ubah ke nama gadget Anda, dan kemudian klik tombol Attach.

For a close-up view, you can see that the gadget is running under a separate process from the main sidebar, but the title is set to “How-To Geek”. Untuk tampilan close-up, Anda dapat melihat bahwa gadget sedang berjalan di bawah sebuah proses terpisah dari sidebar utama, tapi judul diatur ke "How-To Geek". 
Now comes the critical step… click to set a breakpoint just to the left of the white area… Sekarang tiba langkah kritis ... klik untuk menetapkan breakpoint hanya untuk di sebelah kiri area putih ...

If all goes well, you will immediately be taken to a new file named something like x-gadget:///main.js and your debugging tools will become active as soon as the breakpoint is hit. Jika semuanya berjalan dengan baik, Anda akan segera dibawa ke sebuah file baru bernama sesuatu seperti x-gadget: / / / main.js dan alat debugging Anda akan menjadi aktif segera setelah terkena breakpoint.

Note that you can't modify this file, but you can use the Immediate Window to test out any code in real-time. Perlu diketahui bahwa Anda tidak dapat memodifikasi file ini, tetapi Anda dapat menggunakan Immediate Window untuk menguji kode apapun secara real-time.
Important Notes Penting Catatan
- When debugging a gadget that polls every so often, it would be wise to set the interval really low so that you don't have to wait very long for it to trigger. Ketika mencari kesalahan jajak pendapat setiap gadget yang sering, akan lebih bijaksana untuk mengatur interval benar-benar rendah sehingga Anda tidak perlu menunggu terlalu lama untuk itu untuk memicu.
- You can make changes in the original source file, but you will have to close/reopen the gadget and then re-attach to it. Anda dapat membuat perubahan dalam file sumber aslinya, tetapi Anda harus menutup / membuka kembali gadget dan kemudian lampirkan kembali ke sana.
- If you get an error about no symbols being loaded, you didn't follow the first step to enable script debugging. Jika anda mendapatkan error tentang tidak ada simbol-simbol yang dimuat, Anda tidak mengikuti langkah pertama untuk mengaktifkan script debugging.
- You'll have to manually enter the names of variables to watch in the Watch box, but you can step through the gadget just like a real debugger should. Anda harus secara manual memasukkan nama-nama variabel untuk menonton di kotak Watch, tetapi Anda dapat melangkah melalui gadget seperti debugger real seharusnya.
Happy debugging! Happy debugging!

Daily Email Updates Harian Email Pembaharuan
You can get our how-to articles in your inbox each day for free. Anda bisa mendapatkan kita bagaimana-untuk artikel dalam kotak masuk Anda setiap hari secara gratis. Just enter your name and email below: Cukup masukkan nama dan email Anda di bawah ini:



[quote]If you get an error about no symbols being loaded, you didn't follow the first step to enable script debugging.[/quote] [quote] Jika anda mendapatkan error tentang tidak ada simbol-simbol yang dimuat, Anda tidak mengikuti langkah pertama untuk mengaktifkan script debugging. [/ quote]
Or you didn't completely restart sidebar.exe. Atau Anda tidak sepenuhnya restart sidebar.exe. Running VistaSP2, IE8, VS2008. Menjalankan VistaSP2, IE8, VS2008. Restart of sidebar.exe was required to reload the debugging settings. Me-restart sidebar.exe diperlukan untuk reload pengaturan debugging.