// (c) Niki Hammler <nhammler@scc.co.at>, http://www.nobaq.net


#include <windows.h>
#include <shellapi.h>

int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow )
{
	char buf[4096] = "";
	char exe[4096 + 13] = "";
	char param[4096*2 + 14 + 12] = "";

	char *ptr;

	if(!GetModuleFileName(NULL, buf, 4096))
	{
		MessageBox(NULL, "Could not get module file name", "Error", MB_OK | MB_ICONERROR);
	}

	ptr = buf + strlen(buf);

	while(*ptr-- != '\\' && ptr > buf) *(ptr+1) = 0;

	wsprintf(exe, "%stotalcmd.exe", buf);
	wsprintf(param, "/i=\"%swincmd.ini\" /F=\"%swcx_ftp.ini\"", buf, buf);

	if((int)ShellExecute(NULL, "open", exe, param, buf, SW_SHOWMAXIMIZED) <= 32)
	{
		MessageBox(NULL, "Could not start TotalCommander!", "Error", MB_OK | MB_ICONERROR);
	}

	return 0;
}



