Okay, I am trying to something _extremely_ basic -- I'm trying to use the FindWindow() API to get the window handle for mIRC. Just seeing if I got the code right, I set up code that looks like this:
Public Class Form1
Public Declare Auto Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Public Declare Auto Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim lhWnd As Long
lhWnd = FindWindow("mIRC", vbNullString)
I have also tried
lhWnd = FindWindow(vbNullString, "mIRC")
to find the window handle by the exact caption. Regardless of what I do, I am constantly getting what seems to be a random 17-digit number. Every time I click the button, it's a different number. From what I understand, a window handle is not that long. Out of curiousity I entered a window caption that doesn't exist and got the same result.
I have referenced so many API writeups and _none_ of them seem to work right. I'm not sure what I'm omitting or doing wrong, but it has become extremely frustrating and I'm hoping someone can give me a hand
Ultimately, I want to write a program that will send text to a specific channel on mIRC. I'm nowhere near that though, because I'm still getting my ass kicked on the first step. :P Thanks.