|
Hello,
I've got a main form and a status form. The status form is displayed non-modally (Show method), and updated using Application.DoEvents() while working on a bigger job.
Now the problem is that the main form is not blocked while performing the job. Both the status form and the main form can be focused. What I'd like to have is that the main form is blocked and redirects the focus to the status form, just like it would be the case for modal dialogs. Is this possible?
I tried setting the Owner property of the status form to the main form, but it didn't have any effect. The ParentForm property is read only, and the Parent property only applies to standard controls, not forms...
Thanks and best regards
Dominik
PS: Moving the job to another thread isn't possible.
|
|
|
|
|
I've now implemented the following: when the main form runs into the Activated event, I'm calling the Activate method of the status form.
This way the main form is somewhat blocked, but there's still the disadvantage that visually the main form still draws the controls as if they could get the focus (for example the main menu items are highlighted when hovering over them). If you know a way how to disable/solve this, please let me know.
Thanks and best regards
Dominik
|
|
|
|
|
can't you try to add a this.Click event to the form and captures the user's click and bring the focus the other form?
Bad = knowing 2 much
|
|
|
|
|
See above
Thanks for the reply anyway, best regards
Dominik
|
|
|
|
|
you can also use panels in the mainform, switch to a panel with the text 'please wait' and switch back after your other jobs finish.
Bad = knowing 2 much
|
|
|
|
|
this.Enabled = false;
will it work ?
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKQUFK[M`UKs*$GwU#QDXBER@CBN%
R0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
-----------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
Yes, this prevents visual effects on hovering, but also grays out all dialog elements (which is actually good I guess).
Thanks and best regards
Dominik
|
|
|
|
|
If you call sub form non-modally, it will run in diffrent thread. Why do you want to use non modally?
And if you want to block executing main form and wait till status form is finished, it is easy if you called it modally with ShowDialog() method.
And if you insist in non moddaly, make some static variable in status form boolean type, and in the main forum ovverride focused event
PS: Moddaly and non moddaly means only that it runs either in diffrent or same thread
|
|
|
|
|
Saksida Bojan wrote: Moddaly and non moddaly means only that it runs either in diffrent or same thread
I don't think so. It means they use different message pumps, however all message pumps are executed (one at a time) by one and only one thread.
Here is an experiment to prove it:
- create main form Form1 with a ListBox and a Button; it will be shown modelessly;
- create Form2 with a ListBox and a Button; it will be shown modally;
- add the following to Form1:
public partial class Form1 : Form {
int count;
public Form1() {
InitializeComponent();
}
public void log(string s) {
lb.Items.Add(s);
}
private void button1_Click(object sender, EventArgs e) {
log("Thread ID="+Thread.CurrentThread.ManagedThreadId);
Form2 f=new Form2();
f.ShowDialog();
}
protected override void WndProc(ref Message m) {
count++;
if (count<5) log("Thread ID="+Thread.CurrentThread.ManagedThreadId);
base.WndProc(ref m);
}
}
- add basically the same code to Form2 (without new Form2/ShowDialog)
- run, click button, see all thread IDs, on second form, click button, see all thread IDs equal to the former ones.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
I want to create a pemanent connection with windows application and webserver(sending/receiving bytes anytime). Like as I run application in my pc then it should connect to my webserver and keep connect untill application closes. I thought to use HttpWebRequest/Response but I didn't find it accurate way. Thought about Socket but it confuses about webserver. So before I try to implement anything I would like to know any better idea or any suggestion you guys like
thanks
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKQUFK[M`UKs*$GwU#QDXBER@CBN%
R0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
-----------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
i'm no profesional, but a webserver isn't designed to keep the connection.
you make a request, the webserver serves the requested data and that's it.
Bad = knowing 2 much
|
|
|
|
|
then how does messengers work ? like Yahoo Messenger or Windows Live
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKQUFK[M`UKs*$GwU#QDXBER@CBN%
R0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
-----------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
They're not using HTTP for the communication.
|
|
|
|
|
then what they use ?
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKQUFK[M`UKs*$GwU#QDXBER@CBN%
R0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
-----------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
you don't need a connection with the webserver.
you can use POST or GET to send data, a neat script/application on the webserver wil crunch the data and sends the wanted (result) data back to you.
you windows desktop aplication can use timers to pol the webserver every X time.
Bad = knowing 2 much
|
|
|
|
|
okay I should put a timer of interval 1000 and in Tick event a Request and a Response will happen...so wont the application take too many system resources ?
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKQUFK[M`UKs*$GwU#QDXBER@CBN%
R0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
-----------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
1000 = 1 second.
60 ticks per minutes, makes 3600 per hour.
don't you think that's why to much?
no for the computer it's pratically nothing in recources.
i used to run more than 30 instances of the same application each consuming more than 30mb ram.
Second life ---> libsecondlife.org
but depending on the webhost you have, they count the traffic.
atleast mine does, www.web.com
if you own the webserver and traffic is not an issue, use PERL, Phyton or something and write an application outside of the webserver.
than your problem is solved and you can have a live connection.
smart people use a SQL table as ram, a RAM table, you can create ram table(mysql, sqlite, etc, etc, do this), but you can use an ordinary table and do the same.
so you application aswel the webserver can acces this table.
Bad = knowing 2 much
|
|
|
|
|
|
HTMLDoc = (HTMLDocument)WebBrowser.Document;
iHTMLCol = HTMLDoc.getElementsByTagName("input");
//type the username in the text box
mshtml.HTMLElementEvents2_Event htmlElementEvents2_Event = null;
foreach (IHTMLElement iHTMLEle in iHTMLCol)
{
try
{
strAttriName = iHTMLEle.getAttribute("id", 0).ToString();
if (strAttriName == "go")
{
if (iHTMLEle != null)
{
if (iHTMLEle is mshtml.HTMLButtonElement)
{
htmlElementEvents2_Event = (mshtml.HTMLElementEvents2_Event)iHTMLEle.onclick ;
htmlElementEvents2_Event.onclick += new HTMLElementEvents2_onclickEventHandler(htmlElementEvents2_Event_onclick);
}
}
}
}
catch { }
}
}
See the code above.
i have one button in my browser (intternetExplorer object), on that button click i wanted to call a method or event method.
Could any buddy help me out it is argent.
Thanks in advance!
yogesh
|
|
|
|
|
hi guys , i`m new in C# and now have a problem
i wanna open a web page , then get it`s form (my perpose page has 1 form)
then fill the form , and click the button !
the textbox of user name , is named : "e5ba6b5"
see , i did this :
webBrowser1.Navigate("http://mysite.com");
HtmlElementCollection htm = webBrowser1.Document.Forms;
HtmlElementCollection user = htm.GetElementsByName("e5ba6b5");
is it true ?!
and how should i fill username and click the button ?!
|
|
|
|
|
|
Do you have to use C# for this? I do things like this a lot, as I write test automation suites for websites.
I would use the AutoITv3 scripting language, http://www.autoitscript.com. It should take you all of ten minutes to do something simple like this, and the scripts compile directly .exe.
Take a look
|
|
|
|
|
If i want to create an application without any console and without any form that for example:
1. every 20 hours send an email
2. backup some folder or doing anything without the user interaction.
3. Will write a log to a file.
4. will run a process if some event occur.
I know that i can make a form application but then i need to mark the form with 0% Opacity. That will take a lot of memory for the process.
What is the best way?
|
|
|
|
|
write it as service. But why do you need such app. Such app can be easly considered malicious programs
|
|
|
|
|
Thanks.
I need it to backup files in my system and to sync between some computer in my office.
|
|
|
|