|
I am trying to maximize a window from the system try in c#. I believe I need to get the window handle to do this so my solution looks something along the lines of this:
public class WinAPI<br />
{<br />
public const int WM_SYSCOMMAND = 0x0112;<br />
public const int SC_MAXIMIZE = 0xF030;<br />
[DllImportAttribute("user32.dll")]<br />
public static extern int SendMessage(IntPtr hWnd, int Msg, int<br />
wParam, int lParam);<br />
}<br />
public void Maximize()<br />
{<br />
<br />
Process[] outlookprocess = Process.GetProcessesByName("OUTLOOK");<br />
IntPtr window = outlookprocess[0].MainWindowHandle;<br />
WinAPI.SendMessage(window, WinAPI.WM_SYSCOMMAND, WinAPI.SC_MAXIMIZE, 0);<br />
<br />
}
Only problem is that MainWindowHandle always returns 0. I can put a break point in and the "outlookprocess[0]" object looks fine. However the window doesn't open. Anyone know what I am doing wrong?
EDIT: Just realised that I can get the main window handle if the window is open (i.e. not in the system tray). Is there a way to get the main window handle if the process is minimized to the tray?
Cheers
Alex
-- modified at 5:17 Friday 23rd March, 2007
|
|
|
|
|
|
Hi, I have a DataGridView and a button inside one column. Every time I resize the column width manually, the button resize it's width automatically with the column.
I have set the Dock property of the button to 'Right', Anchoer to None. I want to make the width of button static (does not change with the column size)
Thanks!
Nathan
|
|
|
|
|
Set Dock property to None too.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
Dock and Anchor are mutual exclusive. Anyway I did it by overriding onResize method of the button, thanks all the same!
|
|
|
|
|
Forgot about that. Try setting both properties to their default values i.e. Dock = None and Anchor = Top | Left . Should work and would be a smoother way to solve the problem than overriding OnResize .
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
Can I change the value of a Static Variable....
|
|
|
|
|
yes
|
|
|
|
|
I would like to know how...
i have already given it a value and now i want to change it again in my programm....
|
|
|
|
|
just like you change the value of non static variables. static variables are not final variables
Chatura Dilan
|
|
|
|
|
ClassName.VariableName = newValue;
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
I got it... Thanks to all
|
|
|
|
|
class unu
{
public static int varStatic=0;
............
}
class doi
{
public void myMetod()
{
unu obj=new unu();
obj.varStatic=10;
}
.......
}
i hoppe this code work
|
|
|
|
|
if u are using a windows form, try using a separate class within which you declare the public static member, so that it can be used with the class name.
its value does change.
Keshav Kamat
India
|
|
|
|
|
if you are building a webproject application, using from static variables not a good method
you can use ViewState similar static variables
We Can Do Anything, If We Want It
|
|
|
|
|
Hello..
How can I register some Assembly from my own program?
(Without using regasm and gacutil.) Is it possible?
please, help me..
Thanks...
|
|
|
|
|
I think you can drag and drop the assembly to global cache
|
|
|
|
|
I am so sorry to ask a stupid question,I just want to know how to get it,and I don't understand what is A*,thank you.
-- modified at 3:56 Friday 23rd March, 2007
Always do you best,what you plant you will harvest
later!
|
|
|
|
|
I don't understand your questions. Probably because you didn't ask one. If you want an answer, you should ask a question.
If you're asking for info on the A* pathfinding algorhytm, just keep looking, there are some really good tutorials out there, but make sure you understand the logics before you try to code it yourself. It took me a while to get it too.
A* for beginners[^]
Visual Studio can't evaluate this, can you?
public object moo<br />
{<br />
__get { return moo; }<br />
__set { moo = value; }<br />
}
|
|
|
|
|
A* search algorithm[^]
Also search the articles. IIRC there is one that deals with a C# implementation of A*.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
Hi,
Could you please reiterate the question?
Keshav Kamat
India
|
|
|
|
|
Hi,
I have two major problem with xsd file. My xsd file are created in java (i think) because i have a error when i load the xsd file in the DataSet (type token is not define). I have found on the web one post like this: "DataSet not support token type you must to convert to string type". I have change the xsd but i have another error and for this i have not found the solve: "DataSet cannot instantiate an abstract ComplexType for the node AbstractCars".
I appreciate if somebody can help me!!
|
|
|
|
|
Hello.
I have a problem using AssemblyVersion in AssemblyInfo.cs.
In VS2003, if I set AssemblyVersion("1.0.*"), then the version will be something like 1.0.123.12345
In VS2005, if I set AssemblyVersion("1.0.*"), then the version will be something like 1.0.*
Where must I change in VS2005? I want the Build Number and Revision and not the *.
Thanks...
|
|
|
|
|
Hi,
for me form enter event not working.
help me
it's arrgent
thanks
|
|
|
|
|
I did not get you when you mean Form Enter event not working.
Do u mean to say, that the form load event is not working for some reason,
or the enter key event is not working.
could you please describe a little more?
Keshav Kamat
India
|
|
|
|