|
Ahh crap, it has the same exact issue... Thanks for the input though
The hook methood used is seems like more overhead...
I guess it is easier people who havn't written in Win32 C; IE those who don't handle winproc their self and just want the events to fire.
Even like my application if thie 'bug' occurs and you unfocus the form (goto another window) then click back on the taskbar(or Alt-Tab as both send SC_RESTORE) the state is restored because the command is sent (cool!) but now I need to figure out what command is being sent from taskmanager...
Taskmanager is a weird application! maybe because it loads KM independent from the shell? This looks like a job for Microsoft (I'll get back to everyone in 5 to 6 months )
Just so you know I am capturing the resize event as you said, look at my code I posted the winproc has a case "0x0005" aka WM_SIZE where I trigger my minimize event...
-Spacix
All your skynet questions[^] belong to solved
-- modified at 14:47 Tuesday 4th September, 2007
|
|
|
|
|
You could also use the tool "Spy++" that comes with visual studio .net to watch what messages are passed between windows and your app.
|
|
|
|
|
Yea I did that, which is how I knew it doesn't send SC_RESTORE (other than it doesn't work, but was my reason "why" it didn't work...)
Here is my screen cap from gVIM of the commands:
http://img72.imageshack.us/my.php?image=commandsvimzs0.gif
for some reason imageshack added transparency to my image (so it looks funny on their background...)
|
|
|
|
|
Giorgi Dalakishvili wrote: You can set up event handler for form's resize event and check for the window state there.
nobugz from the MSDN forums pointed this out and it doesn't have the same issue; I think this must have been what this post was pointing out and I just missed it after looking at the link on the bottom...
nobugz wrote: Use the Resize event. For example:
public partial class Form1 : Form {
private FormWindowState mState;
public Form1() {
InitializeComponent();
this.Resize += Form1_Resize;
mState = this.WindowState;
}
private void Form1_Resize(object sender, EventArgs e) {
if (mState != this.WindowState) {
mState = this.WindowState;
switch (mState) {
case FormWindowState.Normal: Console.WriteLine("Restored"); break;
case FormWindowState.Maximized: Console.WriteLine("Maximized"); break;
case FormWindowState.Minimized: Console.WriteLine("Minimized"); break;
}
}
}
}
|
|
|
|
|
Yes, this is what I meant
|
|
|
|
|
There is a bug with this though, pointed out by Peter Ritchie after that was posted, if the form is at point (0,0) and it is maximized then the resize event doesn't trigger, but since I don't care/even have the ability for a user to maximize my form not a problem with me. The main form in my application is a static sized "panel" or "meter" which doesn't need to be resized.
|
|
|
|
|
It works fine in previous version until we decide to use .NET 2005. The C# project failed to add reference of COM Dll in C++ with the error message:
A reference to "../whatevername.dll" could not be added. Please make sure that the file is accessible, that it is a valid assembly or COM component".
Please help.
Jack Rong
|
|
|
|
|
Hello. I'm building a web portal that interfaces with another server via XML. Clients of the big server will be using this portal instead of an HTML interface already existing. The problem is the server keeps track of client IP addresses for security and since everyone will be going through a portal, the server will always think they are coming from one IP address (portal server). Is there a way in C# to change the server IP address when sending the request or response to the other server? The remote server needs the original client IP basically. Thanks for any feedback you have.
|
|
|
|
|
I am working on a Project i am now a bit stuck as i want to show a list of controls from a namespace and display the selected control;
as visual studio does, as soon as we add reference to the library(dll) the controls are shown in tool box .
at first I am trying to get all controls from System.Windows.Forms
Any hint or link will be helpful
Thanks And regards
Amar Chaudhary
It is Good to be Important but!
it is more Important to be Good
|
|
|
|
|
|
Thanks for the direction
I am getting Lot of types in MScoreLib.dll
but there is no "System.Windows.Forms"
code I used is
using System.Reflection;
on form load event
Assembly a = Assembly.Load("MScorlib.dll");
Type[] types = a.GetTypes();
foreach (Type t in types)
{
listBox1.Items.Add(t.ToString());
}
MessageBox.Show(listBox1.Items.Count.ToString());
do you have any idea about this
Thanks And Regards
Amar Chaudhary
It is Good to be Important but!
it is more Important to be Good
|
|
|
|
|
Amar Chaudhary wrote: Assembly a = Assembly.Load("MScorlib.dll");
When i pass System.windows.forms.dll instead of MScorlib.dll
it throws a file not found exception
It is Good to be Important but!
it is more Important to be Good
|
|
|
|
|
Amar Chaudhary wrote: When i pass System.windows.forms.dll instead of MScorlib.dll
it throws a file not found exception
It is located at %SystemRoot%\Microsoft.net\Framework\v2.0.50727\System.Windows.Forms.dll
|
|
|
|
|
Amar Chaudhary wrote: When i pass System.windows.forms.dll instead of MScorlib.dll
it throws a file not found exception
GAC assemblies require more than just the DLL file name, like version, maybe culture. Try doing some research on MSDN to get the details.
|
|
|
|
|
Assembly a = Assembly.LoadWithPartialName("System.Windows.Forms");
Type[] types = a.GetTypes();
foreach (Type t in types)
{
listBox1.Items.Add(t.ToString());
}
MessageBox.Show(listBox1.Items.Count.ToString());
this is giving result but with warning
Warning 1 'System.Reflection.Assembly.LoadWithPartialName(string)' is obsolete: 'This method has been deprecated. Please use Assembly.Load() instead. http://go.microsoft.com/fwlink/?linkid=14202' E:\important\Articles for code project\Theme Applier for windows forms\EasyUI\UIApplier\UIMaker\ControlBrowser.cs 31 26 UIMaker
I am looking more into it Thanks for your help
It is Good to be Important but!
it is more Important to be Good
|
|
|
|
|
Can someone help me write a regular expression that will return a string from the beginning of the input string up until a certain string is reached? I know how to do this without regular expressions, but I want to use a regular expression so users can modify the format later.
Also, can someone recommend a good tutorial for using regular expressions to accomplish this kind of task using .NET?
Thanks.
|
|
|
|
|
www.expresso.com, or search for Expresso on this site. It's a program that helps you build and test regex. Also, the regex book from O'Reiley is pretty awesome.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
But there is RegEx in general and then there is .NET's flavor of RegEx. Are you recommending the O'Reilly book for .NET?
|
|
|
|
|
The O'Reilly book covers the different flavours in depth.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
|
+1 for http://regexlib.com[^]
[ My Blog] "Visual studio desperately needs some performance improvements. It is sometimes almost as slow as eclipse." - Rüdiger Klaehn "Real men use mspaint for writing code and notepad for designing graphics." - Anna-Jayne Metcalfe
|
|
|
|
|
If I understand you correctly, it would be a simple case of creating a regex string of something like "^(?<mymatch>.*)"+ sMyTerminatorString. Then check the matches for mymatch (or whatever you name it).
|
|
|
|
|
Look into RegexOptions.MultiLine to change whether "." matches newlines as well...
myRegex = new Regex("^.*?(?=myStringThatDelimitsTheEndOfTheMatch)");
Match m = myRegex.Match(sampleString);
if (m.Success) {
m.Value; // this returns only the part of the match
// that occured prior to your delimiting string
}
|
|
|
|
|
I have the following function:
public bool getOperatorResult<T>(string operatorType, T operandA, T operandB)
{
if (typeof(T) == typeof(bool))
{
System.Object obj = operandA;
bool a = (bool) obj;
obj = operandB;
bool b = (bool) obj;
switch (operatorType)
{
case "or":
return (a || b);
case "and":
return (a && b);
case "equal":
return (a == b);
case "notequal":
return (a != b);
default:
return false;
}
}
else if ((typeof(T) == typeof(int)) || (typeof(T) == typeof(double)))
{
}
}
This code works but just does not look right to me. Also in the second part where I look for numbers, I don't know how I can cast to either int or double. Any ideas
If I try to directly put in:
switch (operatorType)
{
case "lessthan":
return (operandA < operandB);
case "morethan":
return (operandA > operandB);
case "lessthanequalto":
return (operandA <= operandB);
case "morethanequalto":
return (operandA >= operandB);
case "equal":
return (operandA == operandB);
case "notequal":
return (operandA != operandB);
default:
return false;
}
I get compiler errors:
Operator '<' cannot be applied to operands of type 'T' and 'T'
.....
.....
|
|
|
|
|
Can you constrain your accepted types in order to enforce that they are comparable ?
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|