|
I use Winsock to write a app send and receive files throughout computers on LAN. I used to use SendData method to send a string to app of destination computer . But I want to send a message to notice to destination computer whenever files are delivered to destination computer.
Which functions Can I use in this situation?
Help me!
Thanks
tramdtt
|
|
|
|
|
I have a global system hook, using "dscwpmsg.dll" and an example from www.allapi.net (acording to the read me: a system wide Hook of the types "WH_CALLWNDPROC" and/or "WH_GETMESSAGE").
I want to know when the a user RIGHT clicks on the minimize (or any other) button of the control box (top right of every window).
If any one has any ideas I'd appriciate it. And before any one sais you can't (people on IRC caim it is not possible): it is possible, I have an application that does it, now I want to know how...
|
|
|
|
|
Hello..I'm new in VB.net
I have form with display button and text box.
I have myclass.
<br />
Namespace theClass<br />
<br />
<br />
' The class is named StringProcessor.<br />
Public Class myClass<br />
<br />
Public Sub printOut(ByVal t as String)<br />
<br />
MsgBox(t)<br />
End Sub<br />
End Class<br />
End Namespace<br />
Then I want to print out what the use type in so I call
printOut(Me.InputText.Text)
but I got error message like
An unhandled exception of type 'System.NullReferenceException' occurred in BrianHuang_Unit5.exe
Additional information: Object reference not set to an instance of an object.
help me how to correct it please.
|
|
|
|
|
You don't give the stack trace of the error message, so it is harder to tell WHERE it happened.
Given the code snippet you've supplied Me.InputText is the most likely culprit, if so that means you have not set it to an instance of an object. You need to instantiate Me.InputText first.
"You can have everything in life you want if you will just help enough other people get what they want." --Zig Ziglar
The Second EuroCPian Event will be in Brussels on the 4th of September
Can't manage to P/Invoke that Win32 API in .NET? Why not do interop the wiki way!
|
|
|
|
|
We need to know on what line the exception occured, otherwise we really can't tell you with any accuracy what you did wrong.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
This is in form.
<br />
Private Sub btnDisplay_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDisplay.Click<br />
Dim sp As Course.theClass.myApp<br />
sp.printOut(Me.InputText.Text()) ' here the error pointing to.<br />
End Sub<br />
the myApp class
<br />
Option Strict On<br />
Option Explicit On <br />
<br />
Imports System.Windows.Forms<br />
<br />
' The class module is enclose in a namespace named CountingStatement. <br />
' The root namespace was set to Course using the Project Properties dialog box. <br />
Namespace theClass<br />
<br />
' The class is named StringProcessor.<br />
Public Class myApp<br />
Public Sub printOut(ByVal theText As String)<br />
'get the total number of characters,#of Words, #of paragraph, and # of sentence in that paragraph. <br />
MsgBox (theText)<br />
End Sub<br />
End Class<br />
End Namespace<br />
It is not as easy as c++. I dont know how to call the class function from the other class in VB.net.
Thank you
|
|
|
|
|
The problem is that you delcared sp as Course.theClass.myApp, but you never instantiated it. It should be:
Dim sp As New Course.theClass.MyApp
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
thank you... it works now.
|
|
|
|
|
does anyone know somewhere when they have written code to verify what users are signed onto a program.
for example. If i only want 10 users logged in at once but 100 possible users in the program. Each instance will be running on a diff pc and i cant figure out how to validate what users are logged on and limit the logged on users to 10
Vince
|
|
|
|
|
Your application would need its own licensing server. Something you would have to write from scratch and into your application. Your app would ask the user for an username and password, login into the license server, check out a license on a lease (timed) basis, say 30 minutes, and when the app quits, check with the license server to return the license. You would also have to write into the license server some kind of timeout where if the server did not hear from the client, the license would be returned to the license pool. The clients would also have to check in with the server occasionally to renew their leases. This is necessary for the simple reason an application could hang and the license would be checked out without ever being checked back in properly. Not too hard to write, but, like I said, you'd have to write it from scratch.
Oh! Then you would need a management tool to administer the license server too...
Or buy the components from a 3rd party, of which I have no idea who sells something like this...
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Ok, Building a game for my school final project and I have enought programming skill to know loops, if's, and a bit of other things.
I was wondering what is the way a person with my programming abilities would go about adding sound and playing it within VB. It would be appreciated if soeone could help me out. Otherwise I have a soundless, boring game.
|
|
|
|
|
Well, the simple way to do it is buy calling into the Win32 API. Something, I take it, your class never covered...
But, anyway, you would Declare the call into the API like this:
Private Declare Function Beep Lib "kernel32" Alias "Beep" _
(ByVal dwFrequency As Long, ByVal dwDuration As Long) As Long
Then, when you want to play a sound:
Beep 5000, 250
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Thanks alot Dave, now I will have the rockinest game ever!
That is very, Very, VERY, VERY!, cool. Thanks alot..again.
(amended after school)
Ok uh..instead of the beeps...because my computer teacher hates me now because the room was full of...beeping, how would I play a .wav, like "sound.wav" within VB? Then with actual sound it would benifit me very much.
|
|
|
|
|
how can i delete this chater "
from a string, like this one
"c:\windows
<br />
'sample code<br />
<br />
cmdline$ = "c:\windows\notepad.exe" <br />
path = cmdline$<br />
WorkingDirectory = Mid(path, 1, InStrRev(path, "\") - 1)<br />
MsgBox WorkingDirectory<br />
jeroen
|
|
|
|
|
Replace(Command$, Chr$(34), "")
Chr$(34) could be "\"" i could be wrong.
Shin
|
|
|
|
|
You might want to check into using the Path class to return full paths to files and directories:
cmdLine$ = chr$(34) & "C:\Windows\notepad.exe" & chr$(34) ' "C:\Windows\notepad.exe"
WorkingDirectory = Path.GetFullPath(cmdLine$) ' will be C:\Windows\notepad.exe
WorkingDriectory = Path.GetPathRoot(WorkingDirectory) ' Should be C:\Windows
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Going to use it for CreateProcessA
<br />
Public Function ExecuteAndWait(cmdline$)<br />
On Error GoTo Error<br />
<br />
Dim NameOfProc As PROCESS_INFORMATION<br />
Dim NameStart As STARTUPINFO<br />
Dim x As Long<br />
Dim WorkingDirectory As String<br />
Dim Path As String<br />
<br />
Path = cmdline$<br />
WorkingDirectory = Mid(Path, 1, InStrRev(Path, "\") - 1)<br />
<br />
MsgBox WorkingDirectory<br />
GoTo Quit<br />
NameStart.cb = Len(NameStart)<br />
x = CreateProcessA(0&, cmdline$, 0&, 0&, 1&, NORMAL_PRIORITY_CLASS, 0&, WorkingDirectory, NameStart, NameOfProc)<br />
x = WaitForSingleObject(NameOfProc.hProcess, INFINITE)<br />
x = CloseHandle(NameOfProc.hProcess)<br />
<br />
Exit Function<br />
Error: ' Error handling<br />
MsgBox "Run-Time Error number " & Err.Number & vbCrLf & Err.Description, vbOKOnly + vbCritical, "CreateProcess"<br />
GoTo Quit<br />
Quit:<br />
End Function<br />
i cant find declare sampels with api text viewer
<br />
GetFullPath declared like this : ?<br />
<br />
Public Declare Function GetFullPath Lib "kernel32" Alias "GetFullPathNameA" (ByVal lpFileName As String, ByVal nBufferLength As Long, ByVal lpBuffer As String, ByVal lpFilePart As String) As Long<br />
<br />
<br />
GetPathRoot declared like this : ?<br />
<br />
Private Declare Function GetPathRoot Lib "gdi32.dll" (ByVal hdc As Long, ByRef lpPoint As POINTAPI, ByRef lpTypes As Byte, ByVal nSize As Long) As Long<br />
<br />
<br />
thanks for helping
jeroen
|
|
|
|
|
Sorry, the examples I gave were for VB.NET. There are no equivilents in VB6...
You would have to use the FileSystemObject to get the same functionality.
See this[^] for the docs on the FSO. Oh! You'll also have to set a reference to the Windows Scripting Runtime.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
no need use the FileSystemObject to get the same result
<br />
Dim WorkingDirectory As String<br />
Dim Path As String<br />
Dim Path1 As String<br />
<br />
Path = cmdline$<br />
Path1 = Right(Path, Len(Path) - 1)<br />
WorkingDirectory = Mid(Path1, 1, InStrRev(Path1, "\") - 1)<br />
msgbox WorkingDirectory<br />
Thanks for help
Greets Jeroen
|
|
|
|
|
True, but your code isn't portable and can't cope with paths that start with periods (relative path names).
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I can add a new column only at the last column in my database table with
<br />
strSQL = "ALTER TABLE Invoice ADD COLUMN " & taxName.Text & " currency"<br />
cmd.CommandText = strSQL<br />
What if I want to insert (add) new column at the desired place (let say I have Col1, Col2, Col3, Col4, now I want to insert new column Col_N after Col2)? Anyone knows how to do it?
Thanks to all suggestions,
|
|
|
|
|
Although the documentation on ALTER TABLE says it doesn't support what you want to do, you might want to try adding a BEFORE fieldname to the statement.
ALTER TABLE Invoice ADD COLUMN " & taxName.Text & " currency BEFORE <fieldname>
If that doesn't work, and I don't think it will you could get around this by following these steps:
1. Rename that table.
2. Create a new table with the same fields as the original with all the sametriggers, constraints, ...
But when you create the columns, create them in order and create the new column when appropriate.
3. Copy the data to the new table.
4. Delete the old table.
This is the approximate procedure that the Enterprise Manager uses to do the same thing you are. This is so you can make a bunch of changes all at once. The EM won't commit the changes and create the new table until after you hit OK.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi Dave,
1. I tried the ALTER TABLE Invoice ADD COLUMN " & taxName.Text & " currency BEFORE <fieldname> ... but I got error on it, might be it not good for MS Access .mdb
2. I will try more but if all fail, I will try your suggested around way
Thanks for help
|
|
|
|
|
well, as far as DB stuff goes, theres really no reason to have them in a certain order. Just pull the information out of the DB when you query it in the order that you want. Other than that i'm not really sure how to add a column in a certain place. DB != Excel Spreadsheets :-P
|
|
|
|
|
i have a project where my application must catch all that a user is doing on the computer when a specified exe file is running.
exemple: Each time "calc.exe" is running, my application must run into background and an put in a file all that the user is doing.
can you help me please.
|
|
|
|