This is, what I use under 32 bit; the 16 bit stuff is quite similar, but
you don't
need to worry about spaces and long file names there.

#include "ddeml.h"
#include "wdsticns.h"


CInstIcon::CInstIcon( String sGroup,
		String sExecutable,
		String sCmdLineOptions,
		String sDescription,
		String sIconFileName,
		int iIconNr,
		String sWorkDir)
{
	m_sGroup = sGroup;
	m_sExecutable = sExecutable;
	m_sCmdLineOptions = sCmdLineOptions;
	m_sDescription = sDescription;
	if( !sIconFileName.IsEmpty())
	{	GetShortPathName( sIconFileName, m_sIconFileName.GetBuffer( _MAX_PATH
+1), _MAX_PATH);
		m_sIconFileName.ReleaseBuffer();
	}
	m_iIconNr = iIconNr;
	m_sWorkDir = sWorkDir;
	m_bPrivateGroup = FALSE;
}

void CInstIcon::SetGroup( String s)
{	m_sGroup = s;}

void CInstIcon::SetCommandLineOptions( String s)
{	m_sCmdLineOptions = s;}

void CInstIcon::SetExecutableFileName( String s)
{	m_sExecutable = s;}

void CInstIcon::SetDescription( String s)
{	m_sDescription = s;}

void CInstIcon::SetIconFileName( String s)
{
	if( !s.IsEmpty())
	{
		GetShortPathName( s, m_sIconFileName.GetBuffer( _MAX_PATH +1),
_MAX_PATH);
		m_sIconFileName.ReleaseBuffer();
	}
	else
		m_sIconFileName = s;
}

void CInstIcon::SetIconIndex( int i)
{	m_iIconNr = i;}

void CInstIcon::SetWorkingDirectory( String s)
{	m_sWorkDir = s;}

void CInstIcon::MakePrivateGroup( void) 
{	m_bPrivateGroup = TRUE;};

void CInstIcon::MakePublicGroup( void)
{	m_bPrivateGroup = FALSE;};

BOOL CInstIcon::CreateIcon( void)
{
	if( m_sGroup.IsEmpty() 
		||
		m_sDescription.IsEmpty())
		return FALSE;
	else
		return InstIcon( 
			m_sGroup,
			m_sExecutable,
			m_sCmdLineOptions,
			m_sDescription,
			m_sIconFileName,
			m_iIconNr,
			m_sWorkDir,
			m_bPrivateGroup);
}


BOOL 
InstIcon(	String sGroup,
			String sExecutable,
			String sCmdLineOptions,
			String sDescription,
			String sIconFileName,
			int iIconNr,
			String sWorkDir,
			BOOL bPrivate)
{
	char caIconNr[5];
	itoa( iIconNr, caIconNr, 10);
	String sIconNr = caIconNr; sIconNr.Trim();
	
	String sDDECommand;
	// start with the group..
	sDDECommand = "[CreateGroup(";
	sDDECommand += sGroup;
	if( bPrivate)
		sDDECommand += ",0)]";
	else
		sDDECommand += ")]";

	// Create / open Group
//	SendExecCmd( (LPBYTE)sDDECommand.GetBuffer( _MAX_PATH));
//	sDDECommand.ReleaseBuffer();


	if( !sIconFileName.IsEmpty())// now insert the icon
	{
		GetShortPathName( sIconFileName, sIconFileName.GetBuffer( _MAX_PATH +1),
_MAX_PATH);
		sIconFileName.ReleaseBuffer();
		sIconFileName.Trim();
		if( !sIconFileName.IsEmpty())
		{
			if( '\"' != sIconFileName[0])
				sIconFileName = "\"" + sIconFileName;
			if( '\"' != sIconFileName[sIconFileName.GetLength() -1])
				sIconFileName += "\"";
		}
	}
	if( !sExecutable.IsEmpty())
	{
		sExecutable.Trim();
		if( '\"' != sExecutable[0])
			sExecutable = "\"" + sExecutable;
		if( '\"' != sExecutable[sExecutable.GetLength() -1])
			sExecutable += "\"";
	}

	if( !sWorkDir.IsEmpty())
	{
		sWorkDir.Trim();
		if( '\"' != sWorkDir[0])
			sWorkDir = "\"" + sWorkDir;
		if( '\"' != sWorkDir[sWorkDir.GetLength() -1])
			sWorkDir += "\"";
	}
	sDDECommand += "[AddItem(" + sExecutable +  " " + sCmdLineOptions;
	sDDECommand +=(String)", " + sDescription + (String)"," + sIconFileName
+",";
	sDDECommand += sIconNr + ",,," + sWorkDir + ")]";
	//sDDECommand += "[ShowGroup(" +sGroup +",6)]";
	sDDECommand.Trace( TL_NORMAL);
	BOOL bReturn = SendExecCmd( (LPBYTE)sDDECommand.GetBuffer( _MAX_PATH));
	sDDECommand.ReleaseBuffer();	

	return bReturn;	
}

