|
Hi Dave,
I used your snippet , thanks so much. It worked great, appreciate the help,
sb
|
|
|
|
|
Does anybody know how to detect that an app is being killing??
some games, like command & conquers show you a dialog to close when you try to kill from process list.
is there a windows message (other than WM_CLOSE) that can tell me that my app is being killing???
modif: am using VB6
--------------------------
there's another hope...
-- modified at 15:28 Wednesday 11th January, 2006
|
|
|
|
|
If you're talking about a VB.NET WinForm app, then you need to handle the form's "Closing" event.
If this is a VB6 app, then you need to catch the "Form_QueryUnload" event.
-- modified at 14:12 Wednesday 11th January, 2006
|
|
|
|
|
am using VB6, but without form events, is there a way to detect a process killing, to show a dialog or execute code??
i see this in some games, i wonder how the program do not terminate but show a dialog asking you to confirm program exit.
|
|
|
|
|
edwin164 wrote: i see this in some games, i wonder how the program do not terminate but show a dialog asking you to confirm program exit.
I would expect a game to make calls to PeekMessage() within the game loop. It would need to do this to receive keyboard and mouse input. It would also catch the window's WM_CLOSE and maybe the WM_QUIT events as well, allowing the game to close itself gracefully.
You need the window's handle in order to receive its messages. Once you receive the WM_CLOSE message, you can display your confirmation dialog. You would call DestroyWindow(hWnd) to close it afterwards, if you're doing it via Win32 API.
|
|
|
|
|
edwin164 wrote:
is there a windows message (other than WM_CLOSE) that can tell me that my app is being killing???
AFAIK that's the only WM message. In the beginning the OS tries to close it in a polite way sending that message.
Still you don't need to intercept the message since the framework provides you with a pre-built event for each form (Closing). That event allows you to cancel the closing with the Cancel argument.
If the form is mandatory closed by an external event (OS) again the FW should give you the event Closed.
|
|
|
|
|
am using VB6 so no framework is available...
i wondering how some apps (probably not written in VB) can intercept a process killing. not using forms event is there another way to execute code before process die??
|
|
|
|
|
No, there is no way to trap this without the "event".
You're application get's sent a WM_CLOSE message. This shows up in your app as the form Closing event. Handle this event. You DON'T have to return a response immediately, Windows will wait for around for a response.
When this event happens, you can put up your dialog. In response to the dialog, you can then respond to the Closing event by setting the Cancel property appropariately.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
in VB6 the event is Form_Unload but it looks like you don't have a running form. If that's the case you have to check your messaging queue for the WM_CLOSE and WM_QUIT
|
|
|
|
|
For num = 0 To 7
For i = 0 To numSamps - 1
calSignals(num)(i) = data(i + num * numSamps)
Next i
Next num
where
I dim data() as double
redim data(0 to numsamps -1)
and
dim calSignals () as double
redim calSignals(0 to 7)(0 to numSamps - 1)
Indicates that the = sign is the problem. Can I not do this in VB?
thanks,
sb
|
|
|
|
|
You can't do this:
calSignals(num)(i)
In VB, it has to look like this:
calSignals(num, i) = data(i + num * numSamps)
The same goes for your ReDim statement:
ReDim calSignals(0 To 7, 0 To numSamps - 1)
Next time, copy and paste your code into the post. Don't retype it yourself.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
|
I would like to create a external text file or .inf file to hold the list for a combobox.
Any help or direction would be great.
1. Out of clutter, find simplicity.
2. From discord, find harmony.
3. In the middle of difficulty lies opportunity.
Albert Einstein
three rules of work
|
|
|
|
|
You might want to check out the FileStream[^] class. There's plenty of examples.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Thanks for the directions I did this
Imports system
imports system.io
then in the form load
Try
' Create an instance of StreamReader to read from a file.
Dim sr As StreamReader = New StreamReader("MyFile.txt")
Dim line1 As String
' Read and display the lines from the file until the end
' of the file is reached.
Do
line1 = sr.ReadLine()
ComboBox3.Items.Add(line1)
Loop Until line1 Is Nothing
ComboBox3.Items.Add(sr)
sr.Close()
Catch Er As Exception
' Let the user know what went wrong.
Console.WriteLine("The file could not be read:")
Console.WriteLine(Er.Message)
End Try
1. Out of clutter, find simplicity.
2. From discord, find harmony.
3. In the middle of difficulty lies opportunity.
Albert Einstein
three rules of work
|
|
|
|
|
Hi all,
Is there any way by which i can have a image moving in a Progressbar(instead of rectangle moving)?
please help...
tx
|
|
|
|
|
You can't use the stock ProgressBar for this. You'll have to "roll your own" to provide this functionality.
You can find such an example here[^].
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
no answers?
|
|
|
|
|
I need a user to provide the date and time. I'm doing this by using two datepicker controls, one to set date and the other one to set time.
But the irritating thing is that I can't combine the two results!?
All Date and Time properties of a DateTime class are ReadOnly (for whatever the reason), but it would be nice if I could just say:
UserDate.Date=pickDate.Date
UserDate.Hour=pickTime.Hour
UserDate.Minute=pickTime.Minute
Can anyone help me how to solve this problem?
Thank you,
Veljko
|
|
|
|
|
I solved it in the past this way:
Dim dtD as DateTime = dtpDate.Value
Dim dtT as DateTime = dtpTime.Value
Dim dtC as DateTime = dtD.AdTicks(dtT.Ticks)
I'm not 100% sure about the code since I go by heart, but I'm 100% sure about the method used.
|
|
|
|
|
Briga wrote: Dim dtD as DateTime = dtpDate.Value
Dim dtT as DateTime = dtpTime.Value
Dim dtC as DateTime = dtD.AdTicks(dtT.Ticks)
This isn't going to work Briga. Even though the user is only entering time into the "dtpTime" DateTimePicker, this object still internally stores a month/day/year and is included in the returned ticks. So, adding the ticks of both the time and date DateTimePickers will push the resulting DateTime beyond the year 4000. Unless of course you are initializing dtpTime to the beginning of time.
See my post below for a better solution.
|
|
|
|
|
Joshua Quick wrote: This isn't going to work Briga. Even though the user is only entering time into the "dtpTime" DateTimePicker, this object still internally stores a month/day/year and is included in the returned ticks. So, adding the ticks of both the time and date DateTimePickers will push the resulting DateTime beyond the year 4000. Unless of course you are initializing dtpTime to the beginning of time.
Yeah I believe you as I said I was going by heart. It did work something similar (the idea is by adding the two components).
Anyway your solution seems more elegant and efficient than mine.
|
|
|
|
|
The DateTime type is a Structure. Structures are value types which are typically immutable in the .NET framework, like the String type. The properties of an immutable types cannot be changed. Instead, the immutable object must be overwritten.
Why are they like this? Because Structures are passed by value (a copy of the original Structure). So, changing the properties of a returned structure would only change the copy and not the original.
Regarding your DateTimePicker handling, you need to overwrite your UserDate variable. Try something like this...
UserDate = New DateTime(pickDate.Value.Year, pickDate.Value.Month, pickDate.Value.Day, _
pickTime.Value.Hour, pickTime.Value.Minute, pickTime.Value.Second)
|
|
|
|
|
|
doh:hello guys...i'm into system development, i just want to ask some assitance or help you could give with my project. do you have some ideas or the code itself on how to send message from PC to a bluetooth enabled phone with a vb.net as its platform? please i really do badly need your help.
|
|
|
|