Function to Distinguish Between Files and Directories
Category:Files and Directories
Version Compatibility: Visual Basic 6
I was going crazy with manual OLEDragOver and OLEDragDrop events because as the Data object is dragged over my target control, it displays information about it for a quick make-sure-this-is-the-right-file-to-drop gig. Well, the more I looked around the more I wished PHP came in a visual format too...alas, it doesn't. So, this VERY simple function will tell you if the test path passed in the call is a file, a directory, or a non-existant/invalid path. Example: Private Sub Form_Load( ) If ( AH_pathType( "C:\autoexec.bat" ) = PATH_FILE ) Then _ MsgBox "C:\autoexec.bat is a file." End Sub
Instructions: Copy the declarations and code below and paste directly into your VB project.