|
well, he would know; I run a one-man shop.
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
Thank you for reply!
hi
My english is a little.
anyway, nice to meet you~~
and give me your advice anytime~
|
|
|
|
|
Thank you for reply!
hi
My english is a little.
anyway, nice to meet you~~
and give me your advice anytime~
|
|
|
|
|
The menu when you click the right mouse button is called a context menu, not a sub menu which is likely why you didn't find it on the msdn site.
This MSDN Link may be of help. I understand that the source is in vb, but it shows how to do this.
As well, this site appears to have some really good tutorials for add-ins. You may find some context menu stuff in there too.
I wasn't, now I am, then I won't be anymore.
|
|
|
|
|
Oh, This is what i am looking for!
Thank you!
hi
My english is a little.
anyway, nice to meet you~~
and give me your advice anytime~
|
|
|
|
|
I draw rectangle by use mouse but this rectangle drawing many time I mean many rectangle
result in one time and if click the button the rectangle disappear I want rectangle stil
in panel even click another button to draw another ship ..............how
help meeeeeeeee please.............
|
|
|
|
|
How can we possibly help you?
We cannot see the code that causes you these problems.
The only thing that I can say is that if you are not drawing the rectangles in the panel's OnPaint event handler they will disappear each time the panel is redrawn.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
I wouldn't let CG touch my Abacus!
When you're wrestling a gorilla, you don't stop when you're tired, you stop when the gorilla is.
|
|
|
|
|
you did not provide any detail nor code, so all I can do is suggest you read this[^].
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
There are many members willing to help you, but your question is ambiguous.
What actually is the problem?
------------------------------------
I will never again mention that I was the poster of the One Millionth Lounge Post, nor that it was complete drivel. Dalek Dave
CCC Link[ ^]
Trolls[ ^]
|
|
|
|
|
your question is not clear. please be clear while asking question so we can help you
|
|
|
|
|
Hello,
I have developed a Console App with CommandLine Args that can display and then remove SACLs from a user inputted Path.
Works great. However, the way I have it setup is that in only displays or removes the SACLS based on the Directory entered.
I need my code to enumerate the Directory and display information not only from the Directory, but also Subdirectories and Files in the directories.
Anyone have this code available or can point me in the right direction?
Thank You!
Here is some sample code of what I have done. Again, it reads in a Directory only. I need the Directory, SubDirectories, and files.
class Program
{
static void Main(string[] args)
{
try
{
if (args[0].ToUpper().Trim() == "SEARCH") // Displays all Sacls for path
{
Console.WriteLine("Enter your Directory path: ex. C:\\TestFolder");
string path = Console.ReadLine();
Console.WriteLine("{0}", path);
if (Directory.Exists(path))
{
Console.WriteLine(GetDirectoryAuditControlInformation(path));
}
else
{
Console.WriteLine("Path does not exist");
}
}
else if // argument for == CLEAN which removes all Sacls.
// my function for GetDirectoryAuditControlInformation(string path)
public static string GetDirectoryAuditControlInformation(string path)
{
StringBuilder info = new StringBuilder();
info.AppendLine("SACL entries for the path \ "" + path + "\":");
info.AppendLine();
DirectorySecurity dsecurity = Directory.GetAccessControl(path, AccessControlSections.Audit);
AuthorizationRuleCollection acl = dsecurity.GetAuditRules(true, true, typeof(System.Security.Principal.NTAccount));
foreach (FileSystemAuditRule ace in acl)
{
string aceInfo = GetAuditAceInformation(ace);
info.AppendLine(aceInfo);
}
return info.ToString();
}
public static string GetAuditInformation(FileSystemAuditRule ace)
{
StringBuilder info = new StringBuilder();
string line = string.Format("Account: {0}", ace.IdentityReference.Value);
info.AppendLine(line);
line = string.Format("Type: {0}", ace.AuditFlags);
info.AppendLine(line);
line = string.Format("Rights: {0}", ace.FileSystemRights);
info.AppendLine(line);
line = string.Format("Inherited ACE: {0}", ace.IsInherited);
info.AppendLine(line);
return info.ToString();
}
|
|
|
|
|
|
I'm not so sure that's necessarily a bad thing. A lot of folks don't answer question in the Q/A section, so he's maximizing his coverage.
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass." - Dale Earnhardt, 1997
|
|
|
|
|
You're right. Thought about this since I'm quite new to the Q/A section and it's role. Still decided (perhaps over eagerly ) to post the info about the duplicate question to notify that discussions may already be found on another section.
|
|
|
|
|
But it is still mildly annoying to answer a question in one forum only to find it has already been answered in another. Especially when you have spent some time researching/testing in order to come up with a reasonable response.
I must get a clever new signature for 2011.
|
|
|
|
|
I am trying to send an "F2" keystroke to a window to refresh it.
I would like to send it to the window while it is minimized, I have Vista just as a little more information.
Here is the code I was testing on, it seems like PostMessage might be my best option, I am able to find the window handle through the code below, just not sure how to send an "F2" to it when minimized.
Thanks for reading.
private void button1_Click(object sender, EventArgs e)
{
const int WM_KEYDOWN = 0x100;
const int WM_KEYUP = 0x101;
Thread.Sleep(3000);
Process[] processes = Process.GetProcessesByName("keytest.txt - Notepad");
foreach (Process p in processes)
{
IntPtr pFoundWindow = p.MainWindowHandle;
}
MessageBox.Show("Done");
}
|
|
|
|
|
This[^] link any good for you? I am sure that's what you want
Illogical thoughts make me ill
|
|
|
|
|
Hi,
Thanks for the response.
I believe I am misunderstanding something, my code is below, can you tell me what I am doing wrong?
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Microsoft.Win32;
using System.Net;
using Strings;
using System.IO;
using System.Text.RegularExpressions;
using System.Net.Mail;
using System.Threading;
using System.Diagnostics;
using System.Runtime.InteropServices;
namespace GenericTester
{
public partial class Form1 : Form
{
private static uint SC_RESTORE = 0xF120;
private static uint SC_MAXIMIZE = 0xF030;
private static uint SC_MINIMIZE = 0xF020;
private static uint WM_SYSCOMMAND = 0x0112;
[DllImport("user32.dll")]
public static extern bool PostMessage(IntPtr hWnd, [MarshalAs(UnmanagedType.U4)] uint Msg, IntPtr wParam, IntPtr lParam);
[DllImport("User32.Dll", EntryPoint = "PostMessageA")]
static extern bool PostMessage(IntPtr hWnd, uint msg, int wParam, int lParam);
[DllImport("user32.dll", EntryPoint = "FindWindowA")]
public static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
[DllImport("user32.dll")]
static extern byte VkKeyScan(string ch);
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
const int WM_KEYDOWN = 0x100;
const int WM_KEYUP = 0x101;
Thread.Sleep(3000);
Process[] processes = Process.GetProcessesByName("javaw");
foreach (Process p in processes)
{
IntPtr pFoundWindow = p.MainWindowHandle;
PostMessage(pFoundWindow, WM_KEYDOWN, VkKeyScan("{F2}"), 0);
}
MessageBox.Show("Done");
}
|
|
|
|
|
Firstly, do you need that Thread.Sleep?
For the Function Keys I have found it works with the Keycode value. I tried the following with my browser and it refreshed the page. You will need to change the Keycode from F5 to F2.
F2 = 0x71
F5 = 0x74
See here[^] for full list of codes
foreach(Process process in Process.GetProcessesByName(textBoxProcessName.Text))
{
IntPtr hWnd = process.MainWindowHandle;
PostMessage(hWnd, WM_KEYDOWN, 0x74, 0);
}
hope this helps
Illogical thoughts make me ill
modified on Thursday, February 17, 2011 12:41 PM
|
|
|
|
|
Also, are you sure "javaw" is the right window you want?
Illogical thoughts make me ill
|
|
|
|
|
Hi,
Yes the process in task manager is called javaw ... the code below is the only way I can seem to get it to work? For some reason it requires the Thread.Sleep(2000) or it happens to quickly.
I would rather not use SendKeys, as I would like to send the "F2" keystroke to the window when it is minimized, any ideas?
private void button1_Click(object sender, EventArgs e)
{
const int WM_KEYDOWN = 0x100;
const int WM_KEYUP = 0x101;
Process[] processes = null;
if (Process.GetProcessesByName("javaw") != null)
{
processes = Process.GetProcessesByName("javaw");
}
foreach (Process p in processes)
{
IntPtr pFoundWindow = p.MainWindowHandle;
SetForegroundWindow(pFoundWindow.ToInt32());
Thread.Sleep(2000);
SendKeys.Send("{F2}");
PostMessage(pFoundWindow, WM_KEYDOWN, 0x71, 0);
}
}
|
|
|
|
|
In addition to the other advice you have been given, you should consider that F5 is pretty much the standard key to use for refresh.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
I wouldn't let CG touch my Abacus!
When you're wrestling a gorilla, you don't stop when you're tired, you stop when the gorilla is.
|
|
|
|
|
Yes it is normally f5, our developers must have overlooked that unfortunately
|
|
|
|
|
First of all I don't understand what a refresh is going to do on a window you are not seeing anyway.
And then I have some doubt a minimized window will be receiving anything.
As your target app seems to be an in-house development, this is what I would suggest:
- create an extra window, make it visible, not shown in taskbar, off-screen, and with a unique title;
- have it override its WndProc and check for a special message (a WM_USER kind of message, not a regular one);
The other app now should:
- locate the target app;
- find the off-screen window based on its title;
- send the Window message your target app will react on.
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
Hi all,
I have been looking at some example code around and wonder if anyone knows what the differences/uses/benefits are of the following two examples for creating an instance of a class (if there are any at all)
Example 1: The Norm (in my experience)
Class Code:
public Person(){
}
Usage Code:
Person person = new Person();
Example 2: Via a Static Method
Class Code:
public static Person CreatePerson(){
return new Person();
}
Usage Code:
Person person = Person.CreatePerson();
Thanks
Illogical thoughts make me ill
|
|
|
|