public FormLink() { InitializeComponent(); // remember for search thread thisForm = this; DevCtrl = new devicectrl(this); // open bluetooth manager DevCtrl.m_hBt = DevCtrl.BthCreate(); DevCtrl.varProc = threadSearchProcCallback; // list active comports selectedport = (int)DevCtrl.DevGetDefaultPort(); ListActiveComports(); }