我们所有的测试盒都在VM上运行(Windows Server 2003/08),测试人员只能通过远程桌面访问它们.
某些维护步骤需要从系统中踢出所有用户并通过远程桌面停用访问权限.
我开始在powershell中编写维护脚本,并且正在寻找暂时停用远程桌面的方法.这是可能的,任何直接的解决方案吗?
到目前为止我尝试了什么:
任何提示高度赞赏.
干杯,托比
我使用以下代码在Swift Playground中接收MIDI事件:
import Cocoa
import CoreMIDI
import XCPlayground
XCPSetExecutionShouldContinueIndefinitely(continueIndefinitely: true)
func notifyCallback(message:UnsafePointer<MIDINotification>,refCon:UnsafeMutablePointer<Void>)
{
println("MIDI Notify")
}
func eventCallback(pktlist:UnsafePointer<MIDIPacketList>, refCon:UnsafeMutablePointer<Void>, connRefCon:UnsafeMutablePointer<Void>)
{
println("MIDI Read")
}
var client = MIDIClientRef()
MIDIClientCreate("Core MIDI Callback Demo" as NSString, MIDINotifyProc(COpaquePointer([notifyCallback])), nil, &client)
var inPort = MIDIPortRef()
MIDIInputPortCreate(client, "Input port",MIDIReadProc(COpaquePointer([eventCallback])), nil, &inPort)
let sourceCount = MIDIGetNumberOfSources()
for var count:UInt = 0; count < sourceCount; ++count
{
let src:MIDIEndpointRef = MIDIGetSource(count)
MIDIPortConnectSource(inPort, src, nil)
}
Run Code Online (Sandbox Code Playgroud)
我通过将工作的Objective-C代码转换成我认为正确的Swift版本来实现这一点.
它编译并运行正常,直到其中一个回调触发,例如,当我拔下MIDI设备或按下其中一个键时.我总是得到一个BAD_EXEC.
任何想法如何使这项工作或Swift只是没有准备好作为网络上的一些博客文章.苹果官方的任何我忽视的事情都清楚地表明Swift尚未准备好进行CoreMIDI回调?
更新2015-03-10:相应的Objective-C代码可在http://www.digital-aud.io/blog/2015/03/10/on-coremidi-callbacks/找到