Help - Search - Members - Calendar
Full Version: detecting input of phone number from keyboard
Skype Community > English > Development, Betas and Skype Garage > Skype Public API
vinnyc_
hi again,

i am looking to extract the number entered into the skype dialpad and the textbox next to the country code flag. i am doing this in c++.

currently, i can detect a change in the first number by looking for "CONTACTS FOCUSED +" in the incoming message from the skype api, but this won't detect any further changes in the textbox.

is there a message sent from the api which notifies programs of a change in these fields, or is there any command which can be sent to the api to get this information from skype?

thanks in advance,

vinny.
vinnyc_
i managed to solve this, but not exactly how i wanted it.

Function calls:
CODE
HWND hWndEditBox = NULL;



    EnumWindows((WNDENUMPROC)EnumWindowsProc, 0); // Find main Skype window

    EnumChildWindows(hWndEditBox,(WNDENUMPROC)EnumChildProc,0); // Find textbox handle



    if (!hWndEditBox)

    {

     // Skype is not running

     MessageBox("Skype must be running!", "Skype", MB_OK | MB_ICONERROR);

    }


first i look for the skype main window ("tSkMainForm.UnicodeClass") and store a handle to it.

CODE
//Call Back Function For EnumWindows handle of every window unless you make it

// false after you get to a certain handle etc

// param is anything you want it to be so you can work with it inside the function

BOOL __stdcall EnumWindowsProc(HWND hWnd, long lParam)

{

    char Buff[255], NameOfClass[255];



    GetWindowText(hWnd, Buff, 254);

    GetClassName(hWnd, NameOfClass, 254);



 // Convert the class name to a CString

 CString className;

 className = (CString)NameOfClass;



 // If we have found the Skype main window, break from the loop

 // and save the window handle

 if (className == "tSkMainForm.UnicodeClass")

 {

 hWndEditBox = hWnd; // Handle to the Skype main window



 return FALSE;

 }



    return TRUE;

}



next, the program passes the handle to the next function, which looks for the child edit box control ("TFilterbarEdit.UnicodeClass"). A handle to this control is also store.

CODE
// Similar to the function above, in that it cycles through all the child windows of

// the window handle passed into the function. Once the Phone number control is found

// on the Skype menu, we break from this function.

BOOL __stdcall EnumChildProc(HWND hwnd, long lParam)

{

 char Buff[255], NameOfClass[255];



    GetWindowText(hwnd, Buff, 254);

    GetClassName(hwnd, NameOfClass, 254);

   

 // Convert the child class name to a CString

 CString className;

 className = (CString)NameOfClass;



 // If we have found the Phone Number control, break from the loop

 // and save the handle to the control. We can use this handle to read the

 // text in the phone number box.

 if (className == "TFilterbarEdit.UnicodeClass")

 {

 hWndEditBox = hwnd; // Handle to the phone number text box control



 return FALSE;

 }



 return TRUE;

}


Finally, before making a call, just send the WM_GETTEXT message to the window.

CODE
char lP[255];



::SendMessage(hWndEditBox,WM_GETTEXT,254,(LPARAM)lP);



CString ExtractedNumber= (CString)lP;


this is probably common knowledge, but i thought it might be useful for anyone new to windows messages and/or skype like myself.

- vinny
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.