|
Private Const WM_KEYDOWN = &H100
Private Const WM_KEYUP = &H101
Private Const VK_BACKSPACE = &H8
Private Overloads Shared Function SendMessage(ByVal hWnd As IntPtr, _
ByVal msg As Integer, ByVal wp As IntPtr, ByVal lp As IntPtr) As IntPtr
End Function
SendMessage(windHandle, WM_KEYDOWN, CType(VK_BACKSPACE, IntPtr), CType(&HC0510001, IntPtr))
SendMessage(windHandle, WM_KEYUP, CType(VK_BACKSPACE, IntPtr), CType(&HC0510001, IntPtr))
Need help with this one! Its not working...
Thank you!
|
|
|
|
|
FeRtoll wrote: CType(&HC0510001, IntPtr)
the hex constant does not conform to the documentation[^], at least bits 31 and 30 are wrong.
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.
|
|
|
|
|
Luc Pattyn wrote: the hex constant does not conform to the documentation[^], at least bits 31 and 30 are wrong.
so what should i do?
if you know how can i solve the problem please tell me!
thank you!
|
|
|
|
|
solved it... it was my fault! my function didnt fireing because of some crazy old code boolean!
so if anyone ever need this the above sendmessage works fine for backspace!
sorry guys
|
|
|
|
|
Hi,
I'm currently working on a project for my company that requires the extraction of specific data from a web-interface and put it onto an excel spreadsheet. The page on the web-interface refreshes every several seconds as new data comes in. I'm trying to write a code in Excel Visual Basic that will automatically extract specific data/information continuously as new data comes in. Since I'm new to Visual Basic I'm not really sure how to do that. I've been searching online to find any references or info on how to do that but have not been successful.
Can anyone help please?
thank you
|
|
|
|
|
Ahmed Eastlink wrote: Since I'm new to Visual Basic I'm not really sure how to do that.
Start with learning VB before you use it. If you need to learn while on a project, both the learning and the project won't be going swell.
Ahmed Eastlink wrote: I've been searching online to find any references or info on how to do that but have not been successful.
Search again, with the keywords "VB.NET fetch website" (that's one part of your request) and "Write Excell VB.NET" (the second part)
Then try to combine both examples into a solution. If you get stuck somewhere, check back here with a dump of the relevant source-code.
I are Troll
|
|
|
|
|
Hi,
Normely I use a Folderbrowserdialog for selecting a folder.
Thrue the api
Public Type BROWSEINFO
hOwner As Long 'Handle to the owner window for the dialog box.
pidlRoot As Long 'Address of an ITEMIDLIST structure specifying the location
'of the root folder from which to browse. Only the specified
'folder and its subfolders appear in the dialog box.
'This member can be NULL; in that case, the namespace
'root (the desktop folder) is used.
pszDisplayName As String 'Address of a buffer to receive the display name of the folder
'selected by the user. The size of this buffer is assumed to
'be MAX_PATH bytes.
lpszTitle As String 'Address of a null-terminated string that is displayed above
'the tree view control in the dialog box. This string can be
'used to specify instructions to the user.
ulFlags As Long 'Flags specifying the options for the dialog box.
'See constants below
lpfn As Long 'Address of an application-defined function that the dialog box calls
'when an event occurs. For more information, see the
'BrowseCallbackProc function. This member can be NULL.
lParam As Long 'Application-defined value that the dialog box passes to the
'callback function (in pData), if one is specified
iImage As Long 'Variable to receive the image associated with the selected folder.
'The image is specified as an index to the system image list.
End Type
and all needed dll imports I can have a textbox
the flag BIF_EDITBOX activate ordéactivate the textbox.
Can I do this with a build-in control
Jan
|
|
|
|
|
Use a FolderBrowserDialog : MSDN[^]
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.
Digital man: "You are, in short, an idiot with the IQ of an ant and the intellectual capacity of a hose pipe."
|
|
|
|
|
I fail to see where I can activate the textbox
|
|
|
|
|
If you want to put the chosen directory path into a textbox then just use the following
textbox1.text = folderBrowserDialog1.SelectedPath
Its in the example (one given to you earlier) at the bottom of the page, but it puts the value into a variable instead.
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 want to type the folder in the dialogbox(copy/paste)
not set the defaultfolder nor the selectedfolder into a textbox
|
|
|
|
|
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.
|
|
|
|