![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | Drag&Drop with Powershell Hi i'm trying to implement a dragdrop-functionality in my PS-script, but i can't get it work. I'm not very experienced in programming so could s.o. please tell what i've got to do? I want to write a script with one form. It should be able to "read" the path of a directory witch i dragdrop from WindowsExplorer to my form. If i try to set the AllowDrop-Property i get this error: (i cant take much out of it, maybe you can) ************** Ausnahmetext ************** System.InvalidOperationException: Fehler bei der DragDrop-Registrierung ---> System.Threading.ThreadStateException: Für den aktuellen Thread muss der STA-Modus (Single Thread Apartment) festgelegt werden, bevor OLE-Aufrufe ausgeführt werden können. Stellen Sie sicher, dass die Hauptfunktion mit STAThreadAttribute gekennzeichnet ist. bei System.Windows.Forms.Control.SetAcceptDrops(Boolean accept) --- Ende der internen Ausnahmestapelüberwachung --- Maybe s.o. can post the code needed to achieve that. |
My System Specs![]() |
| | #2 (permalink) |
| | Re: Drag&Drop with Powershell Thallid wrote: Quote: > Hi i'm trying to implement a dragdrop-functionality in my PS-script, but i > can't get it work. > > I'm not very experienced in programming so could s.o. please tell what i've > got to do? > I want to write a script with one form. It should be able to "read" the path > of a directory witch i dragdrop from WindowsExplorer to my form. > > If i try to set the AllowDrop-Property i get this error: (i cant take much > out of it, maybe you can) > ************** Ausnahmetext ************** > System.InvalidOperationException: Fehler bei der DragDrop-Registrierung ---> > System.Threading.ThreadStateException: Für den aktuellen Thread muss der > STA-Modus (Single Thread Apartment) festgelegt werden, bevor OLE-Aufrufe > ausgeführt werden können. Stellen Sie sicher, dass die Hauptfunktion mit > STAThreadAttribute gekennzeichnet ist. > bei System.Windows.Forms.Control.SetAcceptDrops(Boolean accept) > --- Ende der internen Ausnahmestapelüberwachung --- > > > Maybe s.o. can post the code needed to achieve that. refers to "STA". Check this post for some help: http://blogs.msdn.com/powershell/arc...on-thread.aspx The above applies basically for PowerShell v1. v2 is currently out as a preview release. CTP2 provides built-in functionality for being able to run in STA mode. "Jaykul" talks about STA here, for example: http://huddledmasses.org/wpf-from-po...splash-screen/ Marco -- Microsoft MVP - Windows PowerShell http://www.microsoft.com/mvp PowerGadgets MVP http://www.powergadgets.com/mvp Blog: http://marcoshaw.blogspot.com |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| drag and drop | .NET General | |||
| Drag and Drop | General Discussion | |||
| Why I can't I Drag and Drop??? | Vista mail | |||
| Access denied trying to "md"? Drag & Drop is now drag, drop, OK, OK ???? | Vista installation & setup | |||