Solved

Current Apps running...

Posted on 1998-03-10
2
140 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
2 Comments
 
LVL 5

Accepted Solution

by:
inter earned 10 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Activex get website that activex running on 3 85
Thread safe  opinion 7 126
URL for downloading Google Chrome for Win XP 2 122
CheckListBox usage 3 51
The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

920 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now