Hi @ITGeek82-8422 Show
Thank you for your question and reaching out. I can understand File and Folders gets opened up without double click. This issue happens, if there is mouse/hardware issue or it can be settings issue. I would suggest you to follow the troubleshooting steps as mentioned below: Method 1: Restore the defaults. Press Windows and E key together on your Keyboard. Method 2: Change the Mouse settings. Click on the Settings icon from the start menu. Also , please Download below tool diagnostic and repair too from Microsoft which will fix Folders and some customization related settings. https://support.microsoft.com/en-us/windows/automatically-diagnose-and-repair-windows-file-and-folder-problems-8ca2261a-eb4b-bda1-232c-d88b972438cd Hope this answers your question :) --If the reply is helpful, please Upvote and Accept as answer--
IntroductionWhen you double click a related file in Explorer, your app opens - but what if you want to open another file in the same instance of the app? If you double click another file in explorer, Windows will open a second instance ... So you need to talk to the first instance and tell it the new file and let it handle it. That's not too complex - but does involve Sockets - so I created the BackgroundJust an aside: If you want to open a specific file extension with your app in Windows 10 and the app doesn't self register to open them, then you can do it from within Explorer. I find this handy during dev, since I don't install my apps (when the registration of file extensions is normally done) on my dev machine as I want to run the debug version most of the time. To do it: Open Windows Explorer, and navigate to an example of your input file: (blahblah.myfiletype for example). Right click the file, and select Properties: Click "Change" and "More apps": Scroll to the bottom of the list, make sure "Always use this app to open ..." is checked, and select "Look for another app on this PC": Browse to the EXE file for your app, and click "OK". Now when you double click, Windows will open the right app for you. Using the CodeWhen you double click a file, Windows opens the associated app, and passes the full file path as a command line argument. This works fine, and has done for many, many versions of Windows - right back to V1.0, I believe. And it's easy to get that argument - there are two ways. For a Console app, they are passed as a For a GUI app, they are available as an array of The problem is ... once your app is running, that collection can't be added to, or changed in any way - Windows can't add "new arguments" to the array, and has no way to "alert you" that a new one is available. So ... what you have to do is:
And that means Sockets and TCP stuff. Yeuch. So, I created a To use it is pretty simple. Add to your main form private void FrmMain_Load(object sender, FormClosingEventArgs e) { DynamicArgument da = DynamicArgument.Create(); da.ArgumentReceived += Application_ArgumentReceived; bool result = da.Start(); if (!result) Close(); }
Add your event handler, and Then just handle your event and do what you need to with the arguments: private void Application_ArgumentReceived(object sender, DynamicArgument.DynamicArgmentEventArgs e) { tbData.Text += "\r\n" + e.Argument; } How It All WorksThere are three files in the system, two of them are "support files": ByteArrayBuilder.cs and IByteArrayBuildable.cs. These two are part of the "packaging the data up" system and are described in a different Tip: ByteArrayBuilder - a StringBuilder for Bytes - yes, I could have used JSON or XML, but I prefer JSON and forcing you to add a reference and a large nuget package to your app didn't really appeal. Free free to change it if JSON or XML is a better fit for you. The other file is the class that does the work: DynamicArguments.cs When you construct the one-and-only instance of the class, it reads the arguments and stores them in a queue. You then call
Listener ThreadOK, there are fine details going on here ... so either skip this section and assume it "works by magic" or read on. A Listener Socket is a blocking object: it stops your thread doing anything else until a client makes contact. That's fine, and exactly what you would expect, except it's also a pain since you're on the UI thread and that stops your whole system doing anything. So you have to put the
The way to avoid these is to use a
BackgroundWorker - it automatically does all the Background threads are "don't care" threads: the system will kill them automatically when the app closes, unlike Foreground threads which run until they themselves exit. Yes, we could use a Thread or Task object directly, and set it as a Background thread and also handle the Invoke - but there is a class that does both for me, so I'll simplify my code and use that! So ... you call BackgroundWorker listener = new BackgroundWorker(); listener.DoWork += Listener_DoWork; listener.WorkerReportsProgress = true; listener.ProgressChanged += Listener_NewArguments; listener.RunWorkerAsync(); PassUpAllArguments(); return true; The IPAddress ipAddress = GetMyIP(); while (true) { TcpListener listener = new TcpListener(ipAddress, ListenPort); listener.Start(); while (true) { try { using (Socket s = listener.AcceptSocket()) { ... } } catch (Exception ex) { Debug.WriteLine(ex.ToString()); } } } } When it gets a connection, it reads it, converts it to separate arguments and enqueues them before using int length = s.Available; if (length > 0) { byte[] buffer = new byte[length]; s.Receive(buffer); ByteArrayBuilder bab = new ByteArrayBuilder(buffer); byte cc = bab.GetByte(); if (cc == CC_Argument) { int argCount = bab.GetInt(); for (int i = 0; i < argCount; i++) { string arg = bab.GetString(); Arguments.Enqueue(arg); } work.ReportProgress(0, 0); } } Since the private void Listener_NewArguments(object sender, ProgressChangedEventArgs e) { if (e.UserState is string arg) { Arguments.Enqueue(arg); } PassUpAllArguments(); } public event EventHandler<DynamicArgmentEventArgs> ArgumentReceived; protected virtual void OnArgumentReceived(DynamicArgmentEventArgs e) { ArgumentReceived?.Invoke(this, e); } private void PassUpAllArguments() { while (Arguments.Count > 0) { OnArgumentReceived(new DynamicArgmentEventArgs() { Argument = Arguments.Dequeue() }); } } Not that complicated really, it just seems like it when you are trying to debug this stuff... Send and ForgetWhen this isn't the only instance, we need to do the reverse: build up a block of data, and open a Client to send it. That's a lot simpler; everything stays in the SendTime(); String strHostName = Dns.GetHostName(); IPHostEntry ipEntry = Dns.GetHostEntry(strHostName); IPAddress ipAddress = ipEntry.AddressList[0]; using (TcpClient tc = new TcpClient(strHostName, ListenPort)) { NetworkStream stream = tc.GetStream(); ByteArrayBuilder bab = new ByteArrayBuilder(); bab.Append(CC_Argument); int argCount = Arguments.Count; bab.Append(argCount); while (argCount-- > 0) { bab.Append(Arguments.Dequeue()); } byte[] data = bab.ToArray(); stream.Write(data, 0, data.Length); stream.Flush(); } return false;
private void SendTime() { String strHostName = Dns.GetHostName(); using (TcpClient tc = new TcpClient(strHostName, ListenPort)) { NetworkStream stream = tc.GetStream(); ByteArrayBuilder bab = new ByteArrayBuilder(); bab.Append(CC_TimeStamp); bab.Append(1); bab.Append(DateTime.Now.ToString("hh:mm:ss")); byte[] data = bab.ToArray(); stream.Write(data, 0, data.Length); } } Once we have a connection, we just bundle the data up (here, you could use JSON or XML if you wanted) and send it to the Listener app. And that's it: all done! History
Born at an early age, he grew
older. At the same time, his hair grew longer, and was tied up behind his head. How do I make a file open with a specific program?On the Start menu, select Settings > Apps > Default apps.. Select which default you want to set, and then choose the app. You can also get new apps in Microsoft Store. ... . You may want your . pdf files, or email, or music to automatically open using an app other than the one provided by Microsoft.. How can you eliminate the possibility that an application error is caused by another application or service running in the background?How can you eliminate the possibility that an application error is caused by another application or service running in the background? Run the application after starting the system in Safe Mode.
What is the name of the program in Windows that will allow you to manage files and folders?You can view and organize files and folders using a built-in application known as File Explorer (called Windows Explorer in Windows 7 and earlier versions). To open File Explorer, click the File Explorer icon on the taskbar, or double-click any folder on your desktop.
How do I make a program open another program?From the desktop, right-click the desired file, select Open with, and click Choose another app from the menu that appears. Select the desired application.
|