How to close the Bluetooth browser form?

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
 
P

Peter Foot [MVP]

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
 
O

ORC

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
 
O

ORC

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top