An HWND is not global but specific for an application's domain. (It's essentially a pointer). It is therefore not possible to use an HWND outside of that application.
John Arlen
Posts
-
Using a HWND from another application. -
How can you enumerate "keys" of an Application objectFor Each key As String In Application.Contents.AllKeys Trace.WriteLine(Application.Contents(key)) Next
-
databind checkedlistbox to arraylistTo be honest, i'm a bit surprised that CheckedListbox doesn't expose DataSource and others. I'm sure there's a better answer, but at the least you can use it's base class' methods: ArrayList list = new ArrayList(); list.Add("Hello"); ListBox box = (ListBox)checkedListBox1; box.DataSource = list;
-
Database communicationIf you are going to have to *learn* either C++ or C#, i'd suggest C#. However C# can very easily handle this with the .NET data provider classes. The link below is to an article on using the Oracle Data Provider for .NET. Should give enough examples to help your decision out. http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dndotnet/html/manprooracperf.asp
-
About Get Data from Clipboard(Not saying this is your problem, but...) As written, the code you supplied will not work as you expect. You declare "System.Object obj;" inside the if() statement. Therefore as soon as you exit the block (next line) - obj is no longer a valid object. To correct this (if it isn't just a typo in your sample), move the System.Object obj; declaration before the if( Data.Get....) statement.
-
Placing my .DLL into Reference ListAn assembly must be registered with the Global Assembly Cache to be accessible outside the application directory. Further, an assembly must be strong named to be added to the GAC. http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cptools/html/cpgrfglobalassemblycacheutilitygacutilexe.asp
-
Reference Application MainForm or ApplicationContextI'm not sure I understand exactly what you want to do, but the default Main() code looks like: [STAThread] static void Main() { Form1 form = new Form1(); Application.Run(form); } So the reference exists at that point. Obviously from within Form1, you have a reference with "this". The main questions would be - (1) where do you want to reference it? and (2) what specifically do you want to do with it?
-
Storing data in Clipboard to past into Microsoft ExcelThe Comma-Delimited Value isn't a string - which is the confusing part. The following code will do what you want. // Place comma-delimited on clipboard string commaText = "1,2,3,4,5,6,7,8,9"; byte[] bytes = System.Text.Encoding.UTF8.GetBytes(commaText); MemoryStream stream = new MemoryStream(bytes); DataObject dataObject = new DataObject(); dataObject.SetData(DataFormats.CommaSeparatedValue, stream); Clipboard.SetDataObject(dataObject, true); // Read comma-delimited from clipboard string values=string.Empty; IDataObject dataObject = Clipboard.GetDataObject(); if(dataObject.GetDataPresent(DataFormats.CommaSeparatedValue)) { StreamReader streamReader = new StreamReader((Stream) dataObject.GetData(DataFormats.CommaSeparatedValue)); values = streamReader.ReadToEnd(); streamReader.Close(); } Console.WriteLine( values );
-
It won't update the last modified date in VS.Net 2003!!The text is misleading. It states: "Open an Existing Project". However it is referring to the solution files (*.sln). This date will only be updated when the solution is modified - such as adding/removing a project, changing Configuration Manager or Build Order. The date will *not* be changed, however, when the code for a project is changed, or even new classes added to an existing project.
-
Extracting path from URL?System.IO.Path class offers several static functions that work on both file system paths as well as URLs. The one that addresses your question is: "http://samplesite.com/account" == Path.GetDirectoryName("http://samplesite.com/account/myaccount.aspx");
-
Another Bug in the .net datagrid ???More specifically, the .Leave event is fired when the currently selected cell is scrolled out of view (up or down). Curiously, no Enter event is fired when it is scrolled back in view but a Leave *will* be fired again if you continue scrolling. And in neither case is Got/LostFocus() fired. I don't usually like to call things bugs in frameworks like this as I usually find the reason or solution as soon as I do. Depending on what you want to do when focus is lost and gained, I think you can find a pattern of events to identify this situation. For example, clicking between cells causes: GotFocus, CurrentCellChanged, LostFocus However in the scrolling scenario: Leave, Validating, Validated
-
Dynamically determine server to use Web ServiceThere is a Url property to a Web Service. localhost.Service1 tService = new localhost.Service1(); tService.Url = "http://www.GoThere.com/Service1/";
-
How do I remove a class or anything from the .NET ide?To be honest, I never use the Class Viewer - working directly in Solution Explorer. From Solution Explorer, you can delete files, and assuming you follow standard practice of 1 class per file, this should do the same thing.
-
C# Class Library and VS.NET standard- Create a new Windows Application Project 2) Right-click the project in Solution Explorer 3) Select Properties 4) In General -> Change Output Type from Web Application to Class Library This will build a DLL. Now you can remove the Form1.cs if desired, and add classes. Edit: Hmm... didn't see the dozen responses before I replied. Oh well.
-
DoubleClick in TreeViewSolution de Uberness: ----------------------------------------------- using System; namespace UberControls { public class TreeViewNonExpanding : System.Windows.Forms.TreeView { private bool incomingDoubleClick = false; protected override void WndProc(ref System.Windows.Forms.Message m) { switch( m.Msg ) { case 0x0203: // WM_LBUTTONDBLCLK this.incomingDoubleClick = true; break; case 0x0202: // WM_LBUTTONUP this.incomingDoubleClick = false; break; default: break; } base.WndProc (ref m); } protected override void OnBeforeExpand(System.Windows.Forms.TreeViewCancelEventArgs e) { if( incomingDoubleClick == true ) e.Cancel = true; base.OnBeforeExpand (e); } } }
-
Get Version Number.The code you have should work perfectly. AssemblyVersion("*") isn't valid however. I actually got a compiler error when I tried to use it. The asterisk in the default tells the compiler to automatically increment the version as you build.. 1.0.4.3333 1.0.4.3334 ...etc... Use AssemblyVersion("1.0.*") or specify the full version ("1.0.0.0") If you debug your web service, do you also see 0.0.0.0 returned to string sValue?
-
Simple XPath QuestionYou have the right idea, but it depends on your actual XML. I suggest getting the node directly and looking at it. This will help answer your question. DogCat XmlNode node = doc.SelectSingleNode("//Prenom"); node.Value == null node.InnerText == "Dog"
-
Type.GetType("System.Drawing.Color") returns null?!You don't need to iterate... you know it belongs in System.Drawing. Assembly a = Assembly.LoadWithPartialName("System.Drawing"); Type t = a.GetType("System.Drawing.Color"); ...will do the job