|
Sorry, been working too close to Win32 lately. There isn't an on minimize event, but you can create one fairly easily by overriding WndProc.
protected override void WndProc(ref Message m)
{
switch(m.Msg)
{
case 0x0112:
if( m.WParam.ToInt32() == 0xF020 )
{
}
base.WndProc(ref m);
break;
default:
base.WndProc(ref m);
}
}
zhoujun wrote:
you said "set the windowstate of the main form to Restore",
does it mean that "this.WindowState=FormWindowState.Normal"?
Oops, yes I did mean that
James
Simplicity Rules!
|
|
|
|
|
thanks James!
when i asked the question,i have not think of any methods that you proposed!
to my surprise,it has so many solutions.
maybe i should work hard!
thanks one more time!
|
|
|
|
|
Check the NotifyIcon class in .NET, works nice.
Hope this helps.
Andres Manggini.
Buenos Aires - Argentina.
|
|
|
|
|
zhoujun wrote:
normally when minimize an application,the app will disappear from the windows desktop and will place an item at the taskbar!
then how can i avoid it to place an item at the taskbar?
just have a notification icon,when i double-click the notification icon,the application will resume!
Another way to check for Minimize is to override the OnResize and check your window state:
protected override void OnResize(System.EventArgs e)
{
if(WindowState==FormWindowState.Minimized)
{
ShowInTaskbar = false;
}
}
Be sure to save off you window placement and size first though. Then all you need to do is override the notification icon Click event and enable your window again.
Rocky Moore
|
|
|
|
|
Geez, any one have a brick wall handy? My head needs to run into it a few times, maybe it'll think of the obvious solution next time
Thanks for the reminder
James
Simplicity Rules!
|
|
|
|
|
thanks Rocky!
when i asked the question,i have not think of any methods that you proposed!
to my surprise,it has so many solutions.
maybe i should work hard!
thanks one more time!
|
|
|
|
|
Have this been here before!?
Well, I have two string objects.
string name = "Bob is cool";
string myString = "Hello every body, my name is Bob, and bob is cool";
How to find name in myString??
------------------------------------
Rickard Andersson, Suza Computing
ICQ#: 50302279
I'm from the winter country SWEDEN!
------------------------------------
|
|
|
|
|
int pos = myString.IndexOf(name);
--
David Wengier
Sonork ID: 100.14177 - Ch00k
|
|
|
|
|
Is it really the right way!?
well.... okay then..!
------------------------------------
Rickard Andersson, Suza Computing
ICQ#: 50302279
I'm from the winter country SWEDEN!
------------------------------------
|
|
|
|
|
hello,
when the below line runs it creates the dll in the application's bin\Debug directory. i'm trying to write it to a directory of my choice instead. i posted this last week. did anyone come across how i might do this. i'll post more code if you need it but the example that's basically the same thing i'm doing is at.
http://www.codeproject.com/csharp/cscompiler.asp
compilerResults = codeCompiler.CompileAssemblyFromSource(compilerParamaters, sourceWSProxy);
i've played around with some of the Parameter properties and couldn't get it to work. so maybe i'm just not doing it right. CompilerResults has a PathToAssembly property but that's after the fact.
any help is appreciated. By the way Tom, if you read this good book on C#. we've got 2 copies of it in our office.
thanks
Orion
|
|
|
|
|
i've tried a couple of things but still doesn't work. or maybe i'm doing something wrong.
i can get it to write to some directory but then the file(dll) that i'm creating loses its COM component qualities. so its no longer considered a dll, although it still has the extension. at least that's the error i get when i go to Add Reference to the newly created dll. i'm attempting to pass the path in as part of the OutputAssembly CompilerParameter.
compilerParamaters.OutputAssembly = File.CreateText(@"C:\WUTemp\" + fileNameAssembly).ToString();
the other thing i've tried is to create it InMemory and then try to write to some directory. this produces the same result. the file is created with the dll extension but its missing the components.
any thoughts??
thanks
Orion
|
|
|
|
|
Shouldn't that be, compilerParamaters.OutputAssembly = @"C:\WUTemp\" + fileNameAssembly ?
James
Simplicity Rules!
|
|
|
|
|
James,
Thanks! that works. Yes Simplicity rules yet again. now i feel like a dumb ass,, but i don't care it works ;~))
Orion
|
|
|
|
|
I have a Windows Form component that responds to the mouse wheel. On my test form it is the only control and works great, but in my application I have a browser control and serveral instances of that control. In this situation the control never responds to the scroll messages. I have tried setting the focus to it when the mouse enters and all sorts of other things. Any suggestions?
BTW, I'm betting James knows.
Joshua Guy Sonork ID: 100.9944
ICQ: 519642
Hotmail: JoshuaJGuy@hotmail.com
|
|
|
|
|
Joshua Guy wrote:
BTW, I'm betting James knows.
Off the top of my head...
in Form_Load
Application.AddMessageFilter(myComponent as IMessageFilter);
in your component
public class MyComponent : ......, IMessageFilter
{
......
bool IMessageFilter.PreFilterMessage(ref Message m)
{
if( m.Msg == 0x020A )
{
m.HWnd = this.Handle;
WndProc(ref m);
return true;
}
return false;
}
} Hopfully that'll work, I haven't tested it
James
Simplicity Rules!
|
|
|
|
|
In the same dir as my EXE I have a dir with some files in it. I want to get the filename for all those files!
How!?
------------------------------------
Rickard Andersson, Suza Computing
ICQ#: 50302279
I'm from the winter country SWEDEN!
------------------------------------
|
|
|
|
|
string [] files = System.IO.Directory.GetFiles(Application.ExecutablePath);
James
Simplicity Rules!
|
|
|
|
|
Thaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaak youuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu!
------------------------------------
Rickard Andersson, Suza Computing
ICQ#: 50302279
I'm from the winter country SWEDEN!
------------------------------------
|
|
|
|
|
Flowers for a flower ?
Crivo
Automated Credit Assessment
|
|
|
|
|
Hi!
To make it very simple:
I have a Form, with one Button in it.
I want to fake a buttonpress on the Button in my code. In other words, create the buttonpressed event without clicking the button, so the Button will deliver the event to its registered listeners.
HOW?
This is to be used in for example scripting of an Active X component (or any Form with controls) by sending keystrokes or mouseclicks etc.
Nico
|
|
|
|
|
myButton.PerformClick();
James
Simplicity Rules!
|
|
|
|
|
No, it's not that easy
I want to send keystrokes/mouseclicks - to a Form.
Imagine an Active-X/COM object as a Form. I want to send keystrokes to it. Like "TAB"-"TAB"-"Enter"
Like an automation-tool or scripting tool (MS Scriptit).
Nico
|
|
|
|
|
Look at PostMessage and SendMessage API functions
Crivo
Automated Credit Assessment
|
|
|
|
|
Where exactly would I find the information on these functions? On MSDN I am assuming... It's a big place!
|
|
|
|
|
Do you guys have any reasons NOT to use hungarian notation in C#?
Like this:
int intMyAge = 12; // just kidding
bool blnILikeIt = true;
double dblSalary = 0.0;
-Øyvind
|
|
|
|