// open a new Thread to do this ,because this contain a while(true) static void startReg() { DR2API.DR2_registSocketFun(ApiHandle, ScreenCast.Program.dm.run); // regist the function. }