Re: shBrowseForFolder procedure run issue
From: Randy Birch (rgb_removethis_at_mvps.org)
Date: 07/10/04
- Previous message: Randy Birch: "Re: Slidercontrol color and style"
- In reply to: Arbormead: "shBrowseForFolder procedure run issue"
- Next in thread: Arbormead: "Re: shBrowseForFolder procedure run issue"
- Reply: Arbormead: "Re: shBrowseForFolder procedure run issue"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 9 Jul 2004 23:19:26 -0400
You don't mention specifically if you're using the PIDL or string method,
but I suspect the string version of the code. Try this modification to the
way the callback is set ... the routine/code quoted here is the same as from
my page, so make any appropriate translation if you renamed variables or
procedures:
1) Define a new public bas-level string variable called
sBrowseDlgInitialPath ...
Private sBrowseDlgInitialPath As String
2) comment out the following lines in the BrowseForFolderByPath function:
lpSelPath = LocalAlloc(LPTR, Len(sSelPath) + 1)
CopyMemory ByVal lpSelPath, ByVal sSelPath, Len(sSelPath) + 1
.lParam = lpSelPath
3) add this line in place of the lines above (sSelPath was passed to
BrowseForFolderByPath as the initial path):
sBrowseDlgInitialPath = sSelPath
4) in the BrowseCallbackProcStr function, comment out the line:
Call SendMessage(hWnd, BFFM_SETSELECTIONA, True, ByVal lpData)
5) and add this block in its place:
If (hwnd <> 0) And Len(sBrowseDlgInitialPath) > 0 Then
DoEvents '<this may not be required
Call SendMessage(hwnd, BFFM_SETSELECTIONA, 1, ByVal
sBrowseDlgInitialPath)
End If
Here we've removed the passing of the initial folder from the callback's
lpData member (and removed the need to allocate the memory for that string
in the call), and simply used the public string variable to set the initial
path. The lParam member of the BrowseInfo UDT is not used, nor is the lpData
member of BrowseCallbackProc. I find this always works, whereas I did
experience a problem with the lpData method on Windows 2000 which prompted
me to devise this workaround.
-- Randy Birch MVP Visual Basic http://vbnet.mvps.org/ Please respond only to the newsgroups so all can benefit. "Arbormead" <Arbormead@discussions.microsoft.com> wrote in message news:501D74F8-70C2-4CD5-8E3C-DE916322F5F9@microsoft.com... : I have used the shBrowseForFolder procedure as supplied by Randy Birch at VBNet and have come across a small problem when packaging up the project. : : Basically the procedure starts at a predefined path as laid out in a text box, the contents of which are loaded at the start. This works fine with VB6 but when I package up the project and then install it, the same procedure starts at My Computer. After selecting a path the second time I run it it works fine. Obviously I would like to run it fine the first time but I'm unsure why this is happening. : : I have used the VB6 Package and deployment Wizard and also the Visual Studio Installer, both do the same thing. Is there anywhere else I should be looking to resolve this issue? I can post the code if required but basically it is a very minor modification od the one I found at http://vbnet.mvps.org/code/callback/browsecallback.htm : : Let me know if I can provide more information : : many thanks
- Previous message: Randy Birch: "Re: Slidercontrol color and style"
- In reply to: Arbormead: "shBrowseForFolder procedure run issue"
- Next in thread: Arbormead: "Re: shBrowseForFolder procedure run issue"
- Reply: Arbormead: "Re: shBrowseForFolder procedure run issue"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|