|
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.
|
|
|
|
|
Don't ask much, do you? What do you mean by "everything"? What do you want to log? The names of the buttons this person clicks on? Every keystroke the user types? Are you planning on playing this back so you can see everything the user did?
You're going to have to use a couple of system wide hooks to accomplish something like this. Read up on the CBT, JOURNALRECORD and JOURNALPLAYBACK hooks here[^].
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Good morning.
Maybe i asking for too much. Let's have it like to know every key the user types. Then how can i proceed.
Thank you for your link, but the process is difficult, and they don't have exemple for vb code use.
I don't know what you can do for me.
|
|
|
|
|
It doesn't get much easier. You're still hooking the system to catch the keystrokes. In VB6, this is very difficult. It gets easier in VB.NET, but you'll still have to either write a keyboard hook or a MessageFilter that you register with Application.AddMessageFilter.
There are example of this being done in VB.NET, but they are not specific to hooking the keyboard and you still need an in depth knowledge of Windows internals to udnerstand whats going on.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I have replaced most of the for loops with Array.Copy to mimic the functions of the dll call. But this did not have the speed increase that i was looking for. still same processor time at 100 for 3 seconds. I have also tried a few things like encrypting a 1.4 meg file with the 6.0 version of the blowfish program and it takes seconds. I try with the .Net conversion and it take around 10 minutes to do the same thing. Throughout the conversion of this 6.0 project i have had to make many sub procedures to mimic the function of this dll. I believe the extensive use of this procedures are what is slowing me down.
The function is pretty cool if i work in .net. I need an outside call to do some of the work for me because my app is straining a little to hard. I need something that does the same thing that the rtlMoveMemory does when you send it something like this
<br />
Public Declare Sub CopyMem Lib "kernel32" Alias "RtlMoveMemory" (Destination As Any, Source As Any, ByVal Length As Long)<br />
<br />
Dim LongValue as Long = 1415936116<br />
Dim BB() as Byte<br />
CopyMemory( BB(0), LongValue , 4)<br />
and what this does is turn this number into binary
looks like this BB(0) = 116 : BB(1) = 120 : BB(2) = 101 : BB(3) = 84 in the byte array. I also need a function that does this process in reverse. I had to mimic this with extensive for loops to check each bit. If i could find an outside call to do this same thing. I also found out if the value is greater than 2147483648 which is 2 ^ 31 and is also the highest value bit in a 32 bit number. the function causes the value to go negative and subtract any other amount that the bits equal preceding that last bit.
If there is any outside funtion can be used that would speed up my code. I really need to know because with the .net conversion that i am using now. If i didnt have a 6000 RPM Fan i would cook my P4 2.8 GHZ Processor. Oh yes a article on application throttling would be great too if anyone knows where i could read one.
|
|
|
|
|
Your not going to find an equivelnet function in the .NET Framework. This is because the execution environment is MANAGED. This means that any object can be picked up and moved AT ANY TIME without you knowing it. You could write managed code to get around this, but it would also take time to execute this extra code, again slowing your app down tremendously because you have to call the Marshaler to pin the object in place, do your memory copy, then unpin the object. Pinning is a notoriously slow process, just like calling into unmanaged code, because of the overhead of converting the object from managed to unmanaged and back.
As a side to your 2^31 bit problem. Use UInt32 data types instead of Int32's or Integers (same as Int32). UInt32 is an unsigned 32 bit integer, where Int32, or Integer, is a signed 32 bit integer. The 1 bit being used for the sign...
Sometimes converting code instruction-by-instruction is not the most efficient method. Sometimes you have to rewrite an entire function from scratch to accomplish the same thing...
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
hello
i currently got this error
\Form1.vb(34): Type 'AxMSWinsockLib.AxWinsock' is not defined.
The referenced component 'AxMSWinsockLib' could not be found. Could not load the type library. Library not registered.
what seem to be the problem?
i got the program from the my friend who say he have no problem running at his computer
i urgently need help cause this will effect my whole program/assigment
thank you in advance
Gary
|
|
|
|
|
You don't have the MSWinsock .DLL on your computer and regsitered. It's on his machine because he developed the application with the reference to it. He needs to supply you with the .DLL file, most likely winsock.dll , he used and any other .DLL files in the bin directory he got the finshed .EXE from. You then need to copy that .DLL into your C:\WINNT\System32 or C:\WINDOWS\System32 folder (WinNT or better), register the .DLL using REGSVR32 and the remaining .DLL's into the folder with your .EXE. Then your app should work.
Better yet! Tell him to make an Installer Project and add it his solution so you can install the application and any needed files.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
is there any way that i can do it without his help?
cause temporary now he is not around for me to contact him
can i download or install this .dll file from anywhere?
Gary
|
|
|
|
|
Another Windows machine... The problem you're going to run into is that you MUST get the version that was used to build the application. It's kind of odd that you don't have this .DLL. The other part of the problem is that you probably don't have the Interop .DLL that was generated when the application was built. Without that, you could get the correct WinSock.DLL, but still be unable to use it.
You might also have to have WSock32.DLL...
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|