Getopenfilename Default File Path For My Computer

Getopenfilename Default File Path For My Computer

Hi, I was wondering if anyone encountered the following error with GetOpenFileName(). The open dialog opens, and I hover my mouse over a file. The dialog shows the detailed info of the file like normal. I open my file and everything works as normal. I open the open dialog again.

If I hover over any file again, the whole program is closed in a way that does not send any WM_CLOSE messages and not even windows shows up that there was an error. A weird thing also is that this error only happends on 50% of the computer's i've tried with my program. Maybe a work around that might work, is if there was a way of turning off the hovering detail display of files. Ideas, thoughts?

Ti 84 Calculator Games Snake Classic. • char* szFileName=new char[100]; • • ofn.lpstrFile = szFileName; • ofn.nMaxFile = MAX_PATH; • You have created a buffer for szFileName that is 100 bytes long, however you tell GetOpenFileName that it is MAX_PATH bytes long, on my implementation MAX_PATH is 260 so you are telling GetOpenFileName that szFileName is a buffer that is 160 bytes longer than it actually is. Either use MAX_PATH where you allocate szFileName or pass the actual size of buffer pointed to by szFileName to GetOpenFileName.

The default is 'My Computer.' Function SelectFolder(Optional Title As String, Optional TopFolder _ As String) As String Dim objShell As New Shell32.Shell Dim objFolder As Shell32.Folder 'If you use 16384 instead of 1 on the next line, 'files are also displayed Set objFolder = objShell.BrowseForFolder _ (0.

It is always a mistake to information a called function that a buffer is longer than it really is.

Use the following: ChDrive 'C' ChDir 'C: Temp' If you want to be nice to the user and change it back to what it was: Dim sCurDir As String Dim sOpenFileName As String sCurDir = CurDir ChDrive 'C' ChDir 'C: Temp' sOpenFileName = Application.GetOpenFileName ChDrive sCurDir ChDir sCurDir - Jon ------- Jon Peltier, Microsoft Excel MVP Tutorials and Custom Solutions Peltier Technical Services, Inc. - _______ to change the drive and directory to what you want. 'Balmain Bushwalker' wrote in message news. >Setting 'Application.DefaultFilePath' before calling >'Application.GetOpenFileName' does not set the opening (default) >directory. >Anyone know how to do it?

Thanx Jon - I will try your sugestion. 'Jon Peltier' wrote: >Use the following: >>ChDrive 'C' >ChDir 'C: Temp' >>If you want to be nice to the user and change it back to what it was: >>Dim sCurDir As String >Dim sOpenFileName As String >>sCurDir = CurDir >ChDrive 'C' >ChDir 'C: Temp' >>sOpenFileName = Application.GetOpenFileName >>ChDrive sCurDir >ChDir sCurDir >>- Jon >------- >Jon Peltier, Microsoft Excel MVP >Tutorials and Custom Solutions >Peltier Technical Services, Inc. - >_______ >>>to change the drive and directory to what you want. >'Balmain Bushwalker' wrote in >message news. >>Excel VBA. >>Setting 'Application.DefaultFilePath' before calling >>'Application.GetOpenFileName' does not set the opening (default) >>directory. >>Anyone know how to do it?