473,569 Members | 3,043 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

API to wait until an object is created properly??

Hi all,

I have created lot of controls on a form

what i want to do is for wait until handles are created.

how can we do this??

say rag=new label();

i want to wait until the rag handle has been created.This is necessary
when i restart my system since all my app will be launched as a
windows service and i am getting expections like

"Invoke or begininvoke cannot be called on a control until the window
handle has been created".

Please help me in this i want to know which are the API's used for
this and how to do it??

I want to avoid sleep

thanks in advance,
RAGHU

Oct 21 '08 #1
3 3093
Hi Raghu,

have a look at these:

Control..::.Han dleCreated Event
Control..::.Han dleDestroyed Event
Control..::.IsH andleCreated Property
Control..::.OnH andleCreated Method
Regards

Kerem

--
-----------------------
Beste Grüsse / Best regards / Votre bien devoue
Kerem Gümrükcü
Latest Project: http://www.codeplex.com/restarts
Latest Open-Source Projects: http://entwicklung.junetz.de
-----------------------
"This reply is provided as is, without warranty express or implied."
<ra*****@gmail. comschrieb im Newsbeitrag
news:35******** *************** ***********@u28 g2000hsc.google groups.com...
Hi all,

I have created lot of controls on a form

what i want to do is for wait until handles are created.

how can we do this??

say rag=new label();

i want to wait until the rag handle has been created.This is necessary
when i restart my system since all my app will be launched as a
windows service and i am getting expections like

"Invoke or begininvoke cannot be called on a control until the window
handle has been created".

Please help me in this i want to know which are the API's used for
this and how to do it??

I want to avoid sleep

thanks in advance,
RAGHU
Oct 21 '08 #2
On Tue, 21 Oct 2008 02:55:41 -0700, <ra*****@gmail. comwrote:
[...]
i want to wait until the rag handle has been created.This is necessary
when i restart my system since all my app will be launched as a
windows service and i am getting expections like

"Invoke or begininvoke cannot be called on a control until the window
handle has been created".

Please help me in this i want to know which are the API's used for
this and how to do it??
There is probably some reasonable, high-level way to structure your
program so that it doesn't try to access Control instances until after
their window handle is created, even notwithstanding the events Kerem
mentions.

But, an actual service shouldn't be doing GUI stuff anyway. Either you're
misusing the term service, or there's a broader design problem going on
here.

A concise-but-complete code sample would probably clear things up a lot
better than a general description.

Pete
Oct 21 '08 #3
On Oct 21, 5:48*pm, "Peter Duniho" <NpOeStPe...@nn owslpianmk.com>
wrote:
On Tue, 21 Oct 2008 02:55:41 -0700, <ragh...@gmail. comwrote:
[...]
i want to wait until the rag handle has been created.This is necessary
when i restart my system since all my app will be launched as *a
windows service and i am getting expections like
"Invoke or begininvoke cannot be called on a control until the window
handle has been created".
Please help me in this i want to know which are the API's used for
this and how to do it??

There is probably some reasonable, high-level way to structure your *
program so that it doesn't try to access Control instances until after *
their window handle is created, even notwithstanding the events Kerem *
mentions.

But, an actual service shouldn't be doing GUI stuff anyway. *Either you're *
misusing the term service, or there's a broader design problem going on *
here.

A concise-but-complete code sample would probably clear things up a lot *
better than a general description.

Pete
Hi pete,

Main problem is:
1)I have created a thread.which shows a splash screen(which is nothing
but a form with borders taken out).

2)now i do rag=new form();
then rag.showdialog( );

3)And my application is very big.
all my application will be launched as a windows service

4)By the time my thread initilizes and rag has a valid value.A call
will be made from other application to end the splash

so i will be call invoke method to end the splash screen and then end
the thread.

but since the handle is not having proper value i get an exception.

this problem happens only during the restart of a system rest all
times it is working fine

please reply on this

thanks,
RAGHU
Oct 21 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2232
by: Earl Eiland | last post by:
I calling a Windows executable with PROC = subprocess.Popen('...'), and blocking further python execution until the process terminates with PROC.wait(). Occasionally, something unusual happens with the subprocess, and it fails without terminating the process. When this happens, my Python program doesn't detect the error condition, and...
9
1707
by: Roger Down | last post by:
Lets say I have a method UpdateCache() called from a single thread. I also have a method GetCache() called from multiple threads. When UpdateCache() is called, the cache updating is being processed. This can take time. In the mean time, some of the multiple threads have called GetCache(), but because the cache is being updated, I want them...
2
2232
by: bhauver | last post by:
I am writing an ASP.NET application which runs a Crystal Report and then displays the results with the Web Form Viewer. (This works ok). However, since these reports take a couple of minutes to run, I would like to display a 'please wait' message on the browser until the report is ready for viewing. I have attempted to use Response.Write to...
4
1861
by: Luke Matuszewski | last post by:
Here are some questions that i am interested about and wanted to here an explanation/discussion: 1. (general) Is the objectness in JavaScript was supported from the very first version of it (in browsers) ? What about the new syntax of creating a object using { 'propName1':'propValue1', 'propName2':'propValue2', 'propName3':{ /* another object...
0
2463
by: Chris Chilvers | last post by:
I've found the docs to be rather scant on exactly what the second parameter to WaitHandle.WaitOne(Int32, Boolean) was for. The one named exitContext so I started playing with the synchronize attribute to find out how it all works. I'm puzzled at why this blocks until it times out. What is supposed to happen is the consumer thread is started...
12
5250
by: Perecli Manole | last post by:
I am having some strange thread synchronization problems that require me to better understand the intricacies of Monitor.Wait/Pulse. I have 3 threads. Thread 1 does a Monitor.Wait in a SyncLock block protecting a resource. Thread 2 and 3 also have a SyncLock block protecting the same resource and after executing some code in their blocks...
16
30038
by: Thirsty Traveler | last post by:
I would like to create a test harness that simulates multiple concurrent users executing an individual thread. I would like this to be determined at runtime when the user specifies the number of desired threads. When this is kicked off, I would like to wait in the primary thread until all worker threads have completed and time the result......
4
11085
by: Eddie | last post by:
I am opening a windows (well, technically a greybox() call GB_show() which shows a nicer window than normal), and want to wait until that window is closed before moving to the next command. However, when I open the window, JavaScript immediately issues the next command statement. How can I get JavaScript to wait until the window is closed...
2
3457
by: greyradio | last post by:
I've recently have been given an assignment to do and it seems that notify() does notify() any of the waiting threads. The project entails 10 commuters and two different toll booths. The EZPass booth allows a commuter to pass easily while a cash booth creates a wait line. The wait line is expected to wait for the 5th commuter to pass before any...
0
7619
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8138
jinu1996
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...
1
7681
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...
0
7983
tracyyun
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...
0
5228
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...
0
3662
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...
0
3651
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2118
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
1
1229
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.