Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C++ Windows Shell
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 8-Jun-11 6:01am
peterchen148.1K
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

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.
  Permalink  
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Create an edit control (as window) on the place of the file name and then rename the file after your operation.
  Permalink  

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

  Print Answers RSS
0 OriginalGriff 6,769
1 Sergey Alexandrovich Kryukov 6,338
2 DamithSL 5,408
3 Manas Bhardwaj 4,816
4 Maciej Los 4,195


Advertise | Privacy | Mobile
Web02 | 2.8.1411023.1 | Last Updated 9 Jun 2011
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100