Jump to content
Xtreme .Net Talk

Meowsers

Members
  • Posts

    4
  • Joined

  • Last visited

Meowsers's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. Cool thanks for that info. Is there any funky way to find out the id's and correspoding commands for the API? I've hit another snag, the WinAmp thing is working fine now. But I'm having some issues with the MSN Messenger API (can u guess what I'm trying to do?). Anyhow, theres a snippit of code that looks something like this: hMsgrWnd = FindWindow("MSNHiddenWindowClass", vbNullString) hThread = GetWindowThreadProcessId(hMsgrWnd, 0) Call MSN.OptionsPages(0, MessengerAPI.__MIDL___MIDL_itf_msgrua_0000_0007.MOPT_GENERAL_PAGE) Do Call EnumThreadWindows(hThread, AddressOf EnumWindowsProc, 0) Loop While hOptionsWnd = 0 Do hTabWnd = FindWindowEx(hOptionsWnd, 0, "#32770", vbNullString) Loop While hTabWnd = 0 hEditWnd = FindWindowEx(hTabWnd, 0, "edit", vbNullString) hButtonWnd = FindWindowEx(hOptionsWnd, 0, "button", vbNullString) Call SendMessageByString(hEditWnd, WM_SETTEXT, 0, Value) Call SendMessageInteger(hButtonWnd, WM_KEYDOWN, VK_SPACE, 0) Call SendMessageInteger(hButtonWnd, WM_KEYUP, VK_SPACE, 0) with Public Function EnumWindowsProc(ByVal hwnd As Integer, ByVal lParam As Integer) As Boolean Dim sWndClass As String Dim lRet As Integer sWndClass = Space(255) lRet = GetClassName(hwnd, sWndClass, 255) sWndClass = Left(sWndClass, lRet) If sWndClass = "#32770" Then hOptionsWnd = hwnd Else EnumWindowsProc = True End If End Function and the other stuff that I think is like standard win32 commands. (I didn't write any of this) but what ends up happening is it works the first 2 or 3 times I run it, but after that it gets caught in that second Do... While loop forever. Oh the code is basically supposed to open a properties page, change a value, and close it. Sorry for the longness of the code. Also if its not too much trouble could I get a brief explanation of the code? I have a vague idea of whats happening but if someone could really explain it I would really appreciate it. Thanks Again. :) Oh, also. This is really strange. I've put in like a counter thing so the loop terminates after like 20 times if its not ending (into the loop that is sometimes infinite) anyhow, this is really strange. When I put a MsgBox inside that loop that shows the value it works even after the first few runs. . .sometimes. I have no explination, I can run it like 15 times and nothing will happen than I'll put a message box in and it'll work 75% of the time. I'm not used to such randomness arghhhh. :mad:
  2. Okie!! Thanks a lot man! Progress is going. . . slowly. But all thanks to YOU! :D :D . . . however here comes the enevitable. . but :confused:. Okay so I have the handle and I'm using integers, and it looks all pretty cuz I keep getting the same handle. So thats nice. And well. . . that's the end of the good news. Eh, where did u find out that the new WinAmp window name is STUDIO? I don't think I saw that anywhere. Are the messages sent using different id's too? Cuz well. . .I still can't get WinAmp to respond to my Call SendMessage functions. I'll keep trying a bit and update this if I have any sucess. Thanks again! :D . Hope to hear some more :p. Hmmm, further testing leads me to believe I have the right handle. But can't seem to do anything with it. All command messages I send do nuttin, and all queries give me goose egg. OMG! IT DID SOMETHING! I still can't get it to do any commands but I got the window title!! Very exciting times. Hmm this is really what I want but. . . I'm kinda curious so I'd like to know how to get the rest of the stuff worked out. So I dunno if I'm just still using out of date info or wat? Appreciate the help greatly! Shpank u.
  3. okie. This is the code that gets me a handle. Sitting in my module: Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String _ , ByVal lpWindowName As String) As Long Sitting in some on_click function: Dim WinAMPhWnd As Long WinAMPhWnd = FindWindow("Winamp v1.x", vbNullString) And then if I msgbox WinAMPhWnd I get a number, but if I use this: Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String _ , ByVal lpWindowName As String) As Integer with: Dim WinAMPhWnd As Integer WinAMPhWnd = FindWindow("Winamp v1.x", vbNullString) and try to msgbox the handle it gives me 0. Which I believe 'means' that there is no window with that name. But my winamp is running. Could this be a problem with the references? Or. . .? Thanks for your help. And the thing about different values, I had one WinAmp player going. And I had a button to get the handle each time I clicked it, but every time I clicked it (without doing anything to winamp) it gave me a different value. It seems to me like I shouldn't need a reference just to get a window handle, but I'm new so what do I know. Thanks again.
  4. Okie, I'm new to programming with API's and don't have a lot of experience in VB and almost none in VB.NET that being said. . . help. Okie, so I'm basically crawling through other peoples code thats similar to what I'm trying to do and then trying it out myself. But everyone elses code is in VB 6.0 and I'm trying to work in .NET, which might be causing my problems, or it might be other stuff I don't really know about. Okay so I'm starting off pretty basic, and I THINK I'm working with an API, cuz like I said I'm new at this whole thang and could be posting in the complete wrong forum. So, hope your still with me :P. Okay so all the code I've looked at is using the FindWindow function to get a reference to the window I want to refrance, ok fine. But their all returning Integers and when I try to get it as an int I get 0. However when I change it to return a Long I get a value. Another strange thing happens though I'm not sure if this is supposed to or not, but evertime I FindWindow with the same parameters I get a different value. I've tried working with the FindWindow on different programs and they work fine. I'm having issues with WinAmp. I guess I should probably also tell you that I'm not sure what references to add so I'm not using any. This may be the problem? This is probably a really dumb question so I'd really appreciate like some quick answer, thanks.
×
×
  • Create New...