|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Get names of opened windows and their process nameusername of the user, which have started the process. Better if can somehow intercept the starting of new process. When I need is to make sure that the user opens only one instance of process and only one process from specified list of processes, something like: The user may run Word.exe Excel.exe IExplore.exe if the user is running Word.exe, it should not be able to start excel.exe or Iexplore.exe. also no process should be started twice. And the whole thing should work in on standalone machines and in Terminal Server environment. any suggestions I think yhis is what you want:
http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=492&lngWId=10 I hope this article is useful. Haven't tried it myself though, as it's easy enough to code myself. Crouchie1998 BA (HONS) MCP MCSE will try and post the results
Show quoteHide quote "Crouchie1998" <crouchie1998@spamcop.net> wrote in message news:O2bR8aXfFHA.2840@tk2msftngp13.phx.gbl... >I think yhis is what you want: > > http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=492&lngWId=10 > > I hope this article is useful. Haven't tried it myself though, as it's > easy > enough to code myself. > > Crouchie1998 > BA (HONS) MCP MCSE > > Ok, it works,
I can get the handles to all opened windows with this sample code, but what next. Guess more API calls? Show quoteHide quote "Crouchie1998" <crouchie1998@spamcop.net> wrote in message news:O2bR8aXfFHA.2840@tk2msftngp13.phx.gbl... >I think yhis is what you want: > > http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=492&lngWId=10 > > I hope this article is useful. Haven't tried it myself though, as it's > easy > enough to code myself. > > Crouchie1998 > BA (HONS) MCP MCSE > > Hi Nikolay ! :O)
For standalone machine you don't even need Windows API any more : '*** Option Explicit On Imports System.Runtime Module MainModule Public Sub Main() For Each p As Process In Process.GetProcesses() ' excludes services and processes who don't have a window.. If (Not p.MainWindowHandle.Equals(IntPtr.Zero)) Then Console.WriteLine( _ "ProcessName={0}MainWindowTitle={1}", _ p.ProcessName.PadRight(30), p.MainWindowTitle) End If Next End Sub End Module '*** In TS i have no idea though . Maybe it works too. -- Show quoteHide quoteBest Regards Yanick "Nikolay Petrov" <johntup2_nospam_@mail.bg> a écrit dans le message de news:O3nVwoWfFHA.3612@TK2MSFTNGP12.phx.gbl... > I need to get the names of every opened window, its process name and the > username of the user, which have started the process. > Better if can somehow intercept the starting of new process. > > > When I need is to make sure that the user opens only one instance of process > and only one process from specified list of processes, something like: > The user may run > Word.exe > Excel.exe > IExplore.exe > if the user is running Word.exe, it should not be able to start excel.exe or > Iexplore.exe. > also no process should be started twice. > > And the whole thing should work in on standalone machines and in Terminal > Server environment. > > any suggestions > > > I used once a whole bunch of these funstions. this is one that shows most
aspects, and can be helpfully I think. It's a function that killed a certain process: Public Sub KillStarter() 'Get number of processes of you program Dim p As Process 'MyProcessToKill For Each p In Process.GetProcessesByName("'MyProcessToKill") Try 'MsgBox(p.Id & " - " & Process.GetCurrentProcess.Id) If p.Id <> Process.GetCurrentProcess.Id Then p.Kill() End If Catch ex As Exception 'niks: volgende pakken gewoon End Try Next p 'kill all the processes that has the same name as this process (so all the instances of this application that had been started before) For Each p In Process.GetProcessesByName(Process.GetCurrentProcess.ProcessName) Try 'MsgBox(p.Id & " - " & Process.GetCurrentProcess.Id) If p.Id <> Process.GetCurrentProcess.Id Then p.Kill() End If Catch ex As Exception 'niks: volgende pakken gewoon End Try Next p End Sub I hope this helps, Pieter Show quoteHide quote "Nikolay Petrov" <johntup2_nospam_@mail.bg> wrote in message news:O3nVwoWfFHA.3612@TK2MSFTNGP12.phx.gbl... > I need to get the names of every opened window, its process name and the > username of the user, which have started the process. > Better if can somehow intercept the starting of new process. > > > When I need is to make sure that the user opens only one instance of process > and only one process from specified list of processes, something like: > The user may run > Word.exe > Excel.exe > IExplore.exe > if the user is running Word.exe, it should not be able to start excel.exe or > Iexplore.exe. > also no process should be started twice. > > And the whole thing should work in on standalone machines and in Terminal > Server environment. > > any suggestions > > >
INI or XML
Check if Stored Procedure already exists in Access Database? WebBrowser control error manged alternative to get the complete text from each open window Adding desktop shortcuts and start program entries ApplicationDomains Calculating Time in VB .Net How to use OCX? Directinput How to link to a dll in vb.net |
|||||||||||||||||||||||