Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


Detecting if a process is 16-bit or DOS (Win95B and Win98)

Posted on 1999-07-29
Medium Priority
Last Modified: 2013-12-03
I already know how to enumerate running processes on Windows 95 rev. B and Windows 98 using Process32First() and Process32Next() functions. My problem is that I need to be able to identify if the process is 32-bit (I don't care if it's console or not), 16-bit Windows, or a DOS program. How can I go about doing this?
Question by:eppsman
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
LVL 23

Expert Comment

ID: 1404130
Have a look at this article.. it has the info on how to determine the application type .

Determine if an Application is Console or GUI

Hope it helps!

LVL 23

Expert Comment

ID: 1404131
Easier methods:

1. The GetProcessVersion function obtains the major and minor version numbers of the system on which a specified process expects to run. Use the th32ProcessID member of the PROCESSENTRY32 structure. The version number returned by this function is the version number stamped in the image header of the .EXE file the process is running. Linker programs set this value.

2. The SHGetFileInfo function with the SHGFI_EXETYPE flag. Use the szExeFile member of the PROCESSENTRY32 structure.

Author Comment

ID: 1404132
Sorry, but I pointed out in my question that I don't care whether or not the process is GUI or console, but I need to find out which processes are DOS based and which ones are old 16-bit apps designed for Windows 3.1. I hope this clarify's everything.
 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

LVL 23

Expert Comment

ID: 1404133
If uFlags contains the SHGFI_EXETYPE flag, the return value specifies the type of the executable file. It will be one of the following values: Value  Executable File Type
0  Nonexecutable file or an error condition
LOWORD = NE or PE and HIWORD = 3.0, 3.5, or 4.0  Windows application
LOWORD = MZ and HIWORD = 0  MS-DOS .exe, .com, or .bat file
LOWORD = PE and HIWORD = 0  Win32 console application

LVL 20

Expert Comment

ID: 1404134
chensu is right,

here comes some Delphi code:

type TExeType = (etUnknown, etDos, etWin16, etConsole, etWin32);

function ExeType(exefile: string) : TExeType;
var c1  : cardinal;
    sfi : TSHFileInfo;
    s1  : string;
  s1:=chr(c1 and $ff)+chr((c1 and $ff00) shr 8);
  if       s1='MZ'                                                           then result:=etDos
  else if  s1='NE'                                                           then result:=etWin16
  else if (s1='PE') and (hiWord(c1)=0)                                       then result:=etConsole
  else if (s1='PE') and (hiWord(c1)>0)                                       then result:=etWin32
  else if IsTextEqual(upStr(ExtractFileName(exefile)),upStr('winoa386.mod')) then result:=etDos
  else                                                                            result:=etUnknown;

Regards, Madshi.


Author Comment

ID: 1404135
chensu, what header file do I need to #include for SHGetFileInfo()? Also, is this functioin available to all versions of Win95, or do they need IE4 for this function to be present on their system?
LVL 23

Expert Comment

ID: 1404136
#include <shellapi.h>

SHGetFileInfo is supported by Windows 95/NT 4.0 original version and later. See

Author Comment

ID: 1404137
chensu, I'll give you the points, so you may propose SHGetFileInfo() as an answer.
Thanks again.
LVL 23

Accepted Solution

chensu earned 800 total points
ID: 1404138
Thank you.

Featured Post

Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.

Question has a verified solution.

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

If you have ever found yourself doing a repetitive action with the mouse and keyboard, and if you have even a little programming experience, there is a good chance that you can use a text editor to whip together a sort of macro to automate the proce…
As more and more people are shifting to the latest .Net frameworks, the windows presentation framework is gaining importance by the day. Many people are now turning to WPF controls to provide a rich user experience. I have been using WPF controls fo…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA.…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

705 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