WTSapi32

Windows specific questions.
Post Reply
ring0
Posts: 14
Joined: Dec 26, 2012 6:33
Location: Oz

WTSapi32

Post by ring0 »

Hi,

Does a FreeBasic include file for WTSapi32 exist and if so where can I get it?

Thanks,
ring0
Tourist Trap
Posts: 2958
Joined: Jun 02, 2015 16:24

Re: WTSapi32

Post by Tourist Trap »

Hi,

I dont know the answer to your question but if you're looking for a way of making speach under Windows, here is a dummy example that I crafted previously. I just grabbed the speach procedures from somewhere in the forum and used it for fun:
https://freebasic.net/forum/viewtopic.p ... 2A#p231586

Maybe it can help?
ring0
Posts: 14
Joined: Dec 26, 2012 6:33
Location: Oz

Re: WTSapi32

Post by ring0 »

Hello Tourist Trap,

Thank you for your offer but I am not looking for a way of making speech under windows.
As far as I know WTSapi = Remote Desktop Services API
It can be used to enumerate processes by name which is what I want to do.

Cheers,
ring0
Tourist Trap
Posts: 2958
Joined: Jun 02, 2015 16:24

Re: WTSapi32

Post by Tourist Trap »

ring0 wrote:.
As far as I know WTSapi = Remote Desktop Services API
It can be used to enumerate processes by name which is what I want to do.
I see, I confounded with sapi.

https://msdn.microsoft.com/en-us/library/windows/desktop/ms682623(v=vs.85).aspx

It is about enumerating all active processes in the link above. I still dont know anyway how to make this work in fb. I will try to translate the msdn example once at home I think.

Have a good day.
ring0
Posts: 14
Joined: Dec 26, 2012 6:33
Location: Oz

Re: WTSapi32

Post by ring0 »

Hello TouristTrap,

Thank you for the link. That looks like it will accomplish what I want and so I will give it a try.

Cheers,
ring0
jj2007
Posts: 2326
Joined: Oct 23, 2016 15:28
Location: Roma, Italia
Contact:

Re: WTSapi32

Post by jj2007 »

ring0 wrote:It can be used to enumerate processes by name which is what I want to do.
Something like this?

Code: Select all

 Print "ct", Tb$, "ID", Tb$, "path"
 For_ count=0 To GetProcessArray(?)-1
         Print Str$("\n%i\t", count), Str$(MbProcID(count)), Tb$, MbProc$(count)
 Next
Output:

Code: Select all

ct      ID      path
0       2668    C:\Windows\System32\taskhost.exe
1       3164    C:\Program Files (x86)\NVIDIA Corporation\NvContainer\nvcontainer.exe
2       1216    C:\Windows\System32\dwm.exe
3       2408    C:\Windows\explorer.exe
4       3480    C:\Program Files\Microsoft Security Client\msseces.exe
5       2496    C:\Program Files (x86)\AutoHotkey\AutoHotkey.exe
6       2956    C:\ArcZip\FreeCommander\FreeCommander.exe
Under the hood you would find EnumProcesses and GetProcessImageFileName. But this is Psapi, not WTSapi32.
SARG
Posts: 1766
Joined: May 27, 2005 7:15
Location: FRANCE

Re: WTSapi32

Post by SARG »

I did a such list for fbdebugger.

Code: Select all

#Include Once "windows.bi"
#Include Once "win\tlhelp32.bi"
#Include Once "win\psapi.bi" 

#Define fmt(t,l) Left(t,l)+Space(l-Len(t))+"  "

Dim prcinfo As PROCESSENTRY32,snap As HANDLE
snap=CreateToolhelp32Snapshot (TH32CS_SNAPPROCESS, 0)'Take snapshot of running processes
If snap <> INVALID_HANDLE_VALUE Then
	prcinfo.dwSize=SizeOf(PROCESSENTRY32)
	Print "file Process name               ID  Nthread parent id"
	If Process32First (snap,@prcinfo) Then
		Do
			Print fmt(prcinfo.szExeFile,30)+fmt(Str(prcinfo.th32ProcessID),5)+fmt(Str(prcinfo.cntThreads),3)+fmt(Str(prcinfo.th32ParentProcessID),5)  
		Loop While  Process32Next (snap,@prcinfo)
	Else
		Print "Process list error, Failed to create process list!"
   End If
  	CloseHandle (snap)
Else
   Print "Process list error, Failed to create process list!"
End If
Sleep
ring0
Posts: 14
Joined: Dec 26, 2012 6:33
Location: Oz

Re: WTSapi32

Post by ring0 »

Thank you jj2007 and SARG for the info.

My initial interest in the WTSapi32.dll was from this link
http://codexpert.ro/blog/2013/12/01/li ... ices-api/
which seems to provide a very easy solution. However, I shall explore the methods that you have suggested since FB support already exists for them.
I may also try dynamically linking to WTSapi32.dll just as an exercise.

Thanks to all,
ring0
Post Reply