La vostra fonte migliore delle informazioni e delle notizie circa finestre, driver e microsoft sul Internet

ARTICOLI del Vista PRINCIPALE 50 Vista VIDEOS Vista MOLLE AIUTO del Vista

Caos del Clipboard!


Nota: questo soddisfare originalmente da http://mygreenpaste.blogspot.com. Se siete lettura esso da un certo altro luogo, occorra prego tempo visitare La mia colla verde, inc. Grazie.

L'APPROVAZIONE, in modo da forse caos è un po'di una parola dura qui. Ma il clipboard recentemente stava guidandolo dadi! Tutto che sterà provando a fare era di copiare un certo testo ad esso ed il funzionamento stava venendo a mancare. Naturalmente, poichè era un app ad-hoc, non ho avuto alcun genere di trattamento degli errori. Il app ha funzionato l'indennità giusta su un sistema, ma fare funzionare il app su un altro sistema (una macchina virtuale) ha provocato costantemente l'omissione di copiare il testo al clipboard.

Infine, potevo determinare che processo stava impedendo il mio app mettere i dati nel clipboard, ma ancora non ho trovato un workaround decent per quando il problema accade. Non è critico per me, come l'atto di copiatura del testo al clipboard è più di una delicatezza che un requisito.

In ogni modo, usando P/Invoke e System.Diagnostics, Ho trovato che vmusrvc.exe - il pc virtuale “utente virtuale della macchina assiste„ - ha avuto il clipboard aperto. Usando i timestamps da Video trattato's che profilano gli eventi (generati a 100 intervalli della spettrografia di massa) ed il timestamp del funzionamento guastato dal mio app, potevo determinare la pila di vmusrvc.exe:

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

Nessun parametro, user32.dll sta procedendo naturalmente e le informazioni di simbolo per vmusrvc.exe non sembrano essere disponibili, ma ovviamente un certo messaggio. Posso esaminare questo più un punto successivo.

Per trovare il processo che stava interferendo con il mio lavoro del clipboard, ho usato P/Invoke per denominare GetOpenClipboardWindow() ed allora GetWindowThreadProcessId(), passando nella maniglia restituita da GetOpenClipboardWindow (). Allora, trovare il nome eseguibile dei processi era semplicemente un aspetto di usando Moduli accumulazione del Processo il caso ha rinviato passando nell'identificazione trattata richiamata da GetWindowThreadProcessId () a System.Diagnostics.Process.GetProcessById().

Il seguente codice:

usando System.Runtime.InteropServices;
usando System.Diagnostics;
...
metta insieme i dati = “Al del kajsdlkj del alkjsdl del aasdlkjasdlk„;
prova
{
Clipboard.SetData (System.Windows.Forms.DataFormats.Text, dati);
}
fermo (ee di ExternalException)
{
LogIt (ee.ToString ());
hWnd = GetOpenClipboardWindow di IntPtr ();
se (IntPtr.Zero! = hWnd)
{
pid del uint = 0;
tid del uint = GetWindowThreadProcessId (hWnd, fuori pid);
LogIt (“processo con hWnd {0}, PID {1} ({1: x}), TID {2} ({2: x}),„ +
“il nome {3} ha il clipboard„, hWnd, il pid, il 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> .