Uw beste bron van informatie en nieuws ongeveer bestuurders, geheimen en winvista op Internet

De ARTIKELEN van het uitzicht BOVENKANT 50 De VIDEO'S van het uitzicht SOFT van het uitzicht De HULP van het uitzicht

De Chaos van het klembord!


Nota: deze inhoud oorspronkelijk van http://mygreenpaste.blogspot.com. Als u het van één of andere andere plaats leest, te vergen gelieve de tijd te bezoeken Mijn Groen Deeg, N.v.. Dank u.

O.K., zodat misschien is de chaos hier een weinig een ruw woord. Maar het klembord dreef me onlangs noten! Alle probeerde ik te doen was exemplaar één of andere tekst aan het, en de verrichting ontbrak. Natuurlijk, aangezien het ad hoc app was, had ik geen soort fout behandeling. App werkte enkel fijn aan één systeem, maar het runnen van app op een ander systeem (een virtuele machine) resulteerde constant in het nalaten om de tekst aan het klembord te kopiëren.

Uiteindelijk, kon ik bepalen welk proces mijn app verhinderde gegevens in het klembord te zetten, maar ik heb nog niet een fatsoenlijke alternerende actie gevonden voor wanneer het probleem gebeurt. Het is niet kritiek voor me, als handeling van het kopiëren van de tekst aan het klembord is meer van een finesse dan een vereiste.

In elk geval, gebruikend P/Invoke en System.Diagnostics, vond ik dat vmusrvc.exe - Virtuele PC de „Virtuele Diensten van de Gebruiker van de Machine“ - het open klembord had. Het gebruiken van timestamps van De Monitor van het proces's Gebeurtenissen profileren (die met 100 Mej.intervallen worden geproduceerd), en timestamp die van de ontbroken verrichting van mijn app, kon ik de stapel van vmusrvc.exe bepalen:

ntdll.dllKiFastSystemCallRet
vmusrvc.exevmusrvc.exe + 0x9a17
vmusrvc.exevmusrvc.exe + 0x9c24
vmusrvc.exevmusrvc.exe + 0x91f8
vmusrvc.exevmusrvc.exe + 0x907f
USER32.dllInternalCallWinProc + 0x28
USER32.dllUserCallWinProcCheckWow + 0x150
USER32.dllDispatchClientMessage + 0xa3
USER32.dll__fnDWORD + 0x24
ntdll.dllKiUserCallbackDispatcher + 0x13
vmusrvc.exevmusrvc.exe + 0x2d29
vmusrvc.exevmusrvc.exe + 0xdba6
kernel32.dllBaseProcessStart + 0x23

Geen parameters, natuurlijk, en symboolinformatie voor vmusrvc.exe schijnen niet beschikbaar te zijn, maar verwerkt user32.dll duidelijk één of ander bericht. Ik kan dit meer op een recenter punt onderzoeken.

Om het proces te vinden dat zich in mijn klembordwerk mengde, gebruikte ik P/Invoke roepen GetOpenClipboardWindow() en toen GetWindowThreadProcessId(), overgaand in het handvat dat door GetOpenClipboardWindow is teruggekeerd (). Dan, was het vinden van de uitvoerbare naam van de processen enkel een kwestie gebruiken Modules inzameling van Proces instantie die door over te gaan in procesidentiteitskaart is teruggekeerd die door GetWindowThreadProcessId () wordt teruggewonnen tot System.Diagnostics.Process.GetProcessById().

De volgende code:

het gebruiken van System.Runtime.InteropServices;
het gebruiken van System.Diagnostics;
...
koord gegevens = „aasdlkjasdlk alkjsdl kajsdlkj al“;
probeer
{
Clipboard.SetData (System.Windows.Forms.DataFormats.Text, gegevens);
}
vangst (ExternalException EE)
{
LogIt (ee.ToString ());
IntPtr hWnd = GetOpenClipboardWindow ();
als (IntPtr.Zero! = hWnd)
{
uint pid = 0;
uint tid = GetWindowThreadProcessId (hWnd, uit pid);
LogIt („Proces met hWnd {0}, PID {1} ({1: x}), TID {2} ({2: x}),“ +
de „naam {3} heeft het klembord“, hWnd, pid, tid,
Process.GetProcessById( (int)pid ).Modules[0].FileName );
}
}

Resulted in the following output:


2008-03-25 00:54:45.4938864--> System.Runtime.InteropServices.ExternalException: Requested Clipboard operation did not succeed.
at System.Windows.Forms.Clipboard.ThrowIfFailed(Int32 hr)
at System.Windows.Forms.Clipboard.SetDataObject(Object data, Boolean copy, Int32 retryTimes, Int32 retryDelay)
at System.Windows.Forms.Clipboard.SetData(String format, Object data)
at Clippy.Form1.button1_Click(Object sender, EventArgs e)
2008-03-25 00:54:45.5339440--> Process with hWnd 65716 (65716), PID 1492 (5d4), TID 1496 (5d8), name C:\Program Files\Virtual Machine Additions\vmusrvc.exe has the clipboard

Interestingly, trying an alternative method of the Clipboard to set the content also failed. The Clipboard.SetDataObject() overload that takes a retryTimes and retryDelay parameter failed in the same fashion after roughly ten seconds when invoked as follows:


Clipboard.SetDataObject( data, false, 100, 100 );

I tried variations on retryTimes and retryDelay, to no avail.

Not sure what vmusrvc.exe is doing with the clipboard (probably has to do with monitoring it for host / guest VM interaction), but the act of setting the contents of the clipboard didn't fail 100% of the time in the VM. Often enough to make it extremely unreliable, though. During "normal" system usage, I was not able to cause a failure when running the app on a non-virtual (actual?) system.

Popularity: 2%


Written by «/\/\Ø|ö±ò\/»®©. Read more great feeds at is source WEBSITE
no comments.
Read more articles on P/Invoke and GetOpenClipboardWindow and System.Diagnostics and Clipboard and GetWindowThreadProcessId and Process Monitor and c# and processes and Virtual Machine and otherSoftware and Virtual PC.

No comments

There are still no comments on this article.

Leave your comment...

If you want to leave your comment on this article, simply fill out the next form:




You can use these XHTML tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong> .