|
Your delegate declaration is awry - the lParam parameter should be an Int32
Also - in VB.net a 32 bit number is not a Long - replace all instances of Long with Int32.
<br />
Public Delegate Function EnumFuncDeleg(ByVal hwnd As Int32, ByVal lParam As Int32) As int32<br />
<br />
Declare Function EnumChildWindows Lib "user32" (ByVal hWndParent As Int32, ByVal lpEnumFunc As EnumFuncDeleg, ByVal lParam As int32) As int32<br />
<br />
'<br />
'<br />
' Inside function<br />
EnumChildWindows(ProcessInfo.Handle, AddressOf EnumChildWindow, Nothing)
|
|
|
|
|
Thank you for that! It works lika clockwork now
|
|
|
|
|
Can anybody help me with a little nightmare that i'm having?
I am trying to make a countdown timer in VB.net showing years, months, hours, minutes and seconds, and i want it to tell me the time between two dates and then count down to that appointment.
I've tried playing with the date.interval class and have got myself in a mess.
Please help me.
Brizee
|
|
|
|
|
It would be easier to help, if you specify what kind of problem you are facing. Tell us what your doing with the code and what is the error or problem you are facing with the data.
You can use the Date.Timespan class to get the difference between two dates and use a timer control to do what you want.
|
|
|
|
|
Thanks for the information. I will try and utilise the Date.Timespan class instead of the Date.Interval class, and hopefully i will make some headway.
Many Thanks.
Brian Hull
|
|
|
|
|
You could display "Now" and then set the timer event to update the textbox/label and set the timer interval to 1000 milliseconds (1 second).
Here is a sample
Dim d As Date
Dim ts As TimeSpan
Private Sub TimerTick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
d = #12/25/2007#
ts = d.Subtract(Now)
Label1.Text = ts.ToString
End Sub
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
Timer1.Interval = 1000
Timer1.Enabled = True
End Sub
|
|
|
|
|
Hey thanks for your help, you've got me sorted and it works a treat. I can now start getting this implemented into my application.
Brian Hull
|
|
|
|
|
Could i ask another question which really is about syntax. What if i want to put a date and time into d, would that then be #12/25/2000/12.45#.
I'm presuming this isn't correct?
Brizee
|
|
|
|
|
Hi
I used CoCreateGuid window API in vb 6.0 application it works fine.
But for vb.net it makes problem, if anybody know please tell me how i used it in my vb.net code.
Thanks
Thanks
|
|
|
|
|
bony_baba wrote: But for vb.net it makes problem
Care to explain the problem or error you're getting?
bony_baba wrote: if anybody know please tell me how i used it in my vb.net code.
Show us your VB.NET code and we'll see what we can do to help you. We won't write it for you.
|
|
|
|
|
i Upgrade my vb 6.0 application to Vb 2005 it works fine in vb 6.0 but not in vb.nET.
Now the problem is solved actually it makes problem in passing structure without marshalling.
Thanks
Thanks
|
|
|
|
|
I'm glad it's working. From the samepl you provided from the conversion, you could have done all of this in one line of code if you rewrote it from scratch.
|
|
|
|
|
|
are you *sure* it's a COM dll ?
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 )
|
|
|
|
|
How to get all window handles knowing it's process name?
|
|
|
|
|
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 ****
|
|
|
|