//
// Callback function for DDE messages
//

HDDEDATA CALLBACK DDECallback(UINT wType, 
                              UINT, 
                              HCONV,
                              HSZ, 
                              HSZ, 
                              HDDEDATA, 
                              DWORD, 
                              DWORD)
{
    switch (wType) {
    case 0:
    default:
        return NULL;
        break;
    }// EO switch
}  // EO HDDEDATA CALLBACK DDECallback(

//
// Send an execute request to the Program Manager
//

static BOOL SendExecCmd(LPBYTE lpbyteCmd)
{
    DWORD dwDDEInst = 0;
    UINT ui;
    HSZ hszProgman;
    HCONV hConv;
    HDDEDATA hExecData;
    FARPROC pfnDDECallback;

	pfnDDECallback = MakeProcInstance((FARPROC) DDECallback,
theApp.m_hInstance);
    //				   
    // Initialize DDEML
    //
    ui = DdeInitialize(&dwDDEInst,
                       (PFNCALLBACK)pfnDDECallback,
                       CBF_FAIL_ALLSVRXACTIONS,
                       0l);

    if (ui != DMLERR_NO_ERROR) {
        return FALSE;
    }

    //
    // Initiate a conversation the the PROGMAN service
    // on the PROGMAN topic.
    //
    hszProgman = DdeCreateStringHandle(dwDDEInst,
                                       "PROGMAN",
                                       CP_WINANSI);
    hConv = DdeConnect(dwDDEInst,
                       hszProgman,
                       hszProgman,
                       NULL);

    //
    // Free the HSZ now
    //
    DdeFreeStringHandle(dwDDEInst, hszProgman);

    if (!hConv) {
        return FALSE;
    }

    //
    // Create a data handle for the exec string
    //
    hExecData = DdeCreateDataHandle(dwDDEInst,
                                    lpbyteCmd,
                                    lstrlen((char*)lpbyteCmd)+1,
                                    0,
                                    NULL,
                                    0,
                                    0);

    //
    // Send the execute request
    //
    DdeClientTransaction((LPBYTE)hExecData,
                         (DWORD)-1,
                         hConv,
                         NULL,
                         0,
                         XTYP_EXECUTE,
                         1000, // ms timeout
                         NULL);

    //
    // Done with the conversation now.
    //
    DdeDisconnect(hConv);

    //
    // Done with DDEML
    //
    DdeUninitialize(dwDDEInst);
    FreeProcInstance( pfnDDECallback);
    return TRUE;
}




Glenn Cooper <glenn@qantas.e-mail.com> wrote in article
<01bc543d$b1aa5680$3e010ccb@qantas>...
> I am write a small install program in VC 1.5 for an application and need
to
> create a new program group in PROGMAN.  The help pages haves pointer me
in
> at DDE, but to date I have not been able to decode the help. Can anyone
> point me in the direction of an example/sample code.
> 
> 