Advertisement Jump to content
  • Advertisement

ed209

Member
  • Content Count

    121
  • Joined

  • Last visited

Community Reputation

122 Neutral

About ed209

  • Rank
    Member
  1. I finally got getjoyposex to work, but it isn't returning any of the joystick information, such as the x position or the buttons pressed. So i tried my code in vb 6.0 and it works fine! Why would my code work in vb 6.0 and not in vb.net? Public Class Form1 Public Const JOY_RETURNBUTTONS = &H80& Public Const JOY_RETURNCENTERED = &H400& Public Const JOY_RETURNPOV = &H40& Public Const JOY_RETURNR = &H8& Public Const JOY_RETURNU = &H10 Public Const JOY_RETURNV = &H20 Public Const JOY_RETURNX = &H1& Public Const JOY_RETURNY = &H2& Public Const JOY_RETURNZ = &H4& Public Const JOY_RETURNALL = (JOY_RETURNX Or JOY_RETURNY Or JOY_RETURNZ Or JOY_RETURNR Or JOY_RETURNU Or JOY_RETURNV Or JOY_RETURNPOV Or JOY_RETURNBUTTONS) Public Declare Function joyGetPosEx Lib "winmm.dll" (ByVal uJoyID As UInteger, ByRef pji As JOYINFOEX) As Integer Public Structure JOYINFOEX Dim dwSize As Long ' size of structure Dim dwFlags As Long ' flags to indicate what to return Dim dwXpos As Long ' x position Dim dwYpos As Long ' y position Dim dwZpos As Long ' z position Dim dwRpos As Long ' rudder/4th axis position Dim dwUpos As Long ' 5th axis position Dim dwVpos As Long ' 6th axis position Dim dwButtons As Long ' button states Dim dwButtonNumber As Long ' current button number pressed Dim dwPOV As Long ' point of view state Dim dwReserved1 As Long ' reserved for communication between winmm driver Dim dwReserved2 As Long ' reserved for future expansion End Structure Dim joy As JOYINFOEX Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick joy.dwSize = Len(joy) joy.dwFlags = JOY_RETURNALL joyGetPosEx(0, joy) Label2.Text = joy.dwXpos End Sub End Class
  2. Hi, and thanks for your response. I tried ID's 0-15 and all of them return 165 even when the joysticks show up in the joystick control panel.
  3. Hi, I'm trying to use joyGetPosEx to read the buttons pressed. First I use joyGetNumDevs to get the number of controls, but 81269371174928 is what is returned. Shouldn't it return the number of controllers? Also, joygetposex just returns 165, which also doesnt make sense. Could someone please tell me what I'm doing wrong?
  4. Using the PrintWindow API, I am trying to screen capture every window and then display the images in a picturebox in vb.net. But whenever the program runs, the taskbar disappears and parts of the windows disappear too. Could someone please explain to me why this is happening and what I can do to prevent it? [Edited by - ed209 on August 15, 2008 8:02:08 PM]
  5. Also, couldn't I get the name or ID or something of the controller and then check to see if it's turbo???
  6. Hi, I don't want people using turbo controller when playing my game, so I need a way of detecting them. One thing I thought of is that turbo controllers register in a pattern while human tapping is inconsistant. I was wondering if there is a better way of detecting turbo controllers. Thanks.
  7. Nah, cause I want to get the child windows from external programs too. Can someone PLEASE tell me what i'm doing wrong or test out my code?
  8. I'm trying to enumerate all the child windows of a window but none the the child window's handles are being listed! here is my code Public Class Form1 Declare Function EnumChildWindows Lib "user32" Alias "EnumChildWindows" (ByVal hWndParent As Long, ByVal lpEnumFunc As Long, ByVal lParam As Long) As Long Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" _ (ByVal lpClassName As String, ByVal lpWindowName As String) As Integer Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" _ (ByVal hwnd As Integer, ByVal wMsg As Integer, ByVal wParam As Integer, _ ByVal lParam As String) As Integer Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" _ (ByVal hWnd1 As Integer, ByVal hWnd2 As Integer, ByVal lpsz1 As String, _ ByVal lpsz2 As String) As Integer Const WM_GETTEXT As Long = &HD Const WM_GETTEXTLENGTH As Integer = &HE Const WM_SETTEXT = &HC Dim whwnd As Integer Dim hwnd_box As Integer Dim txt As String Dim j As Integer Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load whwnd = FindWindow(vbNullString, "Form1") EnumchildWindow(whwnd, 0) EnumChildWindows(whwnd, AddressOf EnumchildWindow, 0) End Sub Function EnumchildWindow(ByVal hChild As Long, ByVal lParam As Long) As Long txt = Space(256) j = SendMessage(hwnd_box, WM_GETTEXT, 255, txt) txt = Mid(txt, 1, j) TextBox1.Text += txt + vbNewLine EnumChildWindow = 1 End Function end class [Edited by - ed209 on August 11, 2008 9:06:19 AM]
  9. So as long as the game never comes out of synch, I can generate two random numbers?
  10. Thats what I was doing, but my goal is to make a nes emulator with multiplayer support. Are you telling me that I would have to do this with every randomly generated number if I was to make the emulator???
  11. I just created a pong game that uses random numbers to calculate where the ball is travelling. Problem is is that when I have a server and a client, they will have two different random numbers. Whats the ebst way to have it so that they both the server and the client generate the same random numbers?
  12. When the player presses the left or right key, the character moves 3 points horizontally. When the player presses up or down, the character moves 3 points vertically. How do I figure out how many points horizonally and vertically a player moves when moving diagonally???
  13. Still not sending or receiving. Could you try out my code???
  14. Hi, I'm trying to use streamreader and streamwriter to get the data sent and received. For some reason the data isn't sending or receiving and I was hoping someone could show me what I'm doing wrong.. Server Imports System.Net.Sockets Imports System.Text Imports System.Threading Imports System.IO Imports System.Net Module Module1 Dim tcpListener As New TcpListener(6996) Dim tcpclient As TcpClient Dim networkStream As NetworkStream Dim connection As Socket Dim writer As BinaryWriter Dim reader As BinaryReader dim connected as boolean=true Sub Main() tcpListener.Start() Console.WriteLine("Waiting for connection...") Try tcpclient = tcpListener.AcceptTcpClient() Console.WriteLine("Connection accepted.") connection = tcpListener.AcceptSocket networkStream = New NetworkStream(connection) writer = New BinaryWriter(networkStream) reader = New BinaryReader(networkStream) writer.Write("Hello, Washington!!!") Catch e As Exception Console.WriteLine(e.ToString()) End Try End Sub Sub read() While connected = True Dim clientdata As String clientdata = reader.ReadString() Console.WriteLine((clientdata)) End While End Sub End Module Client Imports System Imports System.Net Imports System.Net.Sockets Imports System.IO Module Module1 Sub Main() Using client As New TcpClient() Console.WriteLine("Attempting to connect to the server ", "on port 8000.") client.Connect(IPAddress.Parse("68.248.3.155"), 6996) Using networkStream As NetworkStream = client.GetStream() Using writer As New BinaryWriter(networkStream) writer.Write("info") Using reader As New BinaryReader(networkStream) Console.WriteLine(reader.ReadString()) End Using End Using End Using End Using End Sub End Module Thanks.
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!