Click here to Skip to main content
15,897,291 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Last entered username and password for a faster login in win32 Application. Pin
David Crow29-Mar-07 2:34
David Crow29-Mar-07 2:34 
GeneralRe: Last entered username and password for a faster login in win32 Application. Pin
amitmistry_petlad 29-Mar-07 2:42
amitmistry_petlad 29-Mar-07 2:42 
GeneralRe: Last entered username and password for a faster login in win32 Application. Pin
David Crow29-Mar-07 2:55
David Crow29-Mar-07 2:55 
GeneralRe: Last entered username and password for a faster login in win32 Application. Pin
amitmistry_petlad 29-Mar-07 2:59
amitmistry_petlad 29-Mar-07 2:59 
QuestionOnDropFiles() problem Pin
ghunzel0627-Mar-07 17:15
ghunzel0627-Mar-07 17:15 
AnswerRe: OnDropFiles() problem Pin
Parthi_Appu27-Mar-07 17:19
Parthi_Appu27-Mar-07 17:19 
GeneralRe: OnDropFiles() problem Pin
ghunzel0627-Mar-07 17:27
ghunzel0627-Mar-07 17:27 
GeneralRe: OnDropFiles() problem Pin
Parthi_Appu27-Mar-07 17:32
Parthi_Appu27-Mar-07 17:32 
GeneralRe: OnDropFiles() problem Pin
ghunzel0627-Mar-07 17:47
ghunzel0627-Mar-07 17:47 
GeneralRe: OnDropFiles() problem Pin
Parthi_Appu27-Mar-07 17:50
Parthi_Appu27-Mar-07 17:50 
GeneralRe: OnDropFiles() problem Pin
Naveen27-Mar-07 18:17
Naveen27-Mar-07 18:17 
GeneralRe: OnDropFiles() problem Pin
ghunzel0627-Mar-07 18:56
ghunzel0627-Mar-07 18:56 
GeneralRe: OnDropFiles() problem Pin
Parthi_Appu27-Mar-07 19:19
Parthi_Appu27-Mar-07 19:19 
AnswerRe: OnDropFiles() problem Pin
Stephen Hewitt27-Mar-07 17:23
Stephen Hewitt27-Mar-07 17:23 
GeneralRe: OnDropFiles() problem Pin
ghunzel0627-Mar-07 17:50
ghunzel0627-Mar-07 17:50 
GeneralRe: OnDropFiles() problem Pin
Parthi_Appu27-Mar-07 17:56
Parthi_Appu27-Mar-07 17:56 
GeneralRe: OnDropFiles() problem Pin
ghunzel0627-Mar-07 18:20
ghunzel0627-Mar-07 18:20 
GeneralRe: OnDropFiles() problem Pin
David Crow28-Mar-07 3:00
David Crow28-Mar-07 3:00 
GeneralRe: OnDropFiles() problem Pin
Stephen Hewitt27-Mar-07 17:58
Stephen Hewitt27-Mar-07 17:58 
Modify code like this:
void CLaunchDlg::OnDropFiles(HDROP dropInfo)
{
	// Get the number of pathnames that have been dropped
	WORD wNumFilesDropped = DragQueryFile(dropInfo, -1, NULL, 0);
 
	CString firstFile= _T("");
 
	// get all file names. but we'll only need the first one.
	for (WORD x = 0 ; x < wNumFilesDropped; x++)
	{
		// Get the number of bytes required by the file's full pathname
		WORD wPathnameSize = DragQueryFile(dropInfo, x, NULL, 0);
 
		// Allocate memory to contain full pathname & zero byte
		WCHAR* npszFile = new(nothrow) WCHAR[wPathnameSize + 1]; // SFH: I use 'new' and not 'LocalAlloc'.
 
		// If not enough memory, skip this one
		if (npszFile == NULL)
		{
			continue;
		}
 
		// Copy the pathname into the buffer
		DragQueryFile(dropInfo, x, npszFile, wPathnameSize + 1);
 
		// we only care about the first
		LPCTSTR pFileName = PathFindFileName(npszFile); // SFH: Extract just the filename.
		firstFile = pFileName;
 
		// clean up
		delete [] npszFile; // SFH: I use 'delete' and not 'LocalFree'.

		break; // SFH: Since we only care about the first why keep looping?
	}

	SetWindowText(firstFile);
}



Steve

GeneralRe: OnDropFiles() problem Pin
ghunzel0627-Mar-07 18:45
ghunzel0627-Mar-07 18:45 
GeneralRe: OnDropFiles() problem Pin
Stephen Hewitt27-Mar-07 18:53
Stephen Hewitt27-Mar-07 18:53 
GeneralRe: OnDropFiles() problem Pin
ghunzel0627-Mar-07 19:06
ghunzel0627-Mar-07 19:06 
QuestionSetTimer before CreateWindow() Pin
LiYS27-Mar-07 16:48
LiYS27-Mar-07 16:48 
AnswerRe: SetTimer before CreateWindow() Pin
Stephen Hewitt27-Mar-07 17:09
Stephen Hewitt27-Mar-07 17:09 
GeneralRe: SetTimer before CreateWindow() [modified] Pin
LiYS27-Mar-07 17:22
LiYS27-Mar-07 17:22 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.