home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Troubleshooting Netware Systems
/
CSTRIAL0196.BIN
/
attach
/
msj
/
v10n04
/
wqa0495.exe
/
STARTGRP.C
< prev
next >
Wrap
C/C++ Source or Header
|
1995-04-01
|
2KB
|
56 lines
#include <windows.h>
BOOL GetStartupGroupName( LPSTR lpszBuffer, unsigned cBuffSize );
int PASCAL WinMain( HANDLE h, HANDLE hPrev, LPSTR lpszCmdLine, int nCmdShow )
{
char szGroupName[260];
if ( GetStartupGroupName( szGroupName, sizeof(szGroupName) ) )
MessageBox( 0, szGroupName, "The startup group name is...", MB_OK );
else
MessageBox( 0, "Startup group name not found", 0, MB_OK );
return 0;
}
BOOL GetStartupGroupName( LPSTR lpszBuffer, unsigned cBuffSize )
{
char szShellName[260];
HMODULE hModShell;
char szShellIni[260];
char szDefGroupName[260];
// Get the name of the shell EXE (typically PROGMAN.EXE)
// from the [BOOT] section of the SYSTEM.INI. It might not
// be PROGMAN.EXE if running something like Norton Desktop
GetPrivateProfileString("boot", "shell", "", szShellName,
sizeof(szShellName), "system.ini" );
if ( !szShellName[0] ) // Verify that we got the shell name
return FALSE;
// Get the module handle of the shell app so that we can use LoadString
hModShell = GetModuleHandle( szShellName );
if ( !hModShell )
return 0;
// String resource #6 is the name of the shell's INI file
// (e.g., PROGMAN.INI)
if ( !LoadString( hModShell, 6, szShellIni, sizeof(szShellIni) ) )
return FALSE;
// String resource #0x78 is the default name for the startup group.
if ( !LoadString(hModShell, 0x78, szDefGroupName, sizeof(szDefGroupName)))
return FALSE;
// The startup group name can be overrided with a "startup=" entry
// in the "Settings" section of the shell's .INI file. Go get that
// string if present. Pass the default startup group name found
// in the previous step as the lpszDefault parameter.
GetPrivateProfileString("Settings", "startup", szDefGroupName,
lpszBuffer, cBuffSize, szShellIni );
return TRUE;
}