I wanted to use it to open URL shortcuts but when doing so received an error message that "the file name is invalid". For example I tried the file "Welcome to HP.url". Apparently Windows interprets the filename to the actual http://www.hp.com/ and the slashes mess it up. I tried using either of the two flags OFN_NODEREFERENCELINKS and OFN_NOVALIDATE but they did not help even though in the VB common dialog they do. I looked at the code in GCommonDialog.cls - VBGetOpenFileName2 and changed this
.flags = (-FileMustExist * OFN_FILEMUSTEXIST) Or _
(-MultiSelect * OFN_ALLOWMULTISELECT) Or _
(-ReadOnly * OFN_READONLY) Or _
(-HideReadOnly * OFN_HIDEREADONLY)
.flags = .flags And Not OFN_ENABLEHOOK
to
.flags = (-FileMustExist * OFN_FILEMUSTEXIST) Or _
(-MultiSelect * OFN_ALLOWMULTISELECT) Or _
(-ReadOnly * OFN_READONLY) Or _
(-HideReadOnly * OFN_HIDEREADONLY) Or _
(flags And (Not OFN_ENABLEHOOK))
and now the call works without the error message. I had seen in the example CustomDlg6.vbp that the code in the class was like this:
(flags And CLng(Not OFN_ENABLEHOOK))
|