15 мая 2023 года "Исходники.РУ" отмечают своё 23-летие!
Поздравляем всех причастных и неравнодушных с этим событием!
И огромное спасибо всем, кто был и остаётся с нами все эти годы!

Главная Форум Журнал Wiki DRKB Discuz!ML Помощь проекту


CCommandLine info

Mark Rosen -- mrosen@peganet.com
Monday, September 16, 1996

	Environment: MS VC++ 4.0, Win95

	In my super-cool encryption program, I have the user drag a file onto a
shortcut to an actual executable which is stored somewhere else. To get the
name of the file, I construct a CCommandLine object, call
ParseCommandLine(&cmdline), and then use the cmdline.m_strFileName member
variable. This works fine, except the filename
is always in yucky DOS uppercase format (i.e.
"C:\WINDOWS\DESKTOP\LONGFI~1.ZIP"). Is there any workaround? Any other
method? Thanks.




Brad Wilson/Crucial Software -- crucial@pobox.com
Wednesday, September 18, 1996

[Mini-digest: 7 responses]

> is always in yucky DOS uppercase format (i.e.
> "C:\WINDOWS\DESKTOP\LONGFI~1.ZIP"). Is there any workaround? Any other
> method? Thanks.

::GetFullPathName() and ::GetShortPathName() are the converstion functions
(unrelated to MFC, however).

--
Brad Wilson             | crucial@pobox.com   http://www.thebrads.com/bradw
Objectivist Philosopher |
Software Engineer       | "You can surrender without a prayer,
Web Page Designer       |       but never really pray without surrender"
System Administrator    |               - Rush, "Resist" from Test For Echo

-----From: Mike Blaszczak 

According to the documentation in the Win32 SDK, you need to have your 
application register itself as taking long file names.  Otherwise, Windows
assumes you can't handle them and gives you the 8.3 name.


.B ekiM
http://www.nwlink.com/~mikeblas/
Don't look at my hands: look at my _shoulders_!
These words are my own. I do not speak on behalf of Microsoft.

-----From: Tomas Gudmundsson 

HI ! If your program uses the standard MFC framework, you can do the following in InitInstance() in your application class :
	// Enable DDE Execute open
	EnableShellOpen();
	RegisterShellFileTypes(TRUE);
	m_pMainWnd->DragAcceptFiles();
This will automatically enable dropping files onto your app !
	Regards
	Tomas Gudmundsson
	Danish Hydraulic Institute

-----From: ktm@ormec.com

You should look at KB article Q98575, available in Books Online.

The important part of it states:
You can avoid possible confusion by always expanding any filenames passed
to an application via the command line. Do this by calling the
FindFirstFile() [...] return[s] the file system's version of the
filename in the WIN32_FIND_DATA.cFileName structure member.

- Katy
-- 
Katy Mulvey                            ktm@ormec.com
Software Development Engineer
ORMEC Systems
19 Linden Park; Rochester, NY 14625
-----From: "Greg Tighe" 

Check out the Win32 API function FindFirstFile().  It will return 
(among other things) the long file name based on the "classic 8.3 
(filename.ext) filename format."

-----From: Mario Contestabile

Try the super neat GetFullPathName().

mcontest@universal.com

-----From: David Little 

Did you try GetFullPathName ()?





| Вернуться в корень Архива |