How to close the Bluetooth browser form?

  • Thread starter Thread starter ORC
  • Start date Start date
O

ORC

The Bluetooth Browser does not return the focus to the parent form after
selecting the wanted BT device - I guess that is an error! How do I make a
work-around to that?

Thanks,
Ole
 
If you store the native window handle of your form prior to displaying the
bluetooth browser, then you can call SetForegroundWindow API to bring your
app and form back to the foreground, you can modify the code from here:-
http://blog.opennetcf.org/pfoot/PermaLink.aspx?guid=a4bca0e4-439b-411a-87cd-0950e9d16b10

Also I notice the same issue when using Pocket Streets with Bluetooth GPS,
and generally the focus is returned to Pocket Streets on a second screen tap
after selecting the BT device, but this may not work in every case.

Peter
 
Thanks Peter - looks like a solution!

Ole

Peter Foot said:
If you store the native window handle of your form prior to displaying the
bluetooth browser, then you can call SetForegroundWindow API to bring your
app and form back to the foreground, you can modify the code from here:-
http://blog.opennetcf.org/pfoot/PermaLink.aspx?guid=a4bca0e4-439b-411a-87cd-0950e9d16b10

Also I notice the same issue when using Pocket Streets with Bluetooth GPS,
and generally the focus is returned to Pocket Streets on a second screen tap
after selecting the BT device, but this may not work in every case.

Peter
 
Back again,

Does an click event run in a separate (hidden) thread??? About the Bluetooth
browser form:
private void button1_Click(object sender, System.EventArgs e)
{
BlutoothPort.OpenConnection("COM8");
DoSomething1;
DoSomething2;
etc.
textBox.Text = "this make the textBox to appear on top of the Bluetooth
browser":
DoSomethingLast
}

The Bluetooth browser doesn't disappear until the click event is fully
finished and left! I can place no matter what code to try to get the focus
back to the Form1 (e.g. this.Focus(), this.BringToFront(),
this.Invalidate()) but it doesn't help showing the correct form. The only
thing is that I can make the textbox show the text ?!?

Thanks
Ole
 
Back
Top