Link to home
Start Free TrialLog in
Avatar of tbmaciii
tbmaciii

asked on

GetShorty not worky for de \\companyweb

This question contains a combonation of Windows SBS 2003 sharepoint services and VB.

I drag a filename from a FileListBox to a PictureBox (the picturebox contains a picture of a pencil - this control is only used as a conduit for executing the editing process).  The OLEDragDrop event is fired and the sub loads the file into mspaint for editing.  This works fine for any long filenames and long directory names in "normal" directories (see GetShortFileName in your search), but we are now using folders in sharepoint services on a Windows 2003 Server (i.e.  \\companyweb\somedirectory).  Let's say we have a filepathname of  "\\companyweb\somefolder\some sub folder with spaces in the name\somefile.bmp".  Now the "shelled" mspaint app throws an error "\\companyweb\somefolder\some.bmp was not found."  It only takes up to the first space of the subfolder name (if there are spaces in the name), truncates, and then appends the .bmp.  It is as if there is no short name for the sharepoint folders.

This code works fine, including the GetShortFileName, but bombs in sharepoint \\companyweb\ folders:

Private Sub picEdit_OLEDragDrop(Data As DataObject, Effect As Long, Button As Integer, Shift As Integer, x As Single, Y As Single)
    Dim mhWndApp As Long
    Dim hInst As Long
    hInst = Shell("mspaint.exe " & GetShortFileName(Data.Files(1)), vbMaximizedFocus)
    Me.Hide
    mhWndApp = GetWinHandle(hInst)
    lR = SetTopMostWindow(mhWndApp, True)
End Sub

Why? And what's the solution?
ASKER CERTIFIED SOLUTION
Avatar of Erick37
Erick37
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of tbmaciii
tbmaciii

ASKER

FnA