2 easy questions

These are actually 2 questions.

i 'm trying to get if the read-only check mark was selected when the user closed the Open dialog box. I've investigated a little and discovered you can do that with the cdlOFNReadOnly (&1&). But my question is... how can i do it?
i tryied:

If cdlOFNReadOnly Then
  chkMark.Value = 1
  chkMark.Value = 0
End If

If cdlOFNReadOnly = True Then
  chkMark.Value = 1
  chkMark.Value = 0
End If

If dlgCommonDialog.flags = cdlOFNReadOnly Then
  chkMark.Value = 1
  chkMark.Value = 0
End If

and none of them seems to work

i 'm trying to get the dos name of a large path
i know i can do that with the GetShortPathName api function
but... i believe i'm not using it correctly as it doesn't work

result = GetShortPathName(rtfTexto.FileName, sDocNombreMsDos, 70)
      .lblqMsDos.Caption = sDocNombreMsDos

i 've chosen 70 because i don't believe the user will have a directory more than 70 characters long
rtfTexto.FileName is the name of the file displayed in my RichText box (and i'm SURE here's not the problem)
sDocNombreMsDos was previously declared as String (if i remember well)
sDocNombreMsDos= Empty      why????
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

I respond to the second question...
Private Declare Function OSGetShortPathName Lib "kernel32" Alias "GetShortPathNameA" (ByVal lpszLongPath As String, ByVal lpszShortPath As String, ByVal cchBuffer As Long) As Long

Function GetShortPathName(ByVal strLongPath As String) As String
    Const cchBuffer = 300
    Dim strShortPath As String
    Dim lResult As Long

    On Error GoTo 0
    strShortPath = String(cchBuffer, Chr$(0))
    lResult = OSGetShortPathName(strLongPath, strShortPath, cchBuffer)
    If lResult = 0 Then
        Error 53 ' File Not Found
        GetShortPathName = StripTerminator(strShortPath)
    End If
End Function

I hope is the solution...
Good bye
pin_plunderAuthor Commented:
Well, i'm sorry to tell you that didn't work for me.

this is part of the code i'm using.

Dim lResultado As Long
Const chhBuffer = 300
lResultado = GetShortPathName(rtfTexto.FileName, sDocNombreMsDoS, chhBuffer)
..lblqMsDos.Caption = sDocNombreMsDoS

1)  dlgCommonDialog.Flags is a bit-structure and has to be tested with AND / OR operations like this :

  If dlgCommonDialog.Flags And cdlOFNReadOnly Then
   chkMark.Value = 1
    chkMark.Value = 0
  End If
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

2)  This code should work for MSDOS filename

Dim sFile As String, sShortFile As String * 67
Dim lRet As Long
sFile = CommonDialog1.filename
lRet = GetShortPathName(sFile, sShortFile, Len(sShortFile))
sFile = Left(sShortFile, lRet)
Text1.Text = sFile

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
pin_plunderAuthor Commented:
you got the points. everything seems to work fine.

thanks for your time. :)

ohh! i was forgetting..
just one last question:
vb show the "open as read-only" checkbox in save common dialogs as well.
Though it seems to be a simple fact, i actually believe that's a serious BUG.??
as it confuses our users (if we don't realize of that first).

However, i'm concerned you can make that checkmark "disappear" with the cdlOFNHideReadOnly flag.
To override flags default setting, simply set the controls flag property before calling the ShowOpen event.
CommonDialog1.Flags = cdlOFNHideReadOnly
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.