Jump to content
Xtreme .Net Talk

divil

*Gurus*
  • Posts

    3026
  • Joined

  • Last visited

Everything posted by divil

  1. I suspect he's trying to access stuff on frmMain from frmPopup. If he'd have searched this forum he'd have found this question is asked in various forms at least once a week. My preferred solution is to alter the constructor of the secondary form so it takes a reference to the first form as a parameter, which can be stored for whenever you need to access it. You could also set the tag of the secondary form to reference the first form after creating it, but that would mean you wouldn't be able to reference frmMain from the constructor.
  2. I don't think there are any advantages in using modules at all. Under the hood, your modules just get compiled as shared methods of classes anyway. I haven't used a module since the first time I broke out VB.NET.
  3. Tools -> Options -> Text Editor -> All Languages Uncheck "Hide advanced members"
  4. API calls, when being ported to VB.NET, often have to be changed. Wherever you see anything declared as a Long, you should change it to Integer. Often, when these Integers are handles to things, they should be IntPtr instead. As a rough guess, I have changed your API declarations and code to be as follows: Public Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As IntPtr Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As IntPtr, ByVal wMsg As Integer, ByVal wParam As Integer, ByVal lParam As Integer) As Integer Dim hwndWinamp As IntPtr Dim asdf As Integer Private Sub Timer1_Timer() hwndWinamp = FindWindow("Winamp v1.x", vbNullString) asdf = SendMessage(hwndWinamp, WM_USER, 0, 0) TextBox1.Text = asdf.ToString() End Sub I've also applied what Merrion said. I assume you have WM_USER declared somewhere with the correct value. If it still doesn't work, make sure you have Option Explicit AND Option Strict turned on, and tell us what error the compiler gives.
  5. They don't use legacy code, rather, they offer methods of doing things syntactically similar to the older VB6 ways. The namespace is only there to help the VB6 Project Upgrade Wizard upgrade those old projects without changing too much code. DON'T USE THEM! :)
  6. You can't change the contents of a collection while enumerating it. Instead, try something like this: Dim intIndex As Integer For intIndex = Panel1.Controls.Count - 1 To 0 Step -1 Panel1.Controls.Remove(Panel1.Controls(intIndex)) Next
  7. Sure. I charge £60/hr. Seriously, asking people to convert code for you is a bit much. You're much better off having a go yourself and asking specific questions when you get stuck.
  8. All you should have to do is read up on the System.Net.Sockets namespace in .NET, and read the SMTP RFC document.
  9. divil

    Parent Pid

    Processes don't really have parent processes...
  10. You may well be able to do it and things of this nature through WMI, which has classes under System.Management to help you.
  11. Closing the FileStream closes the StreamWriter implicitly.
  12. You'll have to ownerdraw the listbox. There are several articles floating around on doing this in .NET.
  13. Application.Run(new frmLoading()) Your application needs a Message Pump if it wants to keep running and processing messages.
  14. That would be a terrible way of doing it.
  15. divil

    some help please

    Learn the FTP protocol and use the Socket class to connect, set up the data connection and retreive a directory listing. I don't think there is an easier way to do it.
  16. Bucky, not Becky!
  17. ths: This is the VB.NET forum. Please don't post VB6 answers here. nibsy: System.IO.File.Exists(path)
  18. divil

    some help please

    No. System.Diagnostics.Process.Start()
  19. Use System.IO.Directory.GetFiles()
  20. VB.NET is very different to VB6. It appears you gave him a VB6 answer.
  21. Ideally, you'd run your intensive code in another thread anyway. DoEvents isn't really necessary.
  22. It's an event of the form, when in the code window select Base Class Events from the left-hand dropdown and Closing will be in the right-hand dropdown.
  23. I dunno, there's one line to open the file, one line to read a line from it, and one line to close it... not much difference really :)
×
×
  • Create New...