|
-
Apr 14th, 2003, 04:39 PM
#1
Thread Starter
Banned
HAHA better NOT change it!
Open / Save file dialog BOX.
Is there a way to NOT allow users to change the text that I store in the save text box of the dialog box pop up that the API uses. Meaning I pop this file save dialog box and through my application it assigns the name for this file...but it also allows users to modify it. Is there a way to lock this field??
Jon
-
Apr 14th, 2003, 04:43 PM
#2
Just hard code the filename you want.
Then grab the file path they selected and
change the filename they entered and replace it with
the hardcoded filename! HA.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Apr 14th, 2003, 04:45 PM
#3
Try using a "Folder" Dialog as opposed to a "File" dialog, i.e.
VB Code:
Option Explicit
Private Type BROWSEINFO
hwndOwner As Long
pIDLRoot As Long
pszDisplayName As Long
lpszTitle As Long
ulFlags As Long
lpfnCallback As Long
lParam As Long
iImage As Long
End Type
Private Declare Sub CoTaskMemFree Lib "ole32.dll" (ByVal hMem As Long)
Private Declare Function lStrCat Lib "kernel32" Alias "lstrcatA" (ByVal lpString1 As String, ByVal lpString2 As String) As Long
Private Declare Function SHBrowseForFolder Lib "shell32" (lpbi As BROWSEINFO) As Long
Private Declare Function SHGetPathFromIDList Lib "shell32" (ByVal pidList As Long, ByVal lpBuffer As String) As Long
Private Const BIF_RETURNONLYFSDIRS = 1
Public Function BrowseForFolder(ByVal lHwnd As Long, ByVal sPrompt As String) As String
Dim tBI As BROWSEINFO
Dim lList As Long
Dim lResult As Long
Dim sPath As String
Dim sString As String
sString = Space(260)
With tBI
.hwndOwner = lHwnd
.lpszTitle = lStrCat(sPrompt, Chr(0))
.pszDisplayName = StrPtr(sString)
.ulFlags = BIF_RETURNONLYFSDIRS
End With
lList = SHBrowseForFolder(tBI)
sString = StrConv(sString, vbUnicode)
If lList Then
sPath = Space(260)
lResult = SHGetPathFromIDList(lList, sPath)
Call CoTaskMemFree(lList)
sPath = Left$(sPath, InStr(sPath, Chr(0)) - 1)
End If
BrowseForFolder = sPath
End Function
Example Usage:
VB Code:
sFolder = BrowseForFolder(hWnd, "Select Destination:")
-
Apr 14th, 2003, 04:50 PM
#4
Much better way. I forgot about the folder browse.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|