C/Visual C - Como uso GetShortPathName

 
Vista:

Como uso GetShortPathName

Publicado por Carlos Enrique (8 intervenciones) el 01/03/2004 01:22:55
Hola amigos de la programación estoy que me rompo el coco intentando obtener el nombre corto de un archivo con GetShortPathName y me sale error, si alguien sabe como hacerlo en Visual C++ se lo agradesco por anticipado
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

RE:Como uso GetShortPathName

Publicado por Nicolas (183 intervenciones) el 01/03/2004 13:46:43
Te mando lo q dice la MSDN:

GetShortPathName
The GetShortPathName function obtains the short path form of a specified input path.

DWORD GetShortPathName(
LPCTSTR lpszLongPath, // pointer to a null-terminated path string
LPTSTR lpszShortPath, // pointer to a buffer to receive the
// null-terminated short form of the path
DWORD cchBuffer // specifies the size of the buffer pointed
// to by lpszShortPath
);

Parameters
lpszLongPath
Pointer to a null-terminated path string. The function obtains the short form of this path.
lpszShortPath
Pointer to a buffer to receive the null-terminated short form of the path specified by lpszLongPath.
cchBuffer
Specifies the size, in characters, of the buffer pointed to by lpszShortPath.
Return Values
If the function succeeds, the return value is the length, in characters, of the string copied to lpszShortPath, not including the terminating null character.

If the function fails due to the lpszShortPath buffer being too small to contain the short path string, the return value is the size, in characters, of the short path string. You need to call the function with a short path buffer that is at least as large as the short path string.

If the function fails for any other reason, the return value is zero. To get extended error information, call GetLastError.

Remarks
When an application calls this function and specifies a path on a volume that does not support 8.3 aliases, the function fails with ERROR_INVALID_PARAMETER if the path is longer than 67 bytes.

The path specified by
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

RE:Como uso GetShortPathName

Publicado por Nicolas (183 intervenciones) el 01/03/2004 13:50:14
Hola de nuevo: te adjunto el codigo de una aplicacion mia q levanta un archivo usando Visual C++.

void CBitmapView::OnFileOpen()
{
CString Nombre;

CFileDialog OpenDlg(TRUE, NULL, NULL,
OFN_HIDEREADONLY, NULL,AfxGetMainWnd());

OpenDlg.m_ofn.lpTemplateName = "MYFILEOPEN";

OpenDlg.m_ofn.hInstance = AfxGetInstanceHandle();

if (OpenDlg.DoModal() == IDCANCEL)
OpenDlg.EndDialog(0);

if (OpenDlg.DoModal() == IDOK)
{
Nombre = OpenDlg.GetPathName();
FILE* Archivo = fopen(Nombre,"r");

//Aca haces lo q quieras con el archivo

}

Salu2!!!!
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar