handle

How to access a window?

不想你离开。 提交于 2020-01-04 01:58:15
问题 I'm trying to access a specific window using its handle (that is System.IntPtr value): // Getting the process of Visual Studio program var process = Process.GetProcessesByName("devenv")[0]; // Showing the handle we've got, we've no problem MessageBox.Show(this, process.MainWindowHandle.ToString()); // Attempting to get the main window object by its handle var wnd = NativeWindow.FromHandle(process.MainWindowHandle); // always fails if (wnd == null) MessageBox.Show("Failed"); else MessageBox

How get file path by handle in windbg?

岁酱吖の 提交于 2020-01-03 15:32:16
问题 How I can obtain file path from handle with windbg/kd in kernel mode? 回答1: Use !handle <handle_num> 7 <proc_id> to display detailed information for that handle where <handle_num> is the handle value and <proc_id> is the process id value (both hex based) see this msdn link for further information. You can gleam your process id from a user mode session, this is the easiest method, just attach in user mode and enter the pipe command | and it will output like so: . 0 id: 1680 attach name: D:\test

Java app with URLConnection leads “Too many open files”

左心房为你撑大大i 提交于 2020-01-03 12:58:50
问题 I wrote a small pieces of java program as following: package com.ny.utils.pub; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.net.HttpURLConnection; import java.net.MalformedURLException; import java.net.URL; public class NetWriter { private static String link = "http://xxx.yyyyyy.com:4444"; public String getLink() { return link; } public static void setLink(String link) { NetWriter.link = link; }

Java app with URLConnection leads “Too many open files”

与世无争的帅哥 提交于 2020-01-03 12:57:59
问题 I wrote a small pieces of java program as following: package com.ny.utils.pub; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.net.HttpURLConnection; import java.net.MalformedURLException; import java.net.URL; public class NetWriter { private static String link = "http://xxx.yyyyyy.com:4444"; public String getLink() { return link; } public static void setLink(String link) { NetWriter.link = link; }

Drawing and clearing on screen with Graphics.FromHwnd

你说的曾经没有我的故事 提交于 2020-01-01 12:14:12
问题 I am trying to create a program which gets the handle of the window under your cursor, show's some data about it and draws a filled rectangle (with very low alpha) on top of the whole window. I am using C# and winforms. I have succeeded in doing so, but the problem is my draw method is in a BackgroundWorker's loop and it keeps making more and more rectangles (-> rectangle with higher alpha) on the window or when moving mouse to another window the old one still exists. I haven't managed to

Drawing and clearing on screen with Graphics.FromHwnd

六眼飞鱼酱① 提交于 2020-01-01 12:13:13
问题 I am trying to create a program which gets the handle of the window under your cursor, show's some data about it and draws a filled rectangle (with very low alpha) on top of the whole window. I am using C# and winforms. I have succeeded in doing so, but the problem is my draw method is in a BackgroundWorker's loop and it keeps making more and more rectangles (-> rectangle with higher alpha) on the window or when moving mouse to another window the old one still exists. I haven't managed to

How can I tell if a given hWnd is still valid?

[亡魂溺海] 提交于 2020-01-01 07:31:13
问题 I'm using a third-party class that spawns an instance of Internet Explorer. This class has a property, hWnd, that returns the hWnd of the process. Later on down the line, I may want to reuse the instance of the application if it still exists, so I need to tell my helper class to attach to it. Prior to doing that, I'd like to know if the given hWnd is still valid, otherwise I'll spawn another instance. How can I do this in C# & .NET 3.5? 回答1: If it is a window handle, you can call isWindow

Same URL in multiple views in Django

被刻印的时光 ゝ 提交于 2020-01-01 04:53:28
问题 I'm developing a web application, and I need something like this: url(r'^$', 'collection.views.home', name='home'), url(r'^$', 'collection.views.main', name='main'), If the user is authenticated, go to main, otherwise go to home. On the home page, differently there will be a sign in a button. But these should be on the same URL pattern. How can I handle it? 回答1: To handle that kind of thing you can use a single view that follows different code paths depending on the request state. That can

Get handle of a window that has no title.. (C#)

老子叫甜甜 提交于 2019-12-31 04:01:08
问题 How can we get the handle of a window that doesn't have a title? Is there a way to enumerate all the windows on desktop and filter the window that don't have a title (in my case, there is only one) and getting the handle of it.. or by specifying other attributes like a window that has a specific button or listbox etc... 回答1: This should do it: ... using System.Runtime.InteropServices; using System.Diagnostics; ... public class foo() { ... [DllImport ("user32")] internal static extern int

Passing additional arguments through function handle in Matlab

霸气de小男生 提交于 2019-12-30 09:29:17
问题 I have a function to optimize, say Function, in Matlab. This function depends on variables (say x) over which I want to optimize and one parameter (say, Q) which does not need to be optimized.Hence, the function Function(x,Q). In other words, I have an array of values for Q and want to find optimal x values for each Q. However, I cannot find a way how to pass those Q values when using function handle @Function in optimization function. So, my question is how to pass those Q values when using