#include <aced.h>
#include <rxregsvc.h>

void initApp();
void unloadApp();


void helloWorld();

void initApp()
{
    // register a command with the AutoCAD command mechanism
    acedRegCmds->addCommand("HELLOWORLD_COMMANDS",
                            "Hello",
                            "Bonjour",
                            ACRX_CMD_MODAL,
                            helloWorld);

	acutPrintf("%s%s", "Inside InitApp - ", "Registering commands with acedRegCmds\n");
	acutPrintf("Enter \"HELLO\" at the command prompt to execute.\n");
}

void unloadApp()
{
    acedRegCmds->removeGroup("HELLOWORLD_COMMANDS");
	acutPrintf("%s%s", "Goodbye\n", "Removing command group \"HELLO_COMMANDS\"\n");
}

void helloWorld()
{
    acutPrintf("\nHello World!");
}

extern "C" AcRx::AppRetCode 
acrxEntryPoint(AcRx::AppMsgCode msg, void* pkt)
{
    switch (msg) 
	    {
		case AcRx::kInitAppMsg:
		     acrxDynamicLinker->unlockApplication(pkt);
		     acrxRegisterAppMDIAware(pkt);
		     initApp();
		     break;
		case AcRx::kUnloadAppMsg:
		     unloadApp();
		     break;
		case AcRx::kLoadDwgMsg:
			acutPrintf("Received Acrx::kLoadDwgMsg\n");
			break
		default:
		     break;
    }
    return AcRx::kRetOK;
}
