473,407 Members | 2,359 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,407 software developers and data experts.

POSTMESSAGE Equivalent??

I have a form which, when launched, automatically begins a fairly intensive
process. The problem is that the process is so intensive that the form
doesn't have time to draw itself -- it only becomes visible at the end of
the process.

In C++ I used to solve this type of problem by sending a POSTMESSAGE during
the dialog initialization process. The POSTMESSAGE would trigger a member
which performed the intensive process. But the dialog would always have
plenty of time to render.

What I'm doing in C# is trying to emulate a button press like this, but this
is causing the form to draw at the very end of the process. What I want to
insure is that the form is completely rendered before I begin the process.

public Form1()
{

InitializeComponent();

button2_Click(new Object(),new EventArgs());

}

private void button2_Click(object sender, System.EventArgs e)

{

// CPU Intensive process

}

Any thoughts how I might do this in C#??

TIA

Harry
Nov 15 '05 #1
1 3304
Have you tried calling through a delegate? Seems to partially work with this
test.

private delegate void ButtonClick(object sender, System.EventArgs e);
private System.Windows.Forms.Button button1;
private System.ComponentModel.Container components = null;
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, System.EventArgs e)
{
for(int i = 0; i < 2000; i++)
{
Text = "i = " + i.ToString();
}
}
private void Form1_Load(object sender, System.EventArgs e)
{
//button1_Click(this, null);
this.BeginInvoke(new ButtonClick(button1_Click), new object[] { this,
null });
}

HTH,
Eric Cadwell
http://www.origincontrols.com
"Harry Whitehouse" <ha***@envmgr.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
I have a form which, when launched, automatically begins a fairly intensive process. The problem is that the process is so intensive that the form
doesn't have time to draw itself -- it only becomes visible at the end of
the process.

In C++ I used to solve this type of problem by sending a POSTMESSAGE during the dialog initialization process. The POSTMESSAGE would trigger a member
which performed the intensive process. But the dialog would always have
plenty of time to render.

What I'm doing in C# is trying to emulate a button press like this, but this is causing the form to draw at the very end of the process. What I want to insure is that the form is completely rendered before I begin the process.

public Form1()
{

InitializeComponent();

button2_Click(new Object(),new EventArgs());

}

private void button2_Click(object sender, System.EventArgs e)

{

// CPU Intensive process

}

Any thoughts how I might do this in C#??

TIA

Harry

Nov 15 '05 #2

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

Similar topics

2
by: Paul | last post by:
Hi all. Probably a quick one, I'm using PostMessage to send keys to an applicatoin but how do I convert the key string to a long values so that I can pass this to the wParam. The definition is...
15
by: James | last post by:
In my code I have a problem in abtaining a windows handle. I do not know the namespace to obtain the windows hanle. here is the code. using System; using System.Collections; using...
12
by: Wilfried Mestdagh | last post by:
Hi, Using P/Invoke I use PostMessage to send a message from one thread to another. I'm pretty sure this has already worked in dotnet. but I've upgraded version 2 few day ago. Now I have an...
2
by: Lenster | last post by:
When using PostMessage to post myself a message, the msg and wparam parameters somehow get swapped over. They are in the correct order when calling PostMessage but by the time wndproc handles the...
3
by: Max M. Power | last post by:
When I use the SendMessage API I can sucessfully send and receive a user defined message. When I use the PostMessage API I can NOT sucessfully send and receive the same user defined message. ...
3
by: knikkix | last post by:
Hi, I created a form in VB.Net with only one button. This is the code in button click event Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles...
10
by: Sergei | last post by:
Can anyone explain why PostMessage to a Windows Form is considered unsafe and raises InvalidOperationException? I can get rid of that setting CheckForIllegalCrossThreadCalls to false and...
21
by: one2001boy | last post by:
PostMessage() function returns ERROR_NOT_ENOUGH_QUOTA after running in a loop for 700 times, but the disk space and memory are still big enough. any suggestion to resolve this problem? thanks.
3
by: romcab | last post by:
Hello guys, I'm very new in .NET development and I was forced to learn it since my current project should used it. Anyway can you help me guys if you know the equivalent of PostMessage in...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
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,...
0
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...
0
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
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...

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.