How to Debug a Windows Vista Sidebar Gadget With Visual Studio Kā Debug Windows Vista Sidebar Gadget With Visual Studio
One of the ancillary benefits of our Viens no papildu ieguvumi no mūsu Vista Gadget breaking Vista ierīču sadalīšana 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. un mana e-pasta iepildot sūdzības bija, ka es iemācījos atkļūdošanas Vista ierīču, izmantojot Visual Studio, tāpēc es esmu sadales labklājībā ar visiem.
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. Attiecībā uz šo uzdevumu jums būs nepieciešama kopiju Visual Studio 2005 un šķelto Vista ierīču, bet varat droši pielāgotu to darbam ar citu instrumentu, ja jūs mēģināt.
Critical Step: Enable Script Debugging Kritisks solis: Enable Script Debugging
Open up Internet Explorer's Options panel, find the Advanced tab and uncheck the boxes for “Disable script debugging”. Atvērt Internet Explorer opciju panelī atrodiet Advanced un neatķeksējiet rūtiņas "Disable script debugging".

After you are done debugging you'll probably want to turn this off, as it can get quite annoying while browsing. Pēc tam, kad esat beidzis atkļūdošana jūs varbūt vēlaties izslēgt šo funkciju, jo tā var iegūt diezgan kaitinošas pārlūkošanas laikā.
Open Your Gadget Code Open Your Gadget kods
After installing your gadget, Windows will unpack and copy the files to a folder in your user profile. Pēc instalēšanas savu sīkrīku, Windows izkravāt un kopēt failus uz mapi jūsu lietotāja profils. We'll need to find this folder and open the javascript file that makes up the logic for your gadget. Mums būs jāatrod šo mapi un atvērt javascript failu, kas veido loģiku savu sīkrīku.
Just paste the following into the Explorer address bar: Tikai ielīmējiet šādus aspektus Explorer adrešu joslā:
%LOCALAPPDATA%\Microsoft\Windows Sidebar\Gadgets % LOCALAPPDATA% \ Microsoft \ Windows sānjoslas \ sīkrīkus

You'll see a list of directories for all the gadgets installed into your profile. Jūs redzēsiet direktoriju sarakstu visu sīkrīkus uzstādīt jūsu profilu. Open up the main javascript file in Visual Studio. Atvērtu galveno javascript failu Visual Studio.
Attach to Sidebar Process Pievienot Sidebar Process
Next we'll need to attach to the specific sidebar process for your gadget. Nākamais mums būs nepieciešams pievienot īpašus Sidebar process jūsu sīkrīku. (Make sure your gadget is running before you do this step) (Pārliecinieties, vai jūsu sīkrīku darbojas pirms jūs šo soli)
Go to Tools \ Attach to Process or hit Ctrl+Alt+P to bring up the dialog. Iet uz Tools \ Pievienojiet uz procesu vai nospiediet Ctrl + Alt + P lai atvērtu dialogu.

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. Tagad jums vajadzētu meklēt process ar nosaukumu "sidebar.exe" ar nosaukumu, kas ir nosaukums jūsu sīkrīku, un pēc tam noklikšķiniet uz Pievienot pogu.

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”. For-tuvu skatu, var redzēt, ka sīkrīku darbojas saskaņā ar atsevišķu procesu no galvenajiem sānjoslas, bet virsraksts ir iestatīts uz "How-To Geek". 
Now comes the critical step… click to set a breakpoint just to the left of the white area… Tagad ir izšķirīgs solis ... Klikšķiniet, lai noteikto pārtraukumpunkts tikai pa kreisi no baltās zonas ...

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. Ja viss noritēs labi, jūs nekavējoties tiks veikti jaunu faila nosaukumu kaut kā x-sīkrīks: / / / main.js un jūsu atkļūdošana instrumenti kļūst aktīvas, tiklīdz koncentrācija ir hit.

Note that you can't modify this file, but you can use the Immediate Window to test out any code in real-time. Ievērojiet, ka jūs nevar modificēt šo failu, bet jūs varat izmantot Immediate Logu izmēģināt jebkuru kodu reālā laikā.
Important Notes Svarīgas piezīmes
- 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. Kad atkļūdošana sīkrīku, kas aptaujas ik tik bieži, ka būtu saprātīgi noteikt intervālu tiešām zems, lai jums nebūtu jāgaida ļoti ilgi, lai to ierosinātājs.
- You can make changes in the original source file, but you will have to close/reopen the gadget and then re-attach to it. Jūs varat veikt izmaiņas oriģinālajā avota failā, bet tev ir aizvērt / atvērt sīkrīku un tad atkal pievienojiet to.
- If you get an error about no symbols being loaded, you didn't follow the first step to enable script debugging. Ja Jums kļūda par ne simboli iekraušanas neesat sekot pirmais solis, lai 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. Jums būs manuāli ievadītu mainīgo lielumu nosaukumus sardzes Watch kastē, bet Jūs varat soli pa sīkrīku gluži kā īsta atkļūdotājs vajadzētu.
Happy debugging! Happy atkļūdošana!

Daily Email Updates Daily Email Updates
You can get our how-to articles in your inbox each day for free. Jūs varat saņemt mūsu how-to rakstus savā pastkastītē katru dienu par brīvu. Just enter your name and email below: Vienkārši ievadiet jūsu vārdu un e-pasta zemāk:



[quote]If you get an error about no symbols being loaded, you didn't follow the first step to enable script debugging.[/quote] [quote] Ja jums kļūda par ne simboli iekraušanas neesat sekot pirmais solis, lai script debugging. [/ quote]
Or you didn't completely restart sidebar.exe. Vai jūs neesat pilnīgi restart sidebar.exe. Running VistaSP2, IE8, VS2008. Running VistaSP2, IE8, VS2008. Restart of sidebar.exe was required to reload the debugging settings. Atsākot sidebar.exe bija nepieciešams pārlādēt atkļūdošanas uzstādījumus.