Hi, Introducing Vista is the worst thing I ever experienced as a windows core developer.
I have the following code in Delphi to get a process id of an exe:
function FindAProcess(aExeFileName: String; aSkipProcessID: Cardinal = MAXWORD): Cardinal;
var
vSnapshotHandle: THandle;
vProcessEntry32: TProcessEntry32;
vExe: String;
begin
Result := MAXWORD;
vSnapshotHandle := CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
vProcessEntry32.dwSize := SizeOf(vProcessEntry32);
FillChar(vProcessEntry32.szExeFile, SizeOf(vProcessEntry32.szExeFile), 0);
try
if Process32First(vSnapshotHandle, vProcessEntry32) then
begin
repeat
vExe := ArrayOfCharToString(vProcessEntry32.szExeFile);
if (UpperCase(vExe) = UpperCase(aExeFileName)) or
(Pos(aExeFileName, vExe) > 0) then
begin
if (aSkipProcessID <> vProcessEntry32.th32ProcessID) and
(vProcessEntry32.th32ProcessID <> 0) then
begin
Result := vProcessEntry32.th32ProcessID;
Break;
end;
end;
FillChar(vProcessEntry32.szExeFile, SizeOf(vProcessEntry32.szExeFile), 0);
until not Process32Next(vSnapshotHandle, vProcessEntry32)
end;
finally
CloseHandle(vSnapshotHandle);
end;
end;
And guess what... In XP it works fine but in Vista SP1 I only get 1 process and that is [System Process].
This really drives me mad...
[tfl - 25 08 09] Hi - and thanks for your post. You should post questions like this to the MSDN Forums at http://forums.microsoft.com/msdn or the MSDN Newsgroups at
http://www.microsoft.com/communities/newsgroups/en-us/
. You are much more likely get a quicker response using the forums than through the Community Content. For specific help about:
Visual Studio :
http://groups.google.com/groups/dir?sel=usenet%3Dmicrosoft.public.vstudio%2C
&
SQL Server :
http://groups.google.com/groups/dir?sel=usenet%3Dmicrosoft.public.sqlserver%2C
&
.NET Framework :
http://groups.google.com/groups/dir?sel=usenet%3Dmicrosoft.public.dotnet.framework
PowerShell :
http://groups.google.com/group/microsoft.public.windows.powershell/topics?pli=1
All Public :
http://groups.google.com/groups/dir?sel=usenet%3Dmicrosoft.public%2C
&