|
The += syntax for adding an event handler to an event is OK in C#, but it does not exist in VB.NET AFAIK.
You'll have to use an AddHandler statement, see the relevant MSDN page[^], or look it up in your VB.NET book.
|
|
|
|
|
Hi,
I'm searching for an example of an API hook for ExitWindowsEx.
I want to intercept the Shutdown/Restart of windows, do some stuff and go on with the ShutDown or Restart.
Ik know how to intercept the ShutDown with WM_QUERYENDSESSION but
that doesn't give me back which option the user has chosen: ShutDown or Restart.
I'v been searching the internet now for a few evenings with no results.
I'm using VB6 and VB2008. but any example would be appriciated.
Can anyone provide me with an example ???
Thank you !!!!
Ed
|
|
|
|
|
I can't help you in VB6, the language was obsoleted in a previous century.
In VB.NET, I suggest you have a look at SystemEvents[^], you probably won't need Windows messages nor P/Invoke.
|
|
|
|
|
Hi Luc,
Thank you but i know about the SystemEvents in vb.net.
The SystemEvents.SessionEndings.SessioEndReadings gives you back the reasons: Logof and SystemShutdown.
The SystemShutdown is the one which is given back in case of ShutDown OR Restart.
So I still can't tell which one the user selected.
That's why it was suggested to use an API hook.
I have a working example with SystemEvents...
gr.Ed
![Smile | :)](https://codeproject.global.ssl.fastly.net/script/Forums/Images/smiley_smile.gif)
|
|
|
|
|
Hello,
I am not sure if this is allowed or not – if this post is against any Rules i apologize in advance and this post can be removed.
I am in the process of creating a open-source project to track the Psychological Mood of a person, this application will be used by people visiting psychologists.
Target Audience
People that are currently in therapy or want to keep track of mood changes. The program is based on CBT.
Aims
To provide to the end-user the tools for him to be able to monitor his mood.
To provide to the therapist additional information for the client through the automatic generation of graphs.
To reduce the international suicide rate.
To make this application available for everyone to use.
We are looking for some volunteers to help with Coding of the Project.
The Project has been seperated into three parts for easier management.
The Desktop Application is coded in VB.NET and using an ORM called nHibernate.
Project URL: http://moodtracker.codeplex.com
The Web-Based Application will be coded in C# and use MSSQL as the Database.
Project URL: http://webmoodtracker.codeplex.com/
The iPhone Application.
Project URL: http://iphonemoodtracker.codeplex.com/
We're aiming to develop a feature-rich Psychological Mood Tracker to help the end-users as much as we can.
If anyone is interested please feel to apply to the CodePlex Project Page.
Thank you in advance.
Constantinos
|
|
|
|
|
Not against the rules but probably not the correct forum.
------------------------------------
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[ ^]
|
|
|
|
|
Hello gurus,
I hope someone is around these days, and to everyone who sees this I want to wish a Merry Christmas and a Happy Holiday!
But "let's get down to business": In my application I have to update the form from a different thread, which I do with the following code:
Private Sub UpdateProgress(ByVal value As Integer, ByVal labelText As String)
If StatusStrip.InvokeRequired Then
StatusStrip.Invoke(ProgressUpdater, New Object() {value, labelText}) <---- ERROR
Else
If value > StatusProgressMain.Maximum Then value = 100
StatusProgressMain.Value = value
StatusLabelMain.Text = String.Format("{0} Records", mDVdata.Count)
End If
End Sub Unfortunately I run into 'NULL referece exception' when invoking the StatusStrip although neither the value nor the labeltext variables are NULL. Do I probably overlook something like a plain syntax error?
Thank you for reviewing and any hint!
Mick
EDIT / RESOLUTION:
The exception turned out to be thrown in a different part of the procedure, the 'Else' clause: The mDVdata datatable wasn't properly declared!
modified 23-Dec-11 7:05am.
|
|
|
|
|
Which reference gives the exception?
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
Hi Richard,
the reference is "Object reference not set to an instance of an object". Would that probably mean that I have to declare another instance of ProgressUpdater? I suppose there's already one instantiated by
Private Delegate Sub AsyncDelegate(ByVal value As Integer, ByVal labelText As String)
Private ProgressUpdater As New AsyncDelegate(AddressOf UpdateProgress) right at the start of the form class?
Thanks again
Mick
|
|
|
|
|
Michael Schäuble wrote: the reference is "Object reference not set to an instance of an object".
Yes but which reference? You have an object reference in your code that has not been initialised so you need to look into your code (maybe with the debugger) to find out which it is and why it is still null.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
Thank you, Richard - I put the resolution into the main messages edit. And: You're absolutely right !
Merry Christmas again!
|
|
|
|
|
I suspect that the ProgressUpdater delegate might not have been initialized.
|
|
|
|
|
Hi Shameel,
I have these two lines right at the beginning of the class:
Private Delegate Sub AsyncDelegate(ByVal value As Integer, ByVal labelText As String)
Private ProgressUpdater As New AsyncDelegate(AddressOf UpdateProgress) Would that be sufficient?
|
|
|
|
|
Michael Schäuble wrote: Would that be sufficient?
Should be.
Can you check which element of your code is throwing the null reference exception? If your StatusStrip is itself null, then your designer generated code might be screwed up.
|
|
|
|
|
But in that case the If-clause would throw the exception, wouldn't it?
|
|
|
|
|
Michael Schäuble wrote:
But in that case the If-clause would throw the
exception, wouldn't it?
Yes, it usually would. But it is also possible that the Invoked method is throwing the error and since it does not have a Try Catch block, it is being pushed backed up the stack. Add Try Catch and some custom logging to find out where the problem exactly is.
|
|
|
|
|
Thank's for your help, Shameel. I found it out and put the answer into the main message as an edit.
Merry Christmas again!
|
|
|
|
|
You're welcome. As I have mentioned in my other post, since there is no Try Catch block, the exception is pushed up the stack and is handled by the called method at the Invoke call.
|
|
|
|
|
How to create a Table in a VB6 application. Ihave the following code
Private Sub createDB(dbname As String)
Dim db As Database
Dim td As TableDef
Dim fld As Field
Set db = DBEngine(0).CreateDatabase(dbname, dbLangGeneral)
Set td = db.CreateTableDef("Students_Info")
With td
Set fld = .CreateField("Rollno", dbNumber, 3)
fld.AllowZeroLength = False
fld.Required = True
.Fields.Append fld
Set fld = .CreateField("FirstName", dbText, 15)
fld.AllowZeroLength = False
fld.Required = True
.Fields.Append fld
Set fld = .CreateField("LastName", dbText, 15)
fld.AllowZeroLength = False
fld.Required = True
.Fields.Append fld
Set fld = .CreateField("DOB", dbDate)
fld.AllowZeroLength = False
fld.Required = True
.Fields.Append fld
Set fld = .CreateField("Class", dbText, 6)
.Fields.Append fld
Set fld = .CreateField("Subjects", dbText, 6)
.Fields.Append fld
Set fld = .CreateField("Mobile", dbLong, 10)
fld.AllowZeroLength = False
fld.Required = True
.Fields.Append fld
Set fld = .CreateField("Father's_name", dbText, 30)
fld.AllowZeroLength = False
fld.Required = True
.Fields.Append fld
Set fld = .CreateField("Mother's_Name", dbText, 30)
fld.AllowZeroLength = False
fld.Required = True
.Fields.Append fld
Set fld = .CreateField("Address", dbText, 60)
fld.AllowZeroLength = False
fld.Required = True
.Fields.Append fld
Set fld = .CreateField("E_Mail", dbText, 30)
.Fields.Append fld
End With
db.TableDefs.Append td
End Sub
Please Help
Needed for my project
Gopal_Krishan
|
|
|
|
|
You already posted this question in Quick Answers.
It's considered a bad habit to post in more than one forum, mainly because readers can't see what answers already have been given (in the other forum).
Please don't do this again.
Cheers
If you can read this, you don't have Papyrus installed
|
|
|
|
|
Always wrap your code in "pre" tag before posting it.
|
|
|
|
|
i whant the program that excute data incryption standard des
|
|
|
|
|
You have a number of options:
- Search the articles here[^] on CodeProject
- Search Google/Bing/Yahoo
- Write it yourself
- Pay someone to write it for you
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
I want a Porsche. Am willing to trade for Google access.
|
|
|
|
|