473,320 Members | 1,940 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

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 3063
Hi Raghu,

have a look at these:

Control..::.HandleCreated Event
Control..::.HandleDestroyed Event
Control..::.IsHandleCreated Property
Control..::.OnHandleCreated 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**********************************@u28g2000 hsc.googlegroups.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...@nnowslpianmk.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
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...
9
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...
2
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...
4
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...
0
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...
12
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...
16
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...
4
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. ...
2
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...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.