Pages

Monday, January 29, 2007

API Programming Lesson 1

I've begun to study the API Functions of VB6 alongside VB2005 Coding (OMG, it's gonna be tough :o ).

Notes from Lesson 1:

  • These are the basic functions of API : FindWindow, FindWindowEx, GetCursorPos, WindowFromPoint, GetClassName, GetWindowText, and SetWindowText (SendMessage could be the basic function too, but i have not studied about it. I'll write about it in lesson 2 :))
  • These are the basic functions which need buffer for storing the return value : GetClassName and GetWindowText (Does it mean that all API functions began with 'get' always need buffer ? I'll find the answer :))
  • FindWindow, FindWindowEx and WindowFromPoint will return the handlewindow (hWnd) of a window. If you know the class name, use FindWindow/FindWindowEx. If you don't know the class name, use WindowFromPoint instead.
  • FindWindow could be used to determined if a window was a parent or a child window. Just use it with a class name (class got by windowfrompoint function). If the return value is 0 then it's a child window and vice versa.
  • If you want to edit a window text with SetWindowText function individually, use hWnd generated by WindowFromPoint. If you want to set window text globally, use hwnd genereted by FindWindow-GetClassName instead (Still confusing me).

 

I think it's enough for today :) 

1 comment: