|
Not sure what you are after! Is this so you can create a folder at a given location? Then does the create folder button not give you the functionality that you are after?
If for searching you could use the example in the following Stackoverflow article[^] which also covers creating the folder if it didn't exist.
If I'm completely off mark then please expand what you are after with what you are trying to do
As barmey as a sack of badgers
Dude, if I knew what I was doing in life, I'd be rich, retired, dating a supermodel and laughing at the rest of you from the sidelines.
|
|
|
|
|
I placed a picture on the internet
The picture is writen in VBA/Excel with api
On top i can write or copy/paste a path
I don't want to make a new folder.I just want to know: is there a build-in control that also have the textbox and if it exist than what is it name. I can't find that option on a folderbrouwserdialog
Jan
|
|
|
|
|
FYI: that is a ComboBox, not a TextBox.
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
there is no arrow next to it.
but even so how can I if I can add it to a folderbrowsercontrol?
|
|
|
|
|
What you have above appears to be the old VB6 (and below) way of doing things.
In VB.net it is as simple as;
Public Sub TestFolderSelection()
Dim FBD As New FolderBrowserDialog
FBD.Description = "Select a Folder;"
FBD.RootFolder = Environment.SpecialFolder.MyDocuments
Dim Response As DialogResult = FBD.ShowDialog
If Response = DialogResult.OK Then
textbox1.text = FBD.SelectedPath
End If
End Sub
|
|
|
|
|
Hi,
.NET does not expose the BROWSEINFO[^] structure for the shell's native FolderBrowser so you are stuck with the options chosen by Microsoft. I quite like the path autocomplete that's available in the native version when BIF_EDITBOX is included in BROWSEINFO.ulFlags but sadly .NET does not provide an enabling property for this.
There was an article posted just a few days ago on this topic and you may want to take a look at that. (FolderBrowserDialogEx: A C# customization of FolderBrowserDialog[^])
Alan
|
|
|
|
|
If it doesn't exist I rewrite the VBA api and use this in vb.net
Thanks all for thinking
|
|
|
|
|
<DllImport("user32.dll", SetLastError:=True, CharSet:=CharSet.Auto)> _
Private Shared Function SendMessage(ByVal hWnd As IntPtr, ByVal Msg As UInteger, ByVal wParam As IntPtr, ByVal lParam As IntPtr) As IntPtr
End Function
<DllImport("User32.dll", SetLastError:=True, CharSet:=CharSet.Auto)> _
Private Shared Function EnumChildWindows(ByVal WindowHandle As IntPtr, ByVal Callback As EnumWindowProcess, ByVal lParam As IntPtr) As Boolean
End Function
<DllImport("user32.dll", SetLastError:=True, CharSet:=CharSet.Auto)> _
Private Shared Sub GetClassName(ByVal hWnd As System.IntPtr, ByVal lpClassName As System.Text.StringBuilder, ByVal nMaxCount As Integer)
End Sub
<DllImport("USER32.DLL")> _
Private Shared Function GetShellWindow() As IntPtr
End Function
<DllImport("USER32.DLL")> _
Private Shared Function GetWindowText(ByVal hWnd As IntPtr, ByVal lpString As StringBuilder, ByVal nMaxCount As Integer) As Integer
End Function
<DllImport("USER32.DLL")> _
Private Shared Function GetWindowTextLength(ByVal hWnd As IntPtr) As Integer
End Function
<DllImport("user32.dll", SetLastError:=True)> _
Private Shared Function GetWindowThreadProcessId(ByVal hWnd As IntPtr, <Out()> ByRef lpdwProcessId As UInt32) As UInt32
End Function
<DllImport("USER32.DLL")> _
Private Shared Function IsWindowVisible(ByVal hWnd As IntPtr) As Boolean
End Function
Private Delegate Function EnumWindowsProc(ByVal hWnd As IntPtr, ByVal lParam As Integer) As Boolean
<DllImport("USER32.DLL")> _
Private Shared Function EnumWindows(ByVal enumFunc As EnumWindowsProc, ByVal lParam As Integer) As Boolean
End Function
<DllImport("user32.dll", SetLastError:=True)> _
Private Shared Function GetWindowRect(ByVal hWnd As IntPtr, <Out()> ByRef lpRect As RECT) As <MarshalAs(UnmanagedType.Bool)> Boolean
End Function
Public Shared Function GetChildWindows(ByVal ParentHandle As IntPtr) As IntPtr()
Dim ChildrenList As New List(Of IntPtr)
Dim ListHandle As GCHandle = GCHandle.Alloc(ChildrenList)
Try
EnumChildWindows(ParentHandle, AddressOf EnumWindow, GCHandle.ToIntPtr(ListHandle))
Finally
If ListHandle.IsAllocated Then ListHandle.Free()
End Try
Return ChildrenList.ToArray
End Function
Private hShellWindow As IntPtr = GetShellWindow()
Private dictWindows As New Dictionary(Of IntPtr, String)
Private currentProcessID As Integer
Public Delegate Function EnumWindowProcess(ByVal Handle As IntPtr, ByVal Parameter As IntPtr) As Boolean
Private Shared Function EnumWindow(ByVal Handle As IntPtr, ByVal Parameter As IntPtr) As Boolean
Dim ChildrenList As List(Of IntPtr) = GCHandle.FromIntPtr(Parameter).Target
If ChildrenList Is Nothing Then Throw New Exception("GCHandle Target could not be cast as List(Of IntPtr)")
ChildrenList.Add(Handle)
Return True
End Function
Public Function GetOpenWindowsFromPID(ByVal processID As Integer) As IDictionary(Of IntPtr, String)
dictWindows.Clear()
currentProcessID = processID
EnumWindows(AddressOf enumWindowsInternal, 0)
Return dictWindows
End Function
Private Function enumWindowsInternal(ByVal hWnd As IntPtr, ByVal lParam As Integer) As Boolean
If (hWnd <> hShellWindow) Then
Dim windowPid As UInt32
If Not IsWindowVisible(hWnd) Then
Return True
End If
Dim length As Integer = GetWindowTextLength(hWnd)
If (length = 0) Then
Return True
End If
GetWindowThreadProcessId(hWnd, windowPid)
If (windowPid <> currentProcessID) Then
Return True
End If
Dim stringBuilder As New StringBuilder(length)
GetWindowText(hWnd, stringBuilder, (length + 1))
dictWindows.Add(hWnd, stringBuilder.ToString)
End If
Return True
End Function
Private Const WM_CHAR = &H102
What i need is to get all windows of an process...
I do it like this:
For Each P As Process In Process.GetProcessesByName("Notepad")
Dim windows As IDictionary(Of IntPtr, String) = GetOpenWindowsFromPID(P.Id)
For Each kvp As KeyValuePair(Of IntPtr, String) In windows
Next
Next
But now i am missing handles of that windows.
Could someone explain me a little!?
I want to know how to get all child windows (id,title,handle) of an process.
FeRtoll Software.net
------------
E-Mail me
WebPage
modified on Monday, February 21, 2011 3:09 AM
|
|
|
|
|
|
thank you but that not helping me.
i need handles of child windows of an process!
however i solved it so i dont need anymore
thanks man
|
|
|
|
|
Please pardon the lame subject. I could not think of anything more appropriate (because it's the answer to my question).
When you are calling a function and you type the open parenthesis, the IDE will then show a popup-type window containing the function's syntax and a brief description. How can this be done with your own code?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
When you type a triple single quote on the line above a sub/fun start, it will expand automatically; you can edit the result, then see it in intellisense.
''' <summary>
''' Performs some test.
''' </summary>
''' <param name="value">Input value</param>
''' <remarks></remarks>
Public Sub test(ByVal value As Long)
...
End Sub
FYI: it works the same in C#, with a triple slash.
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
Super.
I did not know that.
------------------------------------
I will never again mention that I was the poster of the One Millionth Lounge Post, nor that it was complete drivel. Dalek Dave
CCC Link[ ^]
Trolls[ ^]
|
|
|
|
|
You're welcome.
PS: Maybe you should read the fine manual, or a good book... (don't ask which, I mostly don't do VB!)
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
I found "Head First C#" to be the best possible introduction to VB.NET
|
|
|
|
|
This is a very help feature that is kind of hidden in VS. You should post it as a tip/trick to draw attention to it.
|
|
|
|
|
it is documented, e.g. here[^].
I tend to write articles or tips about stuff I feel is missing in the documentation, that is enough of a challenge already.
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
Need some advice in the best way to approach something.
I have a class library that processes Insurance Items, the class library has to return a list of potential advisories to the user for them to evaluate.
I thought of using a Module with a list of advisories (as constant variables), but am also not sure that this is the best way forward and would like the advice of others
Thanks
Simon
As barmey as a sack of badgers
Dude, if I knew what I was doing in life, I'd be rich, retired, dating a supermodel and laughing at the rest of you from the sidelines.
|
|
|
|
|
You would be better off storing your list in an external file or database, rather than hard-coding them into your program code. That way, if the list changes, you simply need to update the (external) data rather than having to modify your application.
|
|
|
|
|
Thanks that has given me some good ideas now
As barmey as a sack of badgers
Dude, if I knew what I was doing in life, I'd be rich, retired, dating a supermodel and laughing at the rest of you from the sidelines.
|
|
|
|
|
Modules aren't really that OOP so I tend to stay away from them. A nice way may be to create a class called InsuranceItems which inherits List<insuranceitem> and then create a function within the inherited class which returns a list of advisories.
Public Class InsuranceItems
Inherits List(Of InsuranceItem)
Public Function GetAdvisories() As List(Of Advisory)
'Do stuff and return list
End Function
End Class
"You get that on the big jobs."
|
|
|
|
|
Thanks that has given me good things to go on
As barmey as a sack of badgers
Dude, if I knew what I was doing in life, I'd be rich, retired, dating a supermodel and laughing at the rest of you from the sidelines.
|
|
|
|
|
I have googled, but would prefer advice or suggestions...
I want to just have a way of copying a folder ( and contents ) to a memory stick at the click of a mouse.
There is a manager who wants this made easy.
I am thinking For each Element in Files kind of thing.
But is there an easier way?
------------------------------------
I will never again mention that I was the poster of the One Millionth Lounge Post, nor that it was complete drivel. Dalek Dave
CCC Link[ ^]
Trolls[ ^]
|
|
|
|
|
Dalek Dave wrote: is there an easier way?
There are plenty:
- Synchronization tools.
- Backup tools.
- Rentacoder.
...
and in the end they all use at least one loop and possibly some recursion.
just-a-link[^]
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
Thanks for all your help there Luc!
Invaluable.
------------------------------------
I will never again mention that I was the poster of the One Millionth Lounge Post, nor that it was complete drivel. Dalek Dave
CCC Link[ ^]
Trolls[ ^]
|
|
|
|