
//How to show the smileyselection window:
//tip: to get a matching 'smileyicon' to use on the button, use 
//the service function 'getsmileyicon' to get for instance the ':)'
//Selected smiley is inserted in an edit with the REPLACESEL command
//You can let the service send a message to another window. LPARAM 
// is always a char* to the smileytext.

    SMADD_SHOWSEL smaddInfo;
    smaddInfo.cbSize = sizeof(SMADD_SHOWSEL);
    smaddInfo.hwndTarget = hTARGETEDITWINDOW;
    smaddInfo.targetMessage = EM_REPLACESEL;
    smaddInfo.targetWParam = TRUE;
    smaddInfo.Protocolname = "ICQ";
    smaddInfo.Direction = 0; //can be 0,1,2,3; four quadrants
    smaddInfo.xPosition = XPOSITION;
    smaddInfo.yPosition = YPOSITION;
    CallService(MS_SMILEYADD_SHOWSELECTION, 0, (LPARAM) &smaddInfo);


//How to replace smileys in a rich edit:

    CHARRANGE sel;
    sel.cpMin = FIRSTCHARPOSITION;
    sel.cpMax = LASTCHARPOSITION;
    SMADD_RICHEDIT2 smadd;
    smadd.cbSize = sizeof(SMADD_RICHEDIT2);
    smadd.hwndRichEditControl = hRICHEDIT;
    smadd.Protocolname = "ICQ";
    smadd.rangeToReplace = &sel;
    smadd.disableRedraw = TRUE;
    CallService(MS_SMILEYADD_REPLACESMILEYS, 0, (LPARAM)&smadd);


//How to compare for smileys:

    char buffer = ":-) Smiley here";
    SMADD_GETICON smadd;
    smadd.cbSize = sizeof(SMADD_GETICON);
    smadd.SmileySequence = &buffer;
    smadd.Protocolname = "ICQ";
    CallService(MS_SMILEYADD_GETSMILEYICON, 0, (LPARAM)&smadd);
    HICON smileyIconFound = smadd.SmileyIcon;  //will find the icon for ":-)"
    int smileyLenghtFound = smadd.Smileylength;  //will find 3
    

//How to get info for a smileypack:

    SMADD_INFO smadd;
    smadd.cbSize = sizeof(SMADD_INFO);
    smadd.Protocolname = "ICQ";
    CallService(MS_SMILEYADD_GETINFO, 0, (LPARAM)&smadd);
    HICON smileyIconFound = smadd.ButtonIcon;  //will find the icon for button, NULL on not def.
    //You can decide whether to display the button on the 'visiblecount' variable of SMADD_INFO 
   
    