home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.visual.basic      MS Visual Basic discussions, NOT dot-net      10,840 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 10,647 of 10,840   
   Don to All   
   Re: Capture filename from dialog box   
   07 Sep 08 01:54:03   
   
   XPost: microsoft.public.vb.general.discussion, microsoft.public.vb   
   From: dsarvas@yahoo.com   
      
   THANK YOU, Karl!!!   
      
   Works like a charm!   
      
   Don   
      
      
   On Fri, 5 Sep 2008 13:06:44 -0700, "Karl E. Peterson"    
   wrote:   
      
   >Don wrote:   
   >> How can I capture the name of the file a user right clicks in the open   
   >> file dialog using the common dialog box control?   
   >   
   >You'd have to use the GetOpenFileName API directly, set a callback hook to the   
   >common dialog that results, and watch for CDN_SELCHANGE notifications.  Call   
   >SendMessage with CDM_GETSPEC to get the filename:   
   >   
   >      Case CDN_SELCHANGE   
   >         ' Find handle to dialog window.   
   >         hWnd = GetParent(hDlg)   
   >         ' Get size of buffer required for filespec.   
   >         nChars = SendMessage(hWnd, CDM_GETSPEC, 0&, ByVal m_FileEx)   
   >         ' Get the full buffer for the filespec(s)   
   >         If nChars > 0 Then   
   >            m_FileEx = Space$(nChars)   
   >            Call SendMessage(hWnd, CDM_GETSPEC, nChars, ByVal m_FileEx)   
   >         End If   
   >   
   >Optionally, test which mouse button is down at this point, to decide how to   
   proceed.   
   >--   
   >.NET: It's About Trust!   
   > http://vfred.mvps.org   
   >   
   >   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca