Need to get the short filename from a long filename 
Author Message
 Need to get the short filename from a long filename

I have been researching the routines from the Microsoft Developer
Network CD for the use of getting the short filename from a long
filename using VB 4.0 however, I cannot find any information about the
function 'FindFirstFile' the document reccomends should be used.

Is there anyone who has used the function 'FindFirstFile', in a VB
application without C++, who could help point me in the correct
direction or if anyone has been able to find an alternative method of
obtaining the short filename ?

Thanks and have a great Holiday Season !

Best Regards,

Jeffery R Catton

MiComPro & MiComPro Computer Products Ltd.
4096 Meadowbrook Drive, Suite #120
London, Ontario   N6L 1G4
Canada

Voice:  (519) 652-9910 Ext. #8022
Fax:    (519) 652-2603



Tue, 08 Jun 1999 03:00:00 GMT  
 Need to get the short filename from a long filename

DQpKZWZmIENhdHRvbiA8amNhdHRvbkBsMi5sb25ldC5jYT4gd3JvdGUgaW4gYXJ0aWNsZSA8MzJC
QUNGOTEuN0YwQkBsMi5sb25ldC5jYT4uLi4NCg0KPiBJIGhhdmUgYmVlbiByZXNlYXJjaGluZyB0
aGUgcm91dGluZXMgZnJvbSB0aGUgTWljcm9zb2Z0IERldmVsb3Blcg0KPiBOZXR3b3JrIENEIGZv
ciB0aGUgdXNlIG9mIGdldHRpbmcgdGhlIHNob3J0IGZpbGVuYW1lIGZyb20gYSBsb25nDQo+IGZp
bGVuYW1lIHVzaW5nIFZCIDQuMCBob3dldmVyLCBJIGNhbm5vdCBmaW5kIGFueSBpbmZvcm1hdGlv
biBhYm91dCB0aGUNCj4gZnVuY3Rpb24gJ0ZpbmRGaXJzdEZpbGUnIHRoZSBkb2N1bWVudCByZWNj
b21lbmRzIHNob3VsZCBiZSB1c2VkLg0KPiANCj4gSXMgdGhlcmUgYW55b25lIHdobyBoYXMgdXNl
ZCB0aGUgZnVuY3Rpb24gJ0ZpbmRGaXJzdEZpbGUnLCBpbiBhIFZCDQo+IGFwcGxpY2F0aW9uIHdp
dGhvdXQgQysrLCB3aG8gY291bGQgaGVscCBwb2ludCBtZSBpbiB0aGUgY29ycmVjdA0KPiBkaXJl
Y3Rpb24gb3IgaWYgYW55b25lIGhhcyBiZWVuIGFibGUgdG8gZmluZCBhbiBhbHRlcm5hdGl2ZSBt
ZXRob2Qgb2YNCj4gb2J0YWluaW5nIHRoZSBzaG9ydCBmaWxlbmFtZSA/DQoNCkhvdyBhYm91dCBH
ZXRTaG9ydFBhdGhOYW1lKCkgaW5zdGVhZD8NCg0KRGVjbGFyZSBGdW5jdGlvbiBHZXRTaG9ydFBh
dGhOYW1lIExpYiAia2VybmVsMzIiIEFsaWFzICJHZXRTaG9ydFBhdGhOYW1lIiAoQnlWYWwgbHBz
ekxvbmdQYXRoIEFzIFN0cmluZywgQnlWYWwgbHBzelNob3J0UGF0aCBBcyBTdHJpbmcsIEJ5VmFs
IGNjaEJ1ZmZlciBBcyBMb25nKSBBcyBMb25nDQoNCg0KTWFyaw0K



Tue, 08 Jun 1999 03:00:00 GMT  
 Need to get the short filename from a long filename

Quote:


> > I have been researching the routines from the Microsoft Developer
> > Network CD for the use of getting the short filename from a long
> > filename using VB 4.0 however, I cannot find any information about the
> > function 'FindFirstFile' the document reccomends should be used.

> > Is there anyone who has used the function 'FindFirstFile', in a VB
> > application without C++, who could help point me in the correct
> > direction or if anyone has been able to find an alternative method of
> > obtaining the short filename ?

> How about GetShortPathName() instead?

> Declare Function GetShortPathName Lib "kernel32" Alias "GetShortPathName" (ByVal lpszLongPath As String, ByVal lpszShortPath As String, ByVal cchBuffer As Long) As Long

> Mark

I've tried using the GetShortPathName function, but it doesn't return
anything to my program in the parameter passed as lpszShortPath.  The
string goes in blank and comes out blank.  Any suggestions as what where
my mistake may be?


Fri, 11 Jun 1999 03:00:00 GMT  
 Need to get the short filename from a long filename



Quote:
> I've tried using the GetShortPathName function, but it doesn't return
> anything to my program in the parameter passed as lpszShortPath.  The
> string goes in blank and comes out blank.  Any suggestions as what where
> my mistake may be?

When you call an API function that fills a string buffer you need to make
certain that it is initialized to the maximum number of possible characters
you expect to be returned. I used 128, which is more than necessary for
this function, before making the call:

lpszShortPath = Space$(128)

--
Paul
~~~~



Sat, 19 Jun 1999 03:00:00 GMT  
 Need to get the short filename from a long filename

Make sure that you are specifying a suitable value in the final paramater
(how many
characters to return); i.e.

        sn$ = space(256)
        call GetShortPathName(ln$, sn$, 256&)





Quote:
> I've tried using the GetShortPathName function, but it doesn't return
> anything to my program in the parameter passed as lpszShortPath.  The
> string goes in blank and comes out blank.  Any suggestions as what where
> my mistake may be?

When you call an API function that fills a string buffer you need to make
certain that it is initialized to the maximum number of possible characters
you expect to be returned. I used 128, which is more than necessary for
this function, before making the call:

lpszShortPath = Space$(128)

--
Paul
~~~~


----------



Tue, 22 Jun 1999 03:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. SHORT filename to LONG filename???

2. Short Filename to Long Filename ???

3. Long Filename -> Short Filename

4. SHORT filename to LONG filename???

5. Convert long filenames to short filenames

6. Convert Long Filenames to Short Filenames in VB4 16-Bit

7. Converting long filenames to short filenames in VB4.0 16-bit

8. Short filename to long filename

9. Getting short file names instead of long filenames?

10. Converting a Long FIleName to it's short equivalent (Both possible shorts)

11. Q: SendTo and short/long filenames?

12. Converting a Long Filename to Short.?

 

 
Powered by phpBB® Forum Software