0

I have an app that uses TabTip. When i want to close it i do this:

public void CloseTabTip()
    {
    foreach (Process pkiller in Process.GetProcesses())
    {
        if (pkiller.ProcessName.ToString() == "TabTip")
        {
            pkiller.Kill();
            return;
        }
    }
}

And it trows an exception: access denied. Now the strange thing is that it only does that when i close the TabTip manually. And even stranger than that it only does that when i close it manually using the touch screen. Because when i close it using the mouse it works fine.

The function CloseTabTip is called when i click a button. If i click the button after manually closing the TabTip with touch screen it trows exception but if i close it using mouse it does not.

Now, i have pondered that it was because of this, however even if i wait some seconds for the process to close it still trows this exception. I am thinking this is a Windows bug since it only give an error when i close TabTib using the touch screen.

Any ideas on how to "fix" this? I know i can use a try catch statement but that is not the most correct way of doing things.

Running app in WIN10

Community
  • 1
  • 1
meme
  • 597
  • 1
  • 10
  • 23
  • 1
    When you say by "mouse" it works - is the same code running? – BugFinder May 17 '16 at 10:46
  • 1
    "Windows bug", please explain? – t0mm13b May 17 '16 at 10:47
  • Yes. I have a function that closes the TabTip process. It is "tied" to a button click event. When i click the button after closing TabTip manually using touch screen it trows exception, if i close it with mouse it does not. – meme May 17 '16 at 10:48
  • 2
    It sounds like the code where it works and the code where it doesn't (you need to be more clear on this FYI) are running using different users. One has access one doesn't. – Liam May 17 '16 at 10:48
  • Edited the question. The code for closing the TabTip is always the same. Is what i do before it that makes it trow exception or not. Its always the same user running the program. – meme May 17 '16 at 10:53
  • Are you actually trying to get a process to kill itself when closing the app itself? Why would you do that? That's why an exception is being thrown. Let the event handler for handling the close event do its job which will allow itself get terminated in proper order. – t0mm13b May 17 '16 at 10:57
  • 1
    So if you close `TabTip`, the process does not exit, and you have to kill it. But depending on how you close `TabTip`, you get an access denied error. Is that correct? – wimh May 17 '16 at 10:57
  • In the app, either the user closes the TabTip manually or it closes "by itself" when they click a button. The exception is trown if the user closes the TabTip with touch screen but does not if he closes using a mouse. This means that when i do `Process.GetProcesses()` it returns `TabTip`even if the process is not alive. – meme May 17 '16 at 11:02
  • Are you running it inside Visual studio as administrator, and when build to release, running it as normal user? – t0mm13b May 17 '16 at 11:02
  • I ran the program with both, normal user and with admin. Both give error. Hence why i believe this is a `windows bug`. If anyone has a touch monitor at home, i encourage you to test this and see if it is also trowing exception in this circumstances. – meme May 17 '16 at 11:04
  • It is not a windows bug, this is a user security permission issue. What version of Windows is this? That is not clear in the question. – t0mm13b May 17 '16 at 11:06
  • Are you sure your `TabTip` is not getting just hidden when using the touch screen? In a way that the process would not be "being killed", whereas the mouse would close it definitely. It's easy to check: close it with the mouse, and see if the process dissapears from the Task Manager... "close" it with the touch screen, and see if it does too – Jcl May 17 '16 at 11:06
  • Ok. This is what i mean with windows bug: Jcl i checked it again and yes. The process is still running if i close it manually (touch or mouse). Now if i check if the process is running using the mouse to navigate to the desired window it does not trow exception, if i do it using the touch screen it trows the exception. – meme May 17 '16 at 11:16
  • It seems as if i use the mouse between the closing of TabTip(manually) and the running of the closing function it does not give error. If i only use the touch screen between operation it does trow exception. If you do not have a touch screen at your disposal, i suggest u do the program at "home" then run to your big electronics store and test it on a display pc xD – meme May 17 '16 at 11:22

0 Answers0