|
WHAT??? Would you like to post some code?
An environment variable doesn't have anything to do with an event handle...
Are you saying that you want to fire an event if your app is asked to return an environment variable?
RageInTheMachine9532
"...a pungent, gastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Let me clarify, I looked a little more and I am not getting the handle. Instead I am getting the object name. In a similar C++ program the code looks as follows:
if( GetEnvironmentVariable("Notify",szValue,sizeof(szValue)) )
{
hEvent = OpenEvent(EVENT_ALL_ACCESS,FALSE,szValue);
if( NULL == hEvent )
{
printf("AppStarted OpenEvent failed %d <%s>\n",
GetLastError(),szValue);
goto RET;
}
}
if (!SetEvent(hEvent))
{
printf("AppStarted SetEvent failed %d <%s>\n",
GetLastError(),
szValue);
goto RET;
}
}
Here is a link to the details of OpenEvent in MSDN:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/openevent.asp
So how would I open this event and set it in VB.NET?
I hope that makes more sense...
Waffleman
|
|
|
|
|
Yes it does... Your C++ code, which I assume your trying to duplicate in VB.NET, just gets the name of an event signal object. Now, it uses that name to open the event object, provided that it already exists, then it sets the object to signaled. This is used to nofity other threads in an application that an event has happened.
What does you VB.NET code look like? With the OpenEvent function, all you get back IS the event handle, if it exists. The Environment variable is just there to supply the name of the event your getting the handle to. This event object must be created with CreateEvent in some other process before your VB.NET app can Open it...
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Here is the only VB.NET code I have:
Dim szNotify as String
szNotify = Environment.GetEnvironmentVariable("Notify")
DebugPrint("Notify: " & Notify, 1)
If (szNotify.Length > 0) Then
'** Set Event
End If
The event signal object is created by the parent program that kicks off the program that I am currently writing in VB.NET. The object name is stored in an environment variable. Right now I am just unclear on how to, when given an event object name, open the event and raise it in VB.NET.
Freiheit ist von Gott, Freiheiten vom Teufel.
|
|
|
|
|
i want to know where does the messanger (yahoo or msn or any)keep the password on the computer and how can i get it from the computer
Lost & Forgotten
|
|
|
|
|
It's stored in a cookie and encrypted. You're not retrieving the password from a cookie without some serious decryption code, that we're not giving you for obvious reasons...
RageInTheMachine9532
"...a pungent, gastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Yes, the password is stored on your computer. There are a lot of utilities to decrypt them. Try this website[^]
Aaron Eldreth
TheCollective4.com
My Articles
While much is too strange to be believed,
Nothing is too strange to have happened.
- T. Hardy
|
|
|
|
|
To add in a program an istruction that, in the moment in which it runs. ..."pause" the program?
...imagine to have a program that it is doing varied things...exists a wayto say..."Stop" (for example) for 10 seconds without makeing nothing and then "restart at the stop point"? (Everything without to have "closed" the program.....but only as likeas it was "in wait?")
Thanks early to all.
Night Soul!!!
|
|
|
|
|
????? It's very difficult to understand you, but I'll take a crack at this...
I take it you want to put your code to sleep for, say 10 seconds. Simple... Use Thread.Sleep(milliseconds As Integer), or Thread.Sleep(TimeSpan):
Imports System
Imports System.Threading
Thread.Sleep(10000) ' Puts the current thread to sleep for 10 seconds.
RageInTheMachine9532
"...a pungent, gastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
thank you again....it works!
Ps: sorry but you how would have expressed my question? (better?)
|
|
|
|
|
"How can I get my code to pause or sleep for as long as I want, and resume at the point it 'fell asleep'?"
RageInTheMachine9532
"...a pungent, gastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
hello
i new to vb.net and i need help with the compling of a project
i press F5 and this should run the project rite?
i got a message saying that im not in the "Debugging Users" group
it just ask me to add myself to this group which i have no idea what is it
can anyone help me?
i cant seen to start my project
thank you in advance
Gary
|
|
|
|
|
Start your Computer Management Console (Start -> All Programs -> Administrative Tools -> Computer Management)
Navigate to Users in the Console ( System Tools -> Local Users and Groups -> Users) and select your user name. Right-click on it, select properties, then select the "member of" tab, and Add the Debugger Users group.
"if you vote me down, I shall become more powerful than you can possibly imagine" - Michael P. Butler.
|
|
|
|
|
hii nick
thank you for your help
but the problem now is that i cant alter anything at the "member of" tab
it just pop out a message saying "The following error accur while saving....."
"Access is denied"
i have follow your instruction
then at the "member of" tab where is empty
i click add then it say select group
im not sure i did it correctly but this is what i did
i select object type and location (currently only 1 is enable for me to choose)
then i press ok...later the error message pop out
did i do anything wrong?
or maybe cause im using my college computer that i require the IT department to do the setting
im asking this cause i will also need it with my personal pc
thank you
Gary
|
|
|
|
|
You will need to be an administratror to change these settings. If you're using your college pc, you might need to ask the administrator of the machine to add the group for you.
"if you vote me down, I shall become more powerful than you can possibly imagine" - Michael P. Butler.
|
|
|
|
|
|
Hi,
After I got DateTime from Calendar (ie: fDate = July 04,2004), the date is showed by Debug program is 07/04/2004 but after I using:
strSQL = "SELECT * FROM Invoice WHERE InvoiceDT >= " & fDate>
---> some how it converted fDate back as 04/07/2004 (April 07, 2004) and when execute the SQL I got wrong result!
*) If I get the date later than 12 then there are no problem because MS detects it (ie: 30/06/2004 or 06/30/2004)
1. How can I correct this problem?
2. Do I need special syntax in string SQL for DateTime? (I did try add "#" & fDate "#", the result is the same!)
Many thanks for any help,
Anh
|
|
|
|
|
Your first, and last, mistake is using a concantenated string for an SQL statement.
ALWAYS, ALWAYS, ALWAYS, ... continue for 10 more minutes ..., ALWAYS use PARAMETERIZED queries!
Using a parameterized query will automatically make sure that the date is translated into the appropriate format for the SQL statement. Also, the reverse is true. Any date that is returned will be converted back to the appropriate format for your code.
This is an example from a project I am working on:
Try
oConnection = GetDatabaseConnection()
oCommand = New SqlCommand
oCommand.Connection = oConnection
oCommand.CommandText = "SecurityValidateLogin"
oCommand.CommandType = CommandType.StoredProcedure
Dim sqlParam As New SqlParameter("@Username", SqlDbType.NVarChar, 50)
sqlParam.Value = sUserName
oCommand.Parameters.Add(sqlParam)
sqlParam = New SqlParameter("@Password", SqlDbType.NVarChar, 15)
sqlParam.Value = sPassword
oCommand.Parameters.Add(sqlParam)
sqlParam = New SqlParameter("@SourceIP", SqlDbType.NVarChar, 32)
sqlParam.Value = sSourceIP
oCommand.Parameters.Add(sqlParam)
oConnection.Open()
oCommand.ExecuteNonQuery()
oConnection.Close()
' code removed
Catch ex As Exception
LogErrorEvent("SecurityServices", "ValidateUserLogin", ex.Message, ex.StackTrace)
Throw ex
Finally
' Trash our open objects
If Not oCommand Is Nothing Then
oCommand.Dispose()
End If
If Not oConnection Is Nothing Then
If Not oConnection.State = ConnectionState.Closed Then
oConnection.Close()
End If
oConnection.Dispose()
End If
End Try
Return retValidateValue
RageInTheMachine9532
"...a pungent, gastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hey Dave,
Under what circumstances should we be using parameterized queries?
Charlie
if(!curlies){ return; }
|
|
|
|
|
all, alL, aLL, ALL OF THEM I SAY! MUAHAHAHHAHAH!!
But seriously, for those who read the posts long after we put them up (yeah, right )...
If you have an SQL stored proecdure or statement with a WHERE clause in it, always use parameterized queries to call it! It will save you a bunch of headaches like the original poster had. It's not hard to do, maybe a little tedious, and it's very easy to follow compared to some of the monsterous string built queries I've seen.
RageInTheMachine9532
"...a pungent, gastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hello Dave,
- Thank you for your advice, they are looking very clear ... except that I could not find the right SQLparameter for DateTime format (OLEDBparameters and in your example). We do not want to use them as CString!
- I did find out why I had the problem before, because I set the Region & Language setting in English (Canada) DateTime: Day/Month/Year instead of English USA DateTime: Month/Day/Year ... meanwhile My.mdb set Month/Day/Year! After I change, it works OK now!
*) However, your suggestion (if I can find the way) is more dynamic & appropriate because we do not need to re-set the Region & Language setting
---> If you know how to set SQLparameter more precisely, I will appreciate a lot
Hint: In VC++, we force CASTING DateTime variable to float, then we do not worry about which order the DateTime variable is!
strSQL.Format ("SELECT * FROM Table WHERE Date > %f", (float)fDate;)
Thanks,
|
|
|
|
|
You didn't say it was an Access database, but the idea is identical to an SQL Server version. This is an example based on the query you supplied in your first post:
Public Shared Function GetOleDBDataReader(ByVal searchDate As Date) As OleDbDataReader
Dim oleConnection As New OleDbConnection("connectionString")
Dim oleCommand As New OleDbCommand("storedProcedureName", oleConnection)
oleCommand.CommandType = CommandType.StoredProcedure
' or you could use this if the SQL statemnet is not in a stored procedure:
'Dim oleCommand As New OleDbCommand
'oleCommand.CommandText = "SELECT * FROM Invoice WHERE InvoiceDT >= ?"
'oleCommand.CommandType = CommandType.Text
'oleCommand.Connection = oleConnection
' OleDbType depends on the column definition in the database.
' Using this method, you don't have to worry about the proper date format.
Dim sqlDateParam As New OleDbParameter("@DateToSearchFor", OleDbType.Date)
sqlDateParam.Value = searchDate
sqlDateParam.Direction = ParameterDirection.Output
oleCommand.Parameters.Add(sqlDateParam)
oleConnection.Open()
Return oleCommand.ExecuteReader(CommandBehavior.CloseConnection)
End Function
RageInTheMachine9532
"...a pungent, gastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi everyone.
I'm just asking, what is the better way to connectig to Oracle 8i DB. I know if I using OLE provider for oracle, ok.. Works fine..
But you know other way to fastes execute SQL statments. I looking for the efficient code for searching.
If anyone?
Thanks
Johnny Lizardo
|
|
|
|
|
Check out the System.Data.OracleClient namespace. It'll have everything you need...
RageInTheMachine9532
"...a pungent, gastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I have a Garmin GPS that I would like to communicate with via
a serial connection. I have downloaded the interface documentation.
The documentation indicates the communication packet has a checksum byte
that is the "2's complement Sum of all data before the checksum byte.
When I add up all of the bytes before the checksum I get a value that
is larger than an 8 bit byte. My final value is 270
If I understand correctly. I take the value of 270 and invert it
Then I add 1 to this value to get the 2's complement.
Example:
Value = 270
Original Value in bits
00000001 00001110 = 270
Value = Not Value
Inverted Value (1's complement)
11111110 11110001 = -271
Value = Value + 1
add 1 to value to get 2's complement
11111110 11110010 = -270
At this point I need to place this into a single 8 bit Byte
I assume I just drop the first 8 bits
to give me the following.
11110010 = 242
My two questions are
1) am I correct in striping off the left 8 bits?
2) how do I do this in VB.Net without having to create a bitarray and manually
processing the bits?
=================================
When I was in school, all I wanted was to get out into the real world.
Now that I'm in the real world, all I want is to go back to school.
|
|
|
|