|
On my XP laptop the duplicate display functionality is available only through the graphics adapter manufacturer's own control panel (nvidia). I do find it's of limited use unless the resolution and geometry of both displays are the same.
For example if I attach a 1024x768 external monitor then the laptop's 1400x1050 display will only use the central 1024x768 portion.
Alan.
|
|
|
|
|
how to create a background worker function that run to generate a long-running report on a diferent thread?
|
|
|
|
|
|
Rather than using a BackgroundWorker, try using the Task Parallel Library.
|
|
|
|
|
I am trying to trace IP-Address who is deleting files from my share folders. I have write a code to get information when trying to do something in my share folder but, I can't get the IP from where the delete event's is occurred.
Yes.......
|
|
|
|
|
Yep. Windows doesn't track where the command came from.
This sounds more like someone shouldn't have permissions to your shared folder. Did you setup security on the share or did you just let "Everyone" have Full Control permissions over the folder?
|
|
|
|
|
If you know the shared folders, you would be much better off restricting who has access to the share.
|
|
|
|
|
In the below code sample, a base class constructor was called, with an object created in the argument list. I need to dispose the object created in the argument list. Sample code below
//base class constructor
public Class1(String str, Dbcontext dbcontext)
{
this.str = str;
this.dbcontext = dbcontext;
}
...
//derived class
public Class2(String str, Dbcontext dbcontext):base("xxx", new YYYEntities)
{
}
Please share your thoughts to dispose the highlighted object created.
Adam
|
|
|
|
|
The GC will do it.
Any particular reasons why you're asking, or just curious?
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Not your job. If you didn't create it, don't destroy it. If you didn't open it, don't close it. If you didn't set it, don't clear it.
You'll never get very far if all you do is follow instructions.
|
|
|
|
|
I am able to create a XML file like this:
="1.0"
-<testsuite>
<Name>testsuite</Name>
<Address>Colony</Address>
<Char>arc</Char>
</testsuite>
With the following code:
XmlTextWriter textWriter = new XmlTextWriter("C:\\XML files\\API_PASS.xml", null);
textWriter.WriteStartDocument();
textWriter.WriteStartElement("testsuite");
textWriter.WriteStartElement("Name", "");
textWriter.WriteString("testsuite");
textWriter.WriteEndElement();
textWriter.WriteStartElement("Address", ""); textWriter.WriteString("Colony");
textWriter.WriteEndElement();
char[] ch = new char[3];
ch[0] = 'a';
ch[1] = 'r';
ch[2] = 'c';
textWriter.WriteStartElement("Char");
textWriter.WriteChars(ch, 0, ch.Length);
textWriter.WriteEndElement();
textWriter.WriteEndDocument();
textWriter.Close();
*) But I was required to add some more detail for the first element (keep the last line as it is), for example:
-<testsuite errors="0">
I tried to add in the:
textWriter.WriteStartElement("testsuite errors=\"0\");
but it shows nothing in the xml file
Anyone can help?
|
|
|
|
|
You don't need to write another element, but an attribute[^] inside that element.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
code snippet for adding attribute in xml:
xmlWriter.WriteStartElement("testsuite");
xmlWriter.WriteAttributeString("errors", "0");
|
|
|
|
|
Hi all, is it possible to write to a file using a StreamWriter object while the file is open. What I'm trying to do is create a webpage for personal use that will serve as a webpage editor. In this page there will be an iframe, 2 text boxes and a button which will be used to specify which page element to modify.
In the iframe of this page I want to be able to open any webpage in my domain. Then I want to be able to modify things on the page inside the iframe such as text and images. I'm planning to read the code and markup of the page being displayed in the iframe using a StreamReader object, and modify it using a StreamWriter object while it's still open.
Is this doable? Please comment, thanks in advance.
modified 17-May-14 4:56am.
|
|
|
|
|
Hi,
I need to create a usercontrol containing a listbox and a scrollbar in order to be able to skin the scrollbar.
Unfortunately, I have to recode all listbox's methods if I want my usercontrol to have the same behavior as a classical Listbox...
Is there a better way to reach all the listbox's methods without recoding them all ?
Thanks in advance, that'll be very usefull
|
|
|
|
|
Why would you want to do this in the first place? And why do you think you will have to recode all the ListBox's methods? Isn't that why OOP includes inheritance?
|
|
|
|
|
Don't think he can inherit - sound like he is encapsulating the Listbox and a Scrollbar, so he can't inherit directly from the ListBox. Which means he has to provide pass-through methods or expose the ListBox directly - which he doesn't want to do.
Those who fail to learn history are doomed to repeat it. --- George Santayana (December 16, 1863 – September 26, 1952)
Those who fail to clear history are doomed to explain it. --- OriginalGriff (February 24, 1959 – ∞)
|
|
|
|
|
|
If you want to access events of listbox in usercontrol without extra effort, not possible.
If you want to access properties of listbox, create a property in Userclass.
public ListBox listBox
{
get { return listBox1; }
}
and you need to define all required events;
public event EventHandler ListBoxClick
{
add { listBox1.Click += value; }
remove { listBox1.Click -= value; }
}
Tim Toady Bicarbonate
modified 17-May-14 17:04pm.
|
|
|
|
|
Learn WPF. This is EXACTLY what its intended for. ZERO C# to skin a control and its scrollbars.
|
|
|
|
|
Thanks for all four replies
I came to the evidence that I need to learn WPF
|
|
|
|
|
I have used SPY to find the intended Child window and used those DllImport("user32", ... as indicated in http://msdn.microsoft.com/en-us/magazine/cc163738.aspx#S3, but it doesn't work with the following codes:
WindowsEnumerator enumerator = new WindowsEnumerator();
foreach (WindowsEnumerator.ApiWindow top in enumerator.GetTopLevelWindows())
{
if (top.MainWindowTitle == "Client Builder")
{
foreach (WindowsEnumerator.ApiWindow child in enumerator.GetChildWindows(top.hWnd))
{
if (child.ClassName == "Child_ClassName" && child.MainWindowTitle == "Child_Title")
{
IntPtr Chd_win = IntPtr.Zero;
Chd_win = FindWindowEx(hwnd, Chd_win, child.ClassName, child.MainWindowTitle);
PostMessage(Chd_win, WM_LBUTTONDOWN, 5, 5);
PostMessage(Chd_win, WM_LBUTTONUP, 5, 5);
MessageBox.Show(child.ClassName + ", " + child.MainWindowTitle, "");
}
}
}
}
*) The Child Window pointer Chd_win always returns Zero even if it found the correct child.MainWindowTitle & child.ClassName (it confirms with the MessageBox.Show(child.ClassName + ", " + child.MainWindowTitle, "")
*) I can send the image with the SPY shows Child Window with the GUI if you provide the Email address (for easier to understand my problem)
Thanks in-advanced
|
|
|
|
|
Can you explain how your code operates, that is, what do you think it does.
I have
1) Enumerate all top level windows and select one by title
2) Enumerate the 1st level of child windows and select one by class name and title
3) ???
What is that FindWindowEx call doing? The assignment of the hwnd argument is unclear (typo?) but as configured FindWindowEx is searching for the first child of 'hwnd' with the same classname and title as the child window found by the GetChildWindows enumerator. If the call is successful what is the relationship of the window found to the selected child window found by the enumerator?
Alan.
|
|
|
|
|
- The function FindWindowEx(hwnd, Chd_win, child.ClassName, child.MainWindowTitle); supposed to return the Child Window pointer (Chd_win) which referent from child.ClassName & child.MainWindowTitle (from Parent Window = hwnd pointer)
- In my case I do have correct hwnd pointer (parent) and its child.ClassName & child.MainWindowTitle also correctly ... however, somehow it couldn't find Child Window pointer = Chd_win!!!
I hope that I explain correctly!
|
|
|
|
|
I was trying to understand why you were calling FindWindowEx but I'm still not sure.
Are you saying that the GetChildWindows method can create an ApiWindow object where the ClassName and MainWindowTitle properties have the expected values but the hWnd property value is IntPtr.Zero.
|
|
|
|