Windows API
ID #1008
How to run application that will not be displayed in task bar?
It is possible to hide application only under Windows 95/98. It should use function RegisterServiceProcess:
! MAP Section
MAP
MODULE('API')
GetVersionEx(LONG),NAME('GetVersionExA'),SIGNED,PASCAL,PROC,RAW
RegisterServiceProcess(ULONG dwProcessId,ULONG dwType),ULONG,RAW,PASCAL
GetCurrentProcessId(),ULONG,RAW,PASCAL
END
END
! Data Section
VER_PLATFORM_WIN32_NT EQUATE(2)
VER_PLATFORM_WIN32_WINDOWS EQUATE(1)
VER_PLATFORM_WIN32S EQUATE(0)
OVI GROUP,PRE(OVI)
OVI:dwOSVersionInfoSize DWORD
OVI:dwMajorVersion DWORD
OVI:dwMinorVersion DWORD
OVI:dwBuildNumber DWORD
OVI:dwPlatformId DWORD
OVI:szCSDVersion CHAR,DIM(128)
END
! Code Section
! Define version of Windows
OVI:dwOSVersionInfoSize = SIZE(OVI)
IF GetVersionEx( ADDRESS(OVI) ) = 0
MESSAGE('Unable to determine Windows version','Error')
ELSE
CASE OVI:dwPlatformId
OF VER_PLATFORM_WIN32S
g:OSType = 0
MESSAGE('Unable to run under Win32s - get a real OS','Error')
OF VER_PLATFORM_WIN32_WINDOWS
g:OSType = 1
g:WindowsPath = LOWER(GetRegistry('SoftwareMicrosoftWindowsCurrentVersion',|
'SystemRoot','',HKEY_LOCAL_MACHINE))
OF VER_PLATFORM_WIN32_NT
IF OVI:dwMajorVersion = 5
g:OSType = 1 ! Windows 2000
ELSE
g:OSType = 2 ! Windows NT
END
g:WindowsPath = LOWER(GetRegistry('SoftwareMicrosoftWindows NTCurrentVersion',|
'SystemRoot','',HKEY_LOCAL_MACHINE))
ELSE
MESSAGE('Unable to determine which Windows you have','Error')
END
END
! Register as service only under Windows 9x
IF g:OSType = 1 ! Win9x
loc:CurrentProcessId = GetCurrentProcessId()
r# = RegisterServiceProcess( loc:CurrentProcessId, 1)
END
Tags: application, taskbar
Related entries:
- How to prevent running of Application Wizard creating new application?
- How to change first calling procedure when application started?
- How to know if user leave the application?
- How to read from application environment variable?
- How to use animated cursor in application?
Last update: 2007-07-17 11:32
Author: Sergey Gundorov
Revision: 1.0
You can comment on this entry