I have a form first created my the main thread.
I have another thread monitoring the IO.
Upon receiving certain message, I want to show/unhide the form.
When the form is first created ( handle is not created until it is first
shown ).
How do my IO thread invoke the form to show? ( in order to invoke the form,
the form handle must be created )
Thanks. 4 6544
"Altramagnu s" <al*********@ho tmail.com> schrieb I have a form first created my the main thread. I have another thread monitoring the IO. Upon receiving certain message, I want to show/unhide the form.
When the form is first created ( handle is not created until it is first shown ). How do my IO thread invoke the form to show? ( in order to invoke the form, the form handle must be created )
Thanks.
2 suggestions: You could call CreateHandle in the main thread after the form
has been created. Or, use an empty dummy form created in the main thread
used by (Begin)Invoke in the 2nd thread. The target procedure in the main
thread then shows the actual form.
Armin
Thanks
The first method would not work because,
even you explictly call CreateHandle, the handle would still not be created
until the form is first visible.
In other words, if the form is not visible, createHandle does nothing.
The second method works if i have a existing form that is already shown.
It will still be a problem if I have no existing form.
Thanks.
"Armin Zingler" <az*******@free net.de> wrote in message
news:%2******** ********@tk2msf tngp13.phx.gbl. .. "Altramagnu s" <al*********@ho tmail.com> schriebI have a form first created my the main thread. I have another thread monitoring the IO. Upon receiving certain message, I want to show/unhide the form.
When the form is first created ( handle is not created until it is first shown ). How do my IO thread invoke the form to show? ( in order to invoke the form, the form handle must be created )
Thanks.
2 suggestions: You could call CreateHandle in the main thread after the form has been created. Or, use an empty dummy form created in the main thread used by (Begin)Invoke in the 2nd thread. The target procedure in the main thread then shows the actual form.
Armin
"Altramagnu s" <al*********@ho tmail.com> schrieb "Armin Zingler" <az*******@free net.de> wrote in message news:%2******** ********@tk2msf tngp13.phx.gbl. .. "Altramagnu s" <al*********@ho tmail.com> schriebI have a form first created my the main thread. I have another thread monitoring the IO. Upon receiving certain message, I want to show/unhide the form.
When the form is first created ( handle is not created until it is first shown ). How do my IO thread invoke the form to show? ( in order to invoke the form, the form handle must be created ) 2 suggestions: You could call CreateHandle in the main thread after the form has been created. Or, use an empty dummy form created in the main thread used by (Begin)Invoke in the 2nd thread. The target procedure in the main thread then shows the actual form.
The first method would not work because, even you explictly call CreateHandle, the handle would still not be created until the form is first visible. In other words, if the form is not visible, createHandle does nothing.
Sure? I tried it and it worked. In a new project, add a button and this code
(sorry, VB.NET, but you'll see the point):
Shared f As Form1
Private Sub Button1_Click(B yVal sender As System.Object, _
ByVal e As System.EventArg s) Handles Button1.Click
f = New Form1
f.CreateHandle( )
Dim t As New Threading.Threa d(AddressOf a)
t.Start()
End Sub
Private Delegate Sub d()
Private Shared Sub a()
f.BeginInvoke(N ew d(AddressOf b))
End Sub
Private Shared Sub b()
End Sub
Exception without createhandle, no exception with createhandle.
The second method works if i have a existing form that is already shown. It will still be a problem if I have no existing form.
Yes, that's why you could add one, but you don't have to show it.
Armin
OK thanks.
I think CreateHandle works.
Sorry it was my mistake.
"Armin Zingler" <az*******@free net.de> wrote in message
news:u$******** ******@TK2MSFTN GP15.phx.gbl... "Altramagnu s" <al*********@ho tmail.com> schrieb "Armin Zingler" <az*******@free net.de> wrote in message news:%2******** ********@tk2msf tngp13.phx.gbl. .. "Altramagnu s" <al*********@ho tmail.com> schrieb I have a form first created my the main thread. I have another thread monitoring the IO. Upon receiving certain message, I want to show/unhide the form.
When the form is first created ( handle is not created until it is first shown ). How do my IO thread invoke the form to show? ( in order to invoke the form, the form handle must be created )
2 suggestions: You could call CreateHandle in the main thread after the form has been created. Or, use an empty dummy form created in the main thread used by (Begin)Invoke in the 2nd thread. The target procedure in the main thread then shows the actual form.
The first method would not work because, even you explictly call CreateHandle, the handle would still not be created until the form is first visible. In other words, if the form is not visible, createHandle does nothing.
Sure? I tried it and it worked. In a new project, add a button and this code (sorry, VB.NET, but you'll see the point):
Shared f As Form1 Private Sub Button1_Click(B yVal sender As System.Object, _ ByVal e As System.EventArg s) Handles Button1.Click
f = New Form1 f.CreateHandle( ) Dim t As New Threading.Threa d(AddressOf a) t.Start() End Sub Private Delegate Sub d() Private Shared Sub a() f.BeginInvoke(N ew d(AddressOf b)) End Sub Private Shared Sub b()
End Sub
Exception without createhandle, no exception with createhandle.
The second method works if i have a existing form that is already shown. It will still be a problem if I have no existing form.
Yes, that's why you could add one, but you don't have to show it.
Armin This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Peter Rilling |
last post by:
What events are fired when the Form.Show() and Form.Hide() methods are
called.
I know Load fires the first time, but what about showing and hiding the form
at any point during its life cycle?
From looking at Reflector, it looks like no event is fired. I would have
through the VisibleChanged event would fire, but Reflector shows that it
only fires when the form is an MDI type.
|
by: Ivan Weiss |
last post by:
I have been using form.show to display my forms yet I see a lot of
people using form.Showdialog.
What are the differences and when is one better than the other or are
they the same...?
-Ivan
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
|
by: Peter |
last post by:
I want to have a form named 'frmUpdating' that pops up on a clients
screen while a loop is cycling and disapears when the loop ends.
The 'frmUpdating' form has a real cool animation on it and it starts
running immediately after it is shown. It loops indefinately.
What I want to be able to do is have this form show up on the first
cycle of the loop and then exit after the loop exits.
How should I tackle this problem?
|
by: yzi |
last post by:
I have a list form and a detail form .
Before, I open the List form, use form.showDialog(),then I click List Item
and open the Detail Form by form.show().
now , user need when the list form show, auto open the first Item Detail .
I add detail form.show() in list form.form_load event , but problem.
some idea?? help me
|
by: PAPutzback |
last post by:
How do I keep the form up.
| |
by: vooose |
last post by:
Form form = new Form();
when you call
ShowWindow(form, SW_SHOWNOACTIVATE);
the form disappears the next time the garbage collector is called,
assuming the form variable has gone out of scope. When you call
form.Show() you don't get this behaviour. Why is this? How can you make
ShowWindow( ) behave the same way as Show(), in that the window doesnt
|
by: Marc the Demi-Programmer |
last post by:
I have a rather simple form that takes a user name and password,
validates it, and loads another form. All this is done in the click
event for the one and only button on the form. Everything works fine
except that after the event is finished the form breaks because of an
unhandled system.argument exception, and highlights the form class
declaration. This only happens when I do the form.show command in the
click event. When I comment it...
|
by: Matt Nunnally |
last post by:
Its been a while since I worked with VB6, so hang with me if this is stupid. How do I get past the Form.show method if I call it in a function? Here is the scenario.
Sub Whatever()
Some Code Here
frmProcess.Show vbModal
Some More Code Here
|
by: mvenkatesan |
last post by:
Hi
I want child form show assign to thread from main form
I was assigned thread in main forn button click
abort the thread on child form dispose.
but child form dont display it is sparkle.
whats problem
how do assign child form show from main form?
Thanks in advance
|
by: helpmewithasp |
last post by:
I am getting error as assembly or reference missing for form.Show() method. What refernce shall I add for this??
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
| |
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |