|
Use the Process class and it's GetProcessesByName method to get the Process object for it. There is a MainWindowHandle property in that object. You use that handle and the Win32 API function EnumChildWindows[^] to get all of the child window handles and add them to your list. You then have to use EnumChildWindows again on each of those returned handles to get the child windows of that list of child windows, again, adding the new handles to the same list you're maintaining. Rinse and Repeat until you get to the end of your handle list.
|
|
|
|
|
Thanks, works like a charm... But i've got another question. I am trying to use FindWindowEx function to get a handle of the control i need, but i do not have a class name for that control. enumerating is stupid, i'd like to hard code it. Is there a way to know the class name?
|
|
|
|
|
|
I have a non-fullscreen and non-maximised program with a timer control that ticks over every 20 seconds performin a check on the time and comparing it to another time. It's function is irrelavent, thr problem i am having is that whenever the timer ticks over and the desktop (i.e. icons and taskbar) is visible, all the icons flash briefley and refresh. Is it possible to stop this desktop refresh when the timer ticks over.
Posted by The ANZAC
|
|
|
|
|
What the code u r writing?
|
|
|
|
|
There is no way that a timer which does a compare of times, can cause your desktop to refresh, there's something you're not telling us.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Christian is correct. The Timer doesn't make the desktop repaint. Something else in your code is causing it.
|
|
|
|
|
I could post the code but at the moment its long and messy so i'll give you a run down. It compares two datetimes to check for a day, hour or minute difference using datediff. It then generates a random number and checks it against a list (of integer) to see if its been used. If it has been used it loops and generates random numbers till one pops up that hasn't been used. Then it uses the number to select a name from a comboboxobject collection.
I can't see anyway it's causing this refresh thing, but every 20 seconds (what the timer is set to) it does it, all the icons flash.
I'll post some of it:
If DateDiff(DateInterval.Day, d1, d2) = My.Settings.ChangeValue Then<br />
If My.Settings.ChangeMode = 0 Then<br />
Index = RandomClass.Next(-1, Me.ImagesComboBox.Items.Count + 1)<br />
If UsedList.Count = Me.ImagesComboBox.Items.Count Then<br />
UsedList.Clear()<br />
End If<br />
Do Until UsedList.Contains(Me.ImagesComboBox.Items.Item(Index)) = False<br />
Index = RandomClass.Next(-1, Me.ImagesComboBox.Items.Count + 1)<br />
Loop<br />
My.Settings.Index = Index<br />
path = Folder & "\" & Me.ImagesComboBox.Items(Index)<br />
If Not path.Remove(0, path.IndexOf(".")) = ".bmp" Then<br />
Dim image As Image = image.FromFile(path)<br />
image.Save(path.Remove(path.IndexOf("."), path.Length - path.IndexOf(".")), Imaging.ImageFormat.Bmp)<br />
My.Settings.WasSavedAs = True<br />
path = path.Replace(path.Remove(0, path.IndexOf(".")), ".bmp")<br />
End If<br />
Else<br />
If My.Settings.WasSavedAs = True Then<br />
Index = My.Settings.Index + 2<br />
Else<br />
Index = My.Settings.Index + 1<br />
End If<br />
path = Folder & "\" & Me.ImagesComboBox.Items(Index)<br />
If Not path.Remove(0, path.IndexOf(".")) = ".bmp" Then<br />
Dim image As Image = image.FromFile(path)<br />
image.Save(path.Remove(path.IndexOf("."), path.Length - path.IndexOf(".")), Imaging.ImageFormat.Bmp)<br />
My.Settings.WasSavedAs = True<br />
path = path.Replace(path.Remove(0, path.IndexOf(".")), ".bmp")<br />
End If<br />
End If<br />
End If
Posted by The ANZAC
|
|
|
|
|
I need to read the contents of a file that is located in the internet. The problem is that this file is located in a folder that needs username "ukkeli" and password "hattu123". I'm using the code below:
Dim myWebClient As New System.Net.WebClient 'the webclient
Dim file As New System.IO.StreamReader(myWebClient.OpenRead("http://www.examplesite.com/subdir/file.txt"))
Dim Contents As String = file.ReadToEnd()
file.Close()
How can I make the application to give the needed username and password automatically?
|
|
|
|
|
it might be HTTP authentication. Try that.
----------------------------
**** JOB23743 Submitted ****
|
|
|
|
|
i have an Error that says "Procedure 'prcInserting Expects parameter @Extension which was not Supplied"
Here is my whole code,i have excluded non impoertant ones.
Dim conn As Connection
Dim rrs As Recordset
Dim ComC As Command
Dim prm As Parameter
'String Variables
Dim strNum_key As String
Dim strExtension As Integer
Dim strCell_ID As Integer
Dim strActual_Extent As Double
Dim strLis_key As String
Dim strFunc_key As String
'*****************************
'Parameter Object
Dim prmNum_key As Parameter
Dim prmExtension As Parameter
Dim prmCell_ID As Parameter
Dim prmActual_Extent As Parameter
Dim prmLis_key As Parameter
Dim prmFunc_key As Parameter
'***********************
'Command Object
Dim ComNum_key As Command
Dim ComExtension As Command
Dim ComCell_ID As Command
Dim ComActual_Extent As Command
Dim ComLis_key As Command
Dim ComFunc_key As Command
Private Sub Form_Load()
Set conn = New Connection
Set rrs = New Recordset
Set ComC = New Command
'Initializing The Command Objects
Set ComNum_key = New Command
Set ComExtension = New Command
Set ComCell_ID = New Command
Set ComActual_Extent = New Command
Set ComLis_key = New Command
Set ComFunc_key = New Command
rrs.CursorLocation = adUseServer
rrs.CursorType = adOpenDynamic
rrs.LockType = adLockOptimistic
With conn
.Provider = "SQLOLEDB"
.ConnectionString = "User ID =sde;Password=topology;" & _
"Data Source =SGIICORNETGS01;" & _
"Initial Catalog = Tshwane_Valuations"
.Open
End With
'Initialize the active Connection, Commandtext and Commandtype
With ComNum_key
.ActiveConnection = conn
.CommandText = "prcInserting"
.CommandType = adCmdStoredProc
End With
With ComExtension
.ActiveConnection = conn
.CommandText = "prcInserting"
.CommandType = adCmdStoredProc
End With
With ComCell_ID
.ActiveConnection = conn
.CommandText = "prcInserting"
.CommandType = adCmdStoredProc
End With
With ComActual_Extent
.ActiveConnection = conn
.CommandText = "prcInserting"
.CommandType = adCmdStoredProc
End With
With ComLis_key
.ActiveConnection = conn
.CommandText = "prcInserting"
.CommandType = adCmdStoredProc
End With
With ComFunc_key
.ActiveConnection = conn
.CommandText = "prcInserting"
.CommandType = adCmdStoredProc
End With
'Accepting User input from a form
strNum_key = Val(Trim(txtnumkey.Text))
strExtension = Val(Trim(txtextension.Text))
strCell_ID = Val(Trim(txtcellid.Text))
strActual_Extent = Val(Trim(txtactualextent.Text))
strLis_key = Val(Trim(txtliskey.Text))
strFunc_key = Val(Trim(txtfunckey.Text))
'************************************************* *****************
'Initializing the Parameter Object
'************************************************* ****************
Set prmNum_key = ComNum_key.CreateParameter("Num_Key", adBigInt _
, adParamInput)
Set prmExtension = ComExtension.CreateParameter("Extension", adBSTR _
, adParamInput, , txtextension.Text)
Set prmCell_ID = ComCell_ID.CreateParameter("Cell_ID", adBSTR _
, adParamInput, , txtcellid.Text)
Set prmActual_Extent = ComActual_Extent.CreateParameter("Actual_Extent", adBSTR _
, adParamInput, , txtactualextent.Text)
Set prmLis_key = ComLis_key.CreateParameter("Lis_Key", adBSTR _
, adParamInput, 50, txtliskey.Text)
Set prmFunc_key = ComFunc_key.CreateParameter("Func_key", adBSTR _
, adParamInput, 8, txtfunckey.Text)
'************************************************* *******************
'Appending the Parameter
'************************************************* *******************
ComNum_key.Parameters.Append prmNum_key
ComExtension.Parameters.Append prmExtension
ComCell_ID.Parameters.Append prmCell_ID
ComActual_Extent.Parameters.Append prmActual_Extent
ComLis_key.Parameters.Append prmLis_key
ComFunc_key.Parameters.Append prmFunc_key
'************************************************* ***************
'The Parameter Object has a property called value, you need to Assign
'the value entered by the User to this value and the Value of the user is entered
' in a string type variable
prmNum_key.Value = strNum_key
prmExtension.Value = strExtension
prmCell_ID.Value = strCell_ID
prmActual_Extent.Value = strActual_Extent
prmLis_key.Value = strLis_key
prmFunc_key.Value = strFunc_key
'************************************************* *************************
'Executing The Command Object
ComNum_key.Execute
ComExtension.Execute
ComCell_ID.Execute
ComActual_Extent.Execute
ComLis_key.Execute
ComFunc_key.Execute
Vuyiswa
|
|
|
|
|
I've told you three times what you have to do.
I give up. You're simply not listening, or your not doing any experimentation to test what I'm telling you.
If you don't put the effort into it, why should we?
[EDIT]
Wait a minute! Sorry! My bad. I thought you were asking the same question for a fourth time.
You don't need all of this:
With ComNum_key
.ActiveConnection = conn
.CommandText = "prcInserting"
.CommandType = adCmdStoredProc
End With
With ComExtension
.ActiveConnection = conn
.CommandText = "prcInserting"
.CommandType = adCmdStoredProc
End With
With ComCell_ID
.ActiveConnection = conn
.CommandText = "prcInserting"
.CommandType = adCmdStoredProc
End With
With ComActual_Extent
.ActiveConnection = conn
.CommandText = "prcInserting"
.CommandType = adCmdStoredProc
End With
With ComLis_key
.ActiveConnection = conn
.CommandText = "prcInserting"
.CommandType = adCmdStoredProc
End With
With ComFunc_key
.ActiveConnection = conn
.CommandText = "prcInserting"
.CommandType = adCmdStoredProc
End With
You're creating 6 seperate sql commands and adding a single parameter to each. You need to create just ONE sql command, then add all 6 of your parameters to the one command. Also, you've managed to convert the input from the textboxs to numbers, but you didn't use these numbers in the sql parameters. You, AGAIN, assigned the strings to the parameters. (This is why I thought you asked the same question for a forth time!) Those are really BAD variable names BTW.
strNum_key = Val(Trim(txtnumkey.Text))
strExtension = Val(Trim(txtextension.Text))
strCell_ID = Val(Trim(txtcellid.Text))
strActual_Extent = Val(Trim(txtactualextent.Text))
strLis_key = Val(Trim(txtliskey.Text))
strFunc_key = Val(Trim(txtfunckey.Text))
Set sqlCommand = New Command
Set prmNum_key = sqlCommand.CreateParameter("Num_Key", adBigInt _
, adParamInput, strNum_key )
Set prmExtension = sqlCommand.CreateParameter("Extension", adBSTR _
, adParamInput, , strExtension)
Set prmCell_ID = sqlCommand.CreateParameter("Cell_ID", adBSTR _
, adParamInput, , strCell_ID)
Set prmActual_Extent = sqlCommand.CreateParameter("Actual_Extent", adBSTR _
, adParamInput, , strActual_Extent)
Set prmLis_key = sqlCommand.CreateParameter("Lis_Key", adBSTR _
, adParamInput, 50, strLis_key)
Set prmFunc_key = sqlCommand.CreateParameter("Func_key", adBSTR _
, adParamInput, 8, strFunc_key)
|
|
|
|
|
Is there any equivalant vb.net code of the following vb6 code
Dim wp As WINDOWPLACEMENT
i was getting error .no corection was suggested.
is there any framework class whose reference is needed in my program?
|
|
|
|
|
Nilish wrote: WINDOWPLACEMENT
This is probably a class, I doubt it's intrinsic to VB6.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
|
Nilish wrote: Is there any equivalant vb.net code of the following vb6 code
Dim wp As WINDOWPLACEMENT
WINDOWPLACEMENT is a Win32 API structure - should be available to you in .NET too... maybe you just need to import a DLL into your app.
|
|
|
|
|
Yes , it was an api.I just got to know.I downloaded a chunk of code from internet.I mistakenly , downloded some incomplete code.
well Thanks for the reply.
|
|
|
|
|
Nope - you generally have to match the structure of Win32 structs within .NET code, there's no dll that has them.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
I currently using VB.NET, database is stored on sever, can i use vb.net to get database from server?
Socheat
................
|
|
|
|
|
in the connection string , give the path of the server
|
|
|
|
|
Can u give me an example?
................
|
|
|
|
|
If u r using MS-Access
this kind of connection string is required
dim connectionstring as string=
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\\servername\d\database.mdb"
|
|
|
|
|
How can i get servername, if someone change server name it will automatic change, what does "d" stand for?
-- modified at 4:24 Thursday 17th May, 2007
-- modified at 4:29 Thursday 17th May, 2007
................
|
|
|
|
|
Sir,
d is the drive name (d drive) it was merely considered for an example basis.
if somebody changes the serve name then change the connection string.
simple!!!
|
|
|
|
|
How come, whether the application is installed on client machine, I want to change it automatically.
................
|
|
|
|
|