Jump to content
Xtreme .Net Talk

Himo

Avatar/Signature
  • Posts

    61
  • Joined

  • Last visited

Everything posted by Himo

  1. I was bored and I made minesweeper in C#. I didn't see any games forum like on VBtalk so I thought, let's post it here. Maybe someone thinks it useful, although it isn't very high tech.minesweeper.zip
  2. Himo

    TV Tuning

    This excellent, and also in the language I'm the most proficient with. :) Thanks
  3. Himo

    TV Tuning

    Just brainstorming here: What the best way of programming a TV-tuner? Does any .Net language support this? What's better? DirectX(DirectShow) or ActiveX(MsVidCtl) Does anyone got some good links on this? Thank a lot for your thoughts!
  4. It's for a little game(more like a overrated threading test, it's better then having customers and provider as in the MSDN sample) and it uses the moving thread for the "hero" to move around while you can still check on data(like mouseclicks that reset certain things) [CS] PictureBox main = new PictureBox(); ArrayList objects = new ArrayList(); Thread moving; Keys keyholder; private void Form1_Load(object sender, System.EventArgs e) { this.Height = 600; this.Width = 800; main.Top = 50; main.Left = 50; Image test; String path = @"C:\Documents and Settings\stephan.van.hugten\My Documents\My Pictures\"; test = Image.FromFile(path + "happy.gif"); main.Image = test; main.Size = test.Size; this.Controls.Add(main); objects.Add(new PictureBox()); ((PictureBox)objects[0]).Top = 250; ((PictureBox)objects[0]).Left = 250; test = Image.FromFile(path + "House.jpg"); ((PictureBox)objects[0]).Image = test; ((PictureBox)objects[0]).Size = test.Size; this.Controls.Add((PictureBox)objects[0]); moving = new Thread(new ThreadStart(Run)); moving.Start(); } private void Form1_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e) { keyholder = e.KeyCode; Thread.Sleep(0); if(moving.ThreadState==ThreadState.Stopped) { moving = new Thread(new ThreadStart(Run)); moving.Start(); } e.Handled = true; } public void Run() { //Move me lad, move! } [/CS] (BTW: How do you do the C# code tags?) EDIT: Nvm
  5. I want it to loop, because the thread is gonna be up for a long time(few hours) and with active use the thread would be spawned every 5 seconds at least, increasing it's memory use by 12K each 5 seconds, leaving a hole of 8,5 mb of memory use. This may not seem to much, but I maybe want to make more threads, quickly making this a real issue...(or should I explicitly collect garbage?)
  6. But I think this doesn't solve the problem of the thread being stopped after one execution.
  7. It looks like you can't use it in it's standard form with VB .NET Maybe if you compile the .h file in to a .dll you can link it with your VB project and implement it. Not sure, never tried it.
  8. Unless you extend the Exception object... nope.
  9. Use the EnvDTE class, located in the EnvDTE reference(So you must add it) Then do this: EnvDTE.DTE dte; dte = (EnvDTE.DTE)System.Runtime.InteropServices.Marshal.GetActiveObject("Visualstudio.DTE.7.1"); Solution otherSolution; otherSolution = dte.Solution; otherSolution.SaveAs(SomewhereString); There you go ;)
  10. NOTE: This is a repost of Xtreme VB Talk, so that's why there are two posts Well, hello, I come by to post some C# sharp, so I'll just start of :) POST2: I'm declaring a form-wide thread, that I want to activate when there's a keystroke. It works perfectly the first time, but when the moving.Resume(); hits the second time, the MessageBox doesn't show up anymore. I think I'm making a fundamental error in my threading logic, but could someone point it out? Thread main; Private void Form1_Load(Object sender, System.EventArgs e) { moving = New Thread(New ThreadStart(Run)); moving.Start(); moving.Suspend(); } Private void Form1_KeyDown(Object sender, System.Windows.Forms.KeyEventArgs e) { Thread.Sleep(0); If(moving.ThreadState==ThreadState.Suspended) { moving.Resume(); } e.Handled = true; } Public void Run() { MessageBox.Show("Still running"); moving.Suspend(); } POST2: I found out that my thread was just stopped after execution But my question remains: How can I keep it running? I now have this solution: If(moving.ThreadState==ThreadState.Stopped) { moving = New Thread(New ThreadStart(Run)); moving.Start(); } But I guess that not too healthy for my overhead, while I'm waiting for the Garbage Collector to come by...
×
×
  • Create New...