Click here to Skip to main content
15,887,444 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
For a Windows Explorer shell extension that has a UI similar to "New / [file type]", i am looking for a possibility to automatically ente rename mode for the file being created.

Context menu handler and creating the intended file with a default name works fine. However, I have no idea how to programmatically enter rename mode.

(except sending keystrokes. You didn't want to recommend sending keystrokes, did you?)
Posted

Register your function/module to change the filename:

HKEY_CLASSES_ROOT\.<YourExtension>\ShellNew\command = <YourEXE> or <RUNDLL32.dll <YourDLL>, <YourDLLFunction>> "%1"

// modify file new exe

const char* CreateANewFileName(const char* old,char* buffnew,unsigned int buffsize)
{
	// do anything
	return buffnew;
}

int FAR PASCAL WinMain(HINSTANCE,HINSTANCE,char* filename,int)
{
	char	newfile[0x1000];
	if(filename && *filename)
	{
		MoveFile(filename,CreateANewFileName(filename,newfile,sizeof(newfile)));
	}
	return 0;
}

Regards.
 
Share this answer
 
v2
Create an edit control (as window) on the place of the file name and then rename the file after your operation.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900