void
_makeTempFileName (char *str, const char *suffix)
{
	strcpy (str, mx_gettemppath ());

	strcat (str, "/hltempmodel");
	strcat (str, suffix);
}
示例#2
0
void
FileAssociation::setAssociation (int index)
{
	cExtension->select (index);
	leProgram->setLabel (d_associations[index].program);

	for (int i = 0; i < 4; i++)
		rbAction[i]->setChecked (i == d_associations[index].association);

	leProgram->setEnabled (d_associations[index].association == 0);
	bChooseProgram->setEnabled (d_associations[index].association == 0);

	// TODO: check for valid associtaion
#ifdef WIN32__
	char path[256];

	strcpy (path, mx_gettemppath ());
	strcat (path, "/hlmvtemp.");
	strcat (path, d_associations[index].extension);

	FILE *file = fopen (path, "wb");
	if (file)
		fclose (file);

	int val = (int) ShellExecute ((HWND) getHandle (), "open", path, 0, 0, SW_HIDE);
	char str[32];
	sprintf (str, "%d", val);
	setLabel (str);
	rbAction[1]->setEnabled (val != 31);
/*
	WORD dw = 0;
	HICON hIcon = ExtractAssociatedIcon ((HINSTANCE) GetWindowLong ((HWND) getHandle (), GWL_HINSTANCE), path, &dw);
	SendMessage ((HWND) getHandle (), WM_SETICON, (WPARAM) ICON_SMALL, (LPARAM) hIcon);
	char str[32];
	sprintf (str, "%d", (int) hIcon);
	setLabel (str);
*/
	DeleteFile (path);

	//DestroyIcon (hIcon);
#endif

	rbAction[2]->setEnabled (
		!mx_strcasecmp (d_associations[index].extension, "mdl") ||
		!mx_strcasecmp (d_associations[index].extension, "tga") ||
		!mx_strcasecmp (d_associations[index].extension, "wav")
	);
}