
CryoEnix
Avatar/Signature-
Posts
93 -
Joined
-
Last visited
Everything posted by CryoEnix
-
Hey all, I'm currently writing a VB.NET DLL to handle TCP sockets in the same way as the old VB6 WinSock control, to simplify it for myself. However, I've run into this error: "Access of shared member, constant member, enum member or nested type through an instance; qualifying expression will not be evaluated" The key code is below (a snippet from the class), and I've highlighted the line that causes the error. Public Event DataArrival(ByVal bytesTotal As Long) Private sck As System.Net.Sockets.TcpClient Private stream As System.Net.Sockets.NetworkStream Private newThread As System.Threading.Thread Public Sub New() sck = New System.Net.Sockets.TcpClient() stream = sck.GetStream newThread = New System.Threading.Thread(AddressOf listenSub) newThread.Priority = Threading.ThreadPriority.Normal newThread.Start() End Sub Private Sub listenSub() Do [color=Red]newThread.Sleep(200)[/color]'This is the problem! If stream.Length <> 0 Then RaiseEvent DataArrival(stream.Length) End If Loop End Sub [/Code] Now what that line is supposed to achieve is to pause the listening loop whilst checking for data being sent to the socket to avoid CPU burn. How do I fix this error, or is there a better way to implement this loop?
-
Thanks marble_eater, that was quite in-depth. However, I've solved the keydown/keyup problem by using directinput to detect the keys during the game loop. I'd advise anyone else to use this method to avoid the problem that I had.
-
By the look of it I think the keydown fire event id governed by the BIOS - as setting called 'Typematic somethingorother', If I remember correctly. Holding the direction-key and firing it with keydown will move the sprite a pixel, pause, then move it constantly - not unlike holding down a key in any text editor. I think the problem with my app is the timers I've been using - being generated instead of being drawn on a form might have missed something in the creation. I'll let you know when I have the results of my newly written timer class. Also, thanks for the game design tips with the one big loop - It'd probably be the best way to implement the game!
-
Cheers guys, I'll look into all of that right away!
-
Interesting - but is the keydown event is triggered at different speed intervals depending on the PC, or is it consistent? I don't want faster computers getting an advantage...
-
Here's the exact same project in VS 2003 - note that the same problem still occurs...
-
Hmm, that's a good point, Cags. Guess I shot myself in the foot with that one...
-
Hey guys - included here is the source code for a game I'm creating called 'Nukerz', a bomberman clone that I'm sure you're all familiar with. Anyhoo, the problem is with the timers I use to move the player around - they only seem to last for about a second before cutting out by themselves. Simply run the program and click the 'test' label, and wait a few seconds to initialize it. The controls use WASD. Please get back to me as to why the movement is staggered - I haven't even implemented collision detection yet, so I'm at a loss. Oh, the movement code resides in the 'Player' class! Thanks Nukerz.zip
-
The process.start method is used to create multithreaded applications, not to execute files. The command you are looking for is Shell(): Shell("IExplore.exe C:\Temp\myFile.txt") This should run internet explorer and throw the txt file in as an argument without any hassle. Note that it wouldn't work properly on my own machine, as I have Windows XP x64 so that I have both a 32- and 64- bit iexplorer - VB can't figure out which one to launch, thus it gives a 404 error. I think it would be safer to specify the explorer's full path if possible.
-
Hey guys, I'm thinking of writing a word game with VB.net, and was wondering what everybody else uses to check for valid words - is there a dictionary file out there to use, or perhaps a way of attaching the game to the MS word spellchecker? Just wondering as I don't feel like writing out the entire dictionary myself :( Thanks
-
Lol! That's pretty cool, the whole universe thing. Well, I'm off to finish the program with a nice 'Uber large Division' algorithm. Just hope I don't have to deal with many decimals...
-
Nonono, the module just returns the number as a string, to make its manipulation easier. I've managed to calculate 36 ^ 35 to: 2955204414547681244658707659790455381671329323051646976 I was surprised as to how fast VB actually calculated it - it's come a long way since VB6... Cags - I'm not sure when it comes to doubles, and I only needed the module to calculate whole numbers. The module works by breaking up the result into a manageable array before reassembling it as a string value - the answer can be a large as 32767 digits!
-
Erm, I've written the module now, but how the hell did you know it was 55 digits long? What's that algorithm? :eek:
-
The program is to dynamically create a keygen generator for my programs, to save doing it by hand each time - I just need to enter details such as whether I want it to be alphanumeric, numeric etc, how often the dashes are ("-") and how many chars long it is. The large number is for previewing the generated keygen, so I can see the possible combinations and the odds of someone guessing a correct serial. I'm trying to write a module that will return the result in a string form, but if one's already been written I feel it's better to ask than reinvent the wheel.
-
I'm currently writing a program that needs to calculate some very large numbers, the highest of which is (36 ^ 35). Although VB.NET can calculate this, the only variable it will fit in is a double, which always results in those horrid floating point numbers. Is there any way I can get an exact number for the answer in VB, for example by using a custom made (albeit massive) variable?
-
Cheers dude, that's good to know - thanks again!
-
Hey guys, long time no see. I'm just studying ASP in college at the moment, and it seems a little easier than PHP (going back to roots, I'm better with VB than Java!) - however, I was wondering whether ASP.NET was compatible with MySQL databases, or just Microsoft's own SQL? Additionally, I know both PHP and ASP are interpreted rather than compiled, but is there a significant performance difference between the two? Cheers peeps, CryoEnix
-
Cheers dude, I'll look into that right now.
-
Hey guys, I'm back with more irritating questions - once again, I've run into a brick wall with my manual VB.NET to Java program ports. This time, I'm trying to load an icon into a java object from a file - whether the icon is tied to the file in question (as in .exe files), or found through file associations (like the notepad icon on a .txt). In VB.NET this can be accomplished with the straightforward GetIcon() method, but is there an equivelant method/class in Java? Please help, or at least direct me to a good place to look on the net - google has finally failed me.
-
Cheers to the pair of you, I'll look into both strats now. Winner gets a muffin. Oh, and shelling the shutdown.exe? That's so simple it never even occurred to me...
-
Hey guys, I've been writing a program that does a specific task at a set time, and it can now execute files. However, I also need it to be able to shut down the PC too. I've written this before, but it only worked on win9x machines with VB6, and now I'm working with XP in VB.NET. Are there any ways to shut down the PC through .NET? And how might I go about this? I've googled, I've searched the forums, I've asked Satan himself. Can't seem to find anything. [Edit - forgot to subscribe. Duh.]
-
Hey peeps, long time no see! The title says it all really. I know I know, I've been using VB for about 4 or 5 years now, but I've never needed the things. Is there a built in function to intentionally round a float/double in a desired direction? I know I could mod by 1 and delete the result to round down, but since it's probably included in the IDE I thought I'd ask.
-
Cheers Wile, it works fine!
-
I know about the Kill() and RmDir functions, but RmDir only works if the folder is empty. Is there a special command to delete a folder, with contents or not?