|
Hi
I wrote a simple program that should find a specific window and hide it.
Somehow the window is actually being close (Its process is killed) and the weirdest thing is that the taskbar is also hides.
Here is my code:
<br />
public const int SW_HIDE = 0; <br />
<br />
[DllImport("user32.dll")] <br />
public static extern int ShowWindow(IntPtr hwnd,int nCmdShow); <br />
<br />
private void button1_Click(object sender, System.EventArgs e) { <br />
string title=textBox1.Text;
Process[] plist =Process.GetProcesses(); <br />
foreach(Process p in plist){ <br />
if(title.IndexOf(p.MainWindowTitle)>=0){ <br />
ShowWindowAsync(p.MainWindowHandle,SW_HIDE); <br />
}<br />
} <br />
} <br />
Can you see the problem? what is it?
or how can i hide a window without closing it?
Thank a lot
Mamtz
|
|
|
|
|
You can try this:
[Flags]
public enum SWP
{
SWP_ASYNCWINDOWPOS = 0x4000,
SWP_DEFERERASE = 0x2000,
SWP_DRAWFRAME = 0x20,
SWP_FRAMECHANGED = 0x20,
SWP_HIDEWINDOW = 0x80,
SWP_NOACTIVATE = 0x10,
SWP_NOCOPYBITS = 0x100,
SWP_NOMOVE = 2,
SWP_NOOWNERZORDER = 0x200,
SWP_NOREDRAW = 8,
SWP_NOREPOSITION = 0x200,
SWP_NOSENDCHANGING = 0x400,
SWP_NOSIZE = 1,
SWP_NOZORDER = 4,
SWP_REDRAWONLY = 0x717,
SWP_SHOWWINDOW = 0x40
}
[DllImport("User32.dll", CharSet=CharSet.Auto)]
public static extern bool SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, int X, int Y, int cx, int cy, int uFlags);
private static SWP hideFlags = SWP_NOSIZE | SWP_NOMOVE | SWP_NOZORDER | SWP_NOREDRAW | SWP_HIDEWINDOW
SetWindowPos(p.MainWindowHandle, IntPtr.Zero, 0, 0, 0, 0, hideFlags); More info on MSDN[^].
Hope this works!
"..Commit yourself to quality from day one..it's better to do nothing at all than to do something badly.."
-- Mark McCormick
|
|
|
|
|
Hello All,
Can we dynamically generate the reports, say, like an user selecting the required fields across DB tables (through a front-end), specifying the criteria -us building the SQL query- and fetching the result from the DB.
Any help on this would be appreciated.
Thanks
|
|
|
|
|
Don't double post. If you really really think that you have to draw attention to your question in two separate message boards, keep the question in one and post a link to it in the other.
---
b { font-weight: normal; }
|
|
|
|
|
Hello All,
I dont know how to add buttons to DataGridColumn.Can u plz tell me??
Thanks
Amruta
|
|
|
|
|
Hello everybody!
I met a problem when I tried to insert a new record or update a record when it contains a date field. Which says the insert into syntax is not correct. I tried to insert a date format string using
DataTable atable = ds.Tables["Invoice"];
atable["date"] = Convert.ToDateTime(DateTime.Today.ToShortString);
atable["date"] = DateTime.Today.ToShortString();
or any kind of ways I can think about. But none of them works. Does anybody know a way to solve this problem please.
And also does anybody has any good idea to display information between two date please?
Asura
|
|
|
|
|
Why do you convert the date to a string at all?
atable["date"] = DateTime.Today;
---
b { font-weight: normal; }
|
|
|
|
|
I tried this way actually, but it gives the same error message. "Insert Into syntax error"
There is no problem to display date if I write some date in access. But it just can't write date back into access.
Asura
|
|
|
|
|
Have you specified the field as date in the database?
---
b { font-weight: normal; }
|
|
|
|
|
Yes, I defined the field as date/time in access. As long as I define a field as date, the insert and update can't work. If I delete the field, everything is OK.
Asura
|
|
|
|
|
How did you define the UpdateCommand for the OleDbDataAdapter? It's is not created by default unless you wrap the OleDbDataAdapter in an OleDbCommandBuilder, or create the UpdateCommand yourself.
Absolute faith corrupts as absolutely as absolute power
Eric Hoffer
All that is necessary for the triumph of evil is that good men do nothing.
Edmund Burke
|
|
|
|
|
The problem is (I have seen it so many times...) that you cannot use some field names in tables. I'm pretty sure 'date' is beteen them...
other names are 'username', 'password'...
|
|
|
|
|
Please reply to the original poster.
---
b { font-weight: normal; }
|
|
|
|
|
I want to make .msi file which includes meta data and information in the form of compression.
But i don't know how to make it self extract.
can any one let me know.
Thanks
Varun Jain
|
|
|
|
|
|
Hi
THanks for the reply.
I know about Deployment project.
But i want to create my own.
I want to know the logic if know please help me.
Varun Jain
|
|
|
|
|
|
Thanks for the reply.
But couldn't find useful informaton on this address.
Varun jain
|
|
|
|
|
|
Hello,
I'm trying to convert txt files containing some html tags and text in cyrillic to html. What I do is add the and tags at the beginning and at the end. Also I'm using regular expressions to replace a image name with tag to actually show the picture. The problem is that when I read the file with ReadToEnd() the cyrillic text is missing. If I read the file as byte array I don't know how to use regular expressions to insert the pictures. Could you please help with some advices?
Thanks
|
|
|
|
|
Without seeing some of your code - specially the code to construct the reader - it's difficult to say for sure what the problem is.
You do need to set the encoding of the TextReader , though:
Encoding enc = Encoding.GetEncoding(1251);
using (TextReader reader = new StreamReader(path, enc, true))
{
string content = reader.ReadToEnd();
} If you're having trouble entering Cyrillic text in your regular expressions, use the \uXXXX notation in C# to enter the Unicode code point, like \u0041 is "A".
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Customer Product-lifecycle Experience
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
It is said that an assembly with a strong name (i.e., digitally signed) is safe from hacking in as much as its integrity and identity are guaranteed. This means that nobody can replace some code in your assembly with a strong name, as in that case it won't run.
My question is - What if somebody tries to decompile such an assembly (with a strong name) and then after making some changes in the code, again recompile it? Is there anything in the .NET which prevents decompilation of an assembly with a strong name? Moreover, if such an assembly with a strong name can be decompiled and then recompiled again (after making some changes), then where is the security from hacking of the code? In such a situation, will it not mean that a strong naming also does not ensure full safety?
Can somebody throw some light on this issue?
Thanks in advance.
|
|
|
|
|
I'm afraid, the term "is safe from hacking" is plain wrong.
You can easily decompile a strong name assembly and modify it.
When you just do this and recompile, this won't work, though.
But when you remove the strong name signature from the assembly while modifying it, the assembly can be compiled and will be usable, although you will see that it's no longer signed by the original source.
I found an article on this topic a while ago, but don't have the URL ready right now, sorry.
When I find it I'll post it.
Regards,
mav
[EDIT]
I found the article. It was - of course - here on CP:
Learn to break Strong Name .NET Assemblies
[^]
{/EDIT]
|
|
|
|
|
strong name and digitally signed not used to prevent decomppiletion they use to prove that this assembly from you?
no thing prevent someone to decompile your code?
because as you know .net programm not compile directly to machine code the compile to clr so if you want to prevent
decompilation you can use Ngen.exe which will compile your application to machine code -even this will not prevent disassemble your code -but you loos some benefits
so waht? there are some tools that make decompilation process more harder (obfuscator) by renaming namespace , clasess... etc and do other things like try to make decompier crach
MCAD
|
|
|
|
|
I had a hard time trying to find a simple way to allow a user to remove the selection of multiple items in a listbox, so after a half hour of experimenting I found a surprisingly simple solution:
<br />
do<br />
{<br />
listBoxName.Items.RemoveAt(listBoxName.SelectedIndices[0]);<br />
}<br />
while (listBoxName.SelectedIndices.Count > 0);
We are allowed to always remove the "0th" selection because we are removing as we go, and so the "next" item will become the "0th" item when the current one is deleted. Then in the Do-While loop we just continue until we run out of selected items. Make sense? It seems relatively simple, but I wasn't able to find any similar help so i figured id post here in case someone else runs into the same problem.
|
|
|
|