Expiring Today—Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Current Apps running...

Posted on 1998-03-10
2
Medium Priority
?
150 Views
Last Modified: 2010-04-06
I need to know a procedure or routine that tells you what apps are running under windows 95. I'm writing an app which should say which apps are currently being executed in the win95 operating system. I know there is EnumWindows but I don't know how to use it. Please Help!
0
Comment
Question by:kh5395
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 5

Accepted Solution

by:
inter earned 40 total points
ID: 1360399
Hi,

The following enumaretes more than you want, you can restrict or losen the criteria to display the memory contents on even window basis. Just change the IF statement in the EnumWindowsProc. To compile , create a new unit, add A button, A ListBox, assign OnClick event of button to the following code(Button1Click) then run.

var
  S : TStringList;

function EnumWindowsProc(hwnd : HWND ;lParam : longint):boolean;stdcall;
var
  wn : array[0..255] of char;
  pid: THandle;
  w : string;
begin
  if hwnd <> 0 then
  begin
    GetWindowThreadProcessId(hwnd, @pid);
    // filter out if this is our application window
    // and all child windows
    if (pid <> GetCurrentProcessId) and (GetParent(hwnd)= 0) then
    begin
      // get the caption
      // or use the commented IF to get application names
      if GetWindowText(hwnd, wn,sizeof(wn)) <> 0 then
//    if GetModuleFileName(GetWindowLong(hwnd,GWL_HINSTANCE),wn,sizeof(wn)) <> 0 then
      begin{}
        w:= Format('%6d ',[pid])+StrPas(wn);
        S.Add(w);
      end;{}
   end;
    result := true;
  end else result := false;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  try
   S := TStringList.Create;
   S.Sorted := true;
   S.Duplicates := dupIgnore;
   ListBox1.Items.Clear;
   S.Clear;
   EnumWindows(@EnumWindowsProc,0);
   ListBox1.Items.AddStrings(S);
  finally
    S.Free;
  end;
end;

Bye
Igor

0
 

Author Comment

by:kh5395
ID: 1360400
Thanks for the help!
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses

719 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question