|
Is it possible to make a form unmovable? If so, please give some hints on how .
|
|
|
|
|
Catch the move event and move the form back to where you want it.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Use the following API:
SetWindowPos Me.hwnd, 0, 0, 0, 0, 0, SWP_NOMOVE Or SWP_NOSIZE
|
|
|
|
|
hey, i'm trying to get the address from an IE window starting with "Hello There", but i ran into some problems. i'm using VB6. here's the code :
[code]
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Declare Function GetDesktopWindow Lib "user32" () As Long
Private Declare Function GetWindow Lib "user32" (ByVal hwnd As Long, ByVal wCmd As Long) As Long
Private Declare Function IsWindowVisible Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
Private Sub Form_Load()
Dim hMain, hNext, winhandle As Long
Dim wintitle, address, tmp1 As String
Const GW_CHILD = 5
Const GW_HWNDNEXT = 2
hMain = GetDesktopWindow()
hNext = GetWindow(hMain, GW_CHILD)
While hNext <> 0
hNext = GetWindow(hNext, GW_HWNDNEXT)
If IsWindowVisible(hNext) <> 0 Then
If Len(wintitle) > 0 Then
If wintitle <> "Program Manager" Then
If Left(wintitle, 11) = "Hello There" Then
winhandle = FindWindow("IEFrame", wintitle)
winhandle = FindWindowEx(winhandle, 0, "WorkerW", 0)
winhandle = FindWindowEx(winhandle, 0, "ReBarWindow32", 0)
winhandle = FindWindowEx(winhandle, 0, "ComboBoxEx32", 0)
tmp1 = SendMessage(winhandle, WM_GETTEXT, 24, address)
End If
End If
End If
End If
Wend
End Sub
[/code]
the first hNext returns a handle, but the first line after while doesn't.
can anyone correct the above code?
|
|
|
|
|
You can do this much easier by using the Shell.Application object. Here's a little VBScript sample:
Dim objIE, i, count
Set objShell = CreateObject("Shell.Application")
Set objShellWindows = objShell.Windows
count = objShellWindows.Count
WScript.Echo "Shell Windows: " & nCount
count = count - 1
for i = 0 to nCount
set objIE = objShellWindows.Item(i)
if (not objIE is nothing) then
WScript.Echo " #" & i + 1 & " Location Name: " & objIE.LocationName
WScript.Echo " #" & i + 1 & " Location URL : " & objIE.LocationURL
end if
next
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
i put the script in VB6 in Private Sub Form_Load() but when i try to run it it says Object Required on this line : WScript.Echo "Shell Windows: " & nCount
|
|
|
|
|
That was NOT copy and paste code! I said that was VBScript, not VB6! It has to be converted to VB6 with a little effort.
WSCript is the scripting host that runs the code. WScript doesn't exist in VB6, but you can still use the Shell.Application object. Set a reference to "Microsoft Shell Controls and Automation", then you can create a Shell object and use it's Application property, just like in the sample code.
Dim shell As New Shell32.shell
Set objShell = shell.Application
count = objShell.Windows.Count
For i = 0 To count - 1
Set objIE = objShell.Windows.Item(i)
...
Next
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hello people
Urgently need some help please please.
I am currenlty creating a programme, and i need code for the following if possible.
I am trying to make a label turn yellow when it generates random numbers 1-9.
I have 6 labels which all generate random numbers between 1-50 in all of the 6 boxes in any order any 1 number will not be generated twice.
I hope this makes sense
SARAH
|
|
|
|
|
Does a label have a Brush property ? It's my recollection that it doesn't, I had to write my own Label control in order to be able to specify the brush used to draw the text.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
SARAH,
Dim intRandom As Integer
Dim originalColour As System.Drawing.Color = Me.Label1.BackColor
intRandom = cint((rnd() * 49) + 1)
If intRandom > 0 And intRandom < 10 Then
Me.Label1.BackColor = Drawing.Color.Yellow
Me.Label1.Refresh()
Else
Me.Label1.BackColor = originalColour
Me.Label1.Refresh()
End If
Regards
Richard
|
|
|
|
|
I know this is a silly question. But how do I define the columns in a dataset.
So after I have created a new dataset,
Dim DS as DataSet
How do I add columns. I know how to do it to a dataset that has already been filled from a database, but this does not appear to work for newly created DataSets.
|
|
|
|
|
You don't add columns to a DataSet, you add a DataTable to a DataSet, then add columns to the DataTable.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
' Create a DataSet:
myDataSet = New DataSet("myDataSet")
Dim tCust As DataTable
tCust = New DataTable("Customers")
' Create three columns and add them to the first table:
Dim cCustID As DataColumn
cCustID = New DataColumn("custID")
Dim cCustName As DataColumn
cCustName = New DataColumn("custName")
Dim cCurrent As DataColumn
cCurrent = New DataColumn("custCity")
tCust.Columns.Add(cCustID)
tCust.Columns.Add(cCustName)
tCust.Columns.Add(cCurrent)
' Add the table to the DataSet:
myDataSet.Tables.Add(tCust)
' Populate the table:
Dim newRow1 As DataRow
' Create three customers in the Customers table:
Dim i As Integer = 1
Do While (i < 4)
newRow1 = tCust.NewRow
newRow1("custID") = i.ToString()
tCust.Rows.Add(newRow1)
i += 1
Loop
' Give each customer a distinct name:
tCust.Rows(0)("custName") = "John Summers"
tCust.Rows(1)("custName") = "Phil Seagram"
tCust.Rows(2)("custName") = "Sam Robinson"
' And address:
tCust.Rows(0)("custCity") = "Chicago"
tCust.Rows(1)("custCity") = "Los Angeles"
tCust.Rows(2)("custCity") = "Washington"
|
|
|
|
|
Hello, I'm a beginner in VB.NET
I would like to use the NetShareEnum API to list share of a remote computer.
I have found a lot of topics about it but no one is working for VB.NET
I would like to display shares in a listbox.
Use a textbox to enter the target computer.
And one textbox to enter the password for the remote computer.
If someone can help me. I'm going mad !!!!
|
|
|
|
|
So you want to use the API and not a call to the Net.exe executable? Easy with a call to the shell app. I don't know how to access the API for that if there is one.
Thanks,
Taen Karth
|
|
|
|
|
Hello,
I don't want to use external "exe" file with a shell.
The NetShareEnum API is create specially for list share on remote computer.
For all these reasons I would like to use this API.
But If nobody show me the way, I think I will use your solution.
Thanks for your help
|
|
|
|
|
There are a couple of samples on the web, even one here on CodeProject. Have a look at this[^]. It in C#, but the code can be converted to VB.NET with reasonable effort.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I want to make a property for my custom control with name "RelatedLabel" that sets or gets a Windows Forms Label Control.
How do I list all the Label Controls (names) in the Form in a Property window in the design time.
Such as AcceptButton or CancelButton property of Windows Form.
I hope u understand my question
Thank You
-- modified at 12:30 Thursday 1st September, 2005
|
|
|
|
|
When you expose a public property that is of type Button, Label, Text, ScrollBar, etc, Visual Studio automatically lists all the controls of your property type available in the form at design time.
|
|
|
|
|
It really works.
Thank You.
|
|
|
|
|
Is there an event that runs right after the form is displayed for the first time?
I would like to show my form with no data displayed on it, then display a login screen on top of it. After correct login and password populate form with data.
Thanks.
|
|
|
|
|
Yes Use the forms "OnLoad" event
Just double click anywhere on your blank form in the IDE and it will send you to the "OnLoad" event for that form.
Thanks,
Taen Karth
|
|
|
|
|
The problem with the onload event is that it fires before the form is displayed. I want an event that fires right after the form is displayed for the first time.
|
|
|
|
|
There is no event that fires one-time only after the form is displayed.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
There is no event that is fired one-time only right after the form is displayed.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|