Jump to content
Xtreme .Net Talk

Himo

Avatar/Signature
  • Posts

    61
  • Joined

  • Last visited

Everything posted by Himo

  1. Other ways are: Using the Convert class en typecasting (using (int)StringS )
  2. Try this one to activate the old API's in your program: Note: This is C#, may need a lil' changing to work in VB .net, but only very minor using System.Runtime.InteropServices; [DllImport("USER32.DLL", EntryPoint="PostMessageW", SetLastError=true, CharSet=CharSet.Unicode, ExactSpelling=true, CallingConvention=CallingConvention.StdCall)] public static extern bool PostMessage(int hwnd, int Msg, int wParam, int lParam); [DllImport("USER32.DLL", EntryPoint="SendMessageW", SetLastError=true, CharSet=CharSet.Unicode, ExactSpelling=true, CallingConvention=CallingConvention.StdCall)] public static extern bool SendMessage(int hwnd, int Msg, int wParam, int lParam); And a nice library with all the message constants is attached ;) Messages.zip
  3. Himo

    Sudoku

    I'm trying to make a sudoku (http://www.sudoku.com) puzzle generator, but I've got some problems. After 1-2 or two rows he starts to generates rows that aren't valid in the end and the program gets stuck. Anyone got an idea on making a check for this that's still pretty fast? The rules of the game are also explained below in the function for generating the puzzles. [CS] private void InitPuzzle() { //Rules: //Each row must contain the digits 1-9 //And each square must contain the digits 1-9 //No duplicate values in a row or square //thus applies: (x; x E 1-9 ; COUNT(x in Row && Square) = 1); Random a = new Random(); int number = 0; bool valid = false; int[,] row = new int[1,9];//horizontal rows int[,] vertrow = new int[9,1];//vertical rows int[,] square = new int[3,3];//square //x = rows //y = colums for(int x = 0; x < 3; x++) { for(int y = 0; y < 6; y++) { for(int rowx = 0; rowx < 9; rowx++) row[0,rowx] = Convert.ToInt32(tiles[x,rowx].Text); for(int rowy = 0; rowy < 9; rowy++) vertrow[rowy,0] = Convert.ToInt32(tiles[rowy,y].Text); if(y % 3 == 0) { for(int sqrx = 0; sqrx < 3; sqrx++) for(int sqry = 0; sqry < 3; sqry++) { if(x % 2 == 0 && x != 0) square[sqrx,sqry] = Convert.ToInt32(tiles[(x-2)+sqrx,y+sqry].Text); if((x+1) % 2 == 0) square[sqrx,sqry] = Convert.ToInt32(tiles[(x-1)+sqrx,y+sqry].Text); if(x % 3 == 0) square[sqrx,sqry] = Convert.ToInt32(tiles[x+sqrx,y+sqry].Text); } } while(!valid) { number = a.Next(1,10); //Number is not in this row for(int rowx = 0; rowx < 9; rowx++) { if(number!=row[0,rowx]) valid=true; else { valid=false; rowx = 9; } } //Number is not in this square if(valid) { for(int sqrx = 0; sqrx < 3; sqrx++) for(int sqry = 0; sqry < 3; sqry++) { if(number!=square[sqrx,sqry]) valid=true; else { valid=false; sqry = 3; sqrx = 3; } } } //Number is not in this vertical row if(valid) { for(int rowy = 0; rowy < 9; rowy++) { if(number!=vertrow[rowy,0]) valid=true; else { valid=false; rowy = 9; } } } //Then it's a valid number if(valid) tiles[x,y].Text = number.ToString(); } valid = false; } valid = false; } } [/CS]
  4. Himo

    Timeout error

    *bumps the topic*
  5. Himo

    Timeout error

    [CS] for(int i = 0; i <= 31; i++ ) { for(int idx=0;idx<16;idx++) { for(int idx2=0;idx2<=i;idx2++) { cookie = //some datatests buffer = "HEAD /PATH HTTP/1.1\r\n"; // buffer += "Host: SERVER\r\n"; buffer += "Cookie: " + cookie + "\r\n"; buffer += "Connection: close\r\n"; buffer += "\r\n"; buffer2 = Encoding.ASCII.GetBytes(buffer); s.Send(buffer2,buffer2.Length,0); //Error above @ s.Send() <-- int counter = 1; while (counter > 0) { counter = s.Receive(bytes, bytes.Length, 0); header = header + Encoding.ASCII.GetString(bytes, 0, counter); } if(header.IndexOf("LOCATION\r\n",0,header.Length) == -1) { //Do Stuff } } } //Reset stuff } [/CS]
  6. Hi, I'm using WinSock in C# to send some data to a server(duh). The problem is that I have a loop that does some things other then sending data. After some time, about 10-15 times sending, I get this error: An established connection was aborted by the software in your host machine How can I work around this? I know that it probably has something to do with timeouts, but where can I change those settings?
  7. I drop the question. I just threw away everything I had and started over. Now I'll just make an offline application with a connection to a mysql database online. Suits my needs fine and is much easier :D
  8. And more questions piling up. What about animation? Dear god, this is difficult...
  9. @ the mouse problem: I tried with the API GetCursorPos, but it does only return 0,0 while it executes perfect...
  10. :o Because my VB proficiency is way lower than my C# proficiency
  11. Hello, I'm using this code to put a bitmap up the site, I want to center this bitmap, but the code prerequisites prevent me from doing so. If I don't put the response.clear in the Paint method, then the picture shows up as a bunch of gibber. Any tips on this? BTW: How could I make this script that the circle is placed where the mouse clicks? [CS] private void Page_Load(object sender, System.EventArgs e) { // Put user code to initialize the page here Response.Write(Request.QueryString.Get("Username")); Response.Write("<br><br><center>"); Paint(); Response.Write("Midden</center>End"); } private void Paint() { Response.Clear(); Bitmap field = new Bitmap(640,480); System.Drawing.Graphics webpage = Graphics.FromImage(field); webpage.DrawEllipse(new Pen(Color.Blue,1),40,40,40,40); field.Save(Response.OutputStream,System.Drawing.Imaging.ImageFormat.Jpeg); webpage.Dispose(); field.Dispose(); Response.Flush(); }[/CS]
  12. But problem no. 1 here: From my point of view davearia uses VB .net, that doesn't allow typecasting. Away solution...
  13. Delphi only needs the .net framework to be installed. All other Local resources are compiled within the .exe. If you're using special calls to other dll's and programs, they need to be installed too.
  14. I don't think it would be possible. You could never deceive the compiler in using a field for a class constructor. I would put my hope into a Switch statement and just call the constructors with the parameters from the database.
  15. 2 questions then: 1) WebDAV? 2) How could I configure SQL Server then correctly to do this? I couldn't figure out the hostname, since he wouldn't take 'localhost'. Thank you very much already :)
  16. I want to access an MS access database on my localhost, but when I'm using this connection string: String sConnString = "Driver={MS Access Driver (*.mdb)};Dbq=http://localhost/WebApplication1/bin/users.mdb;"; It just won't work, saying: Invalid filename What could I do about it?
  17. You must make sure that computer3 can log on computer2, else it will be denied access. This is done in the IIS Admin screen in the control panel. Just select the directory and directory security, click edit. Also make sure the rights on the directory include read and execute scripting.
  18. It's just for learning, so it may be a bit working around. Thanks again :) I was just looking for that. I put all the constants in a public class, so I can easily access them.
  19. I got this to work, but now I'm wondering. In C++ you could just include windows.h to have all the WM message constants at hand. But how is this done in C# or VB for that matter? When opening windows.h I saw nothing more than a bunch of more includes, so I kinda stopped looking after searching for WinMessages and WM.
  20. That sounds familiar, I already did this in Visual C++ 6 at school, but wanted to do this in .Net. Thanks :D
  21. I'm trying to intercept the WM messages that windows sends to my application. I thought the Messaging Queue was a good lead to begin, but it's not installed/working. BTW: Messaging service is running
  22. I want to work with Windows Message and I began programming, but then at runtime I got the following error: "Message Queuing has not been installed on this computer" What should I do about this? I've got VS 2003 Academic(Professional in some ways) edition Or is this not the way to intercept WM messages?
  23. Microsoft Crash Analyses concluded that 75% of the hangups were caused by drivers, where 50% came from ATI drivers. 'nuf said...
  24. ATI Drivers just suck. I got a 9600 and boy it hangs quite a bit, next time I'm going for the GForce cards.
  25. But, could we get a coloured syntax C# code tag? It would be appreciated :)
×
×
  • Create New...