//Function to handle folder type Favorite wyBool FavoriteBase::AddDirectory(HMENU hmenu, wyString & parentpath, wyWChar * filename) { HMENU hsubmenu; wyString path; wyInt32 menucount = 0; wyString filenamestr(filename); hsubmenu = ::CreatePopupMenu(); path.SetAs(parentpath); path.AddSprintf("%s\\", filenamestr.GetString()); VERIFY(::InsertMenu(hmenu, -1, MF_POPUP | MF_BYPOSITION | MF_STRING | MF_ENABLED, (LONG)hsubmenu, filename)); AddMenu(hsubmenu, path); // if the folder is empty then add <empty> as its submenu menucount = ::GetMenuItemCount(hsubmenu); if(menucount == 0) VERIFY(::InsertMenu(hsubmenu , -1 , MF_BYPOSITION | MF_STRING | MF_GRAYED ,IDM_EMPTY , L"<empty>")); return wyTrue; }
// Adds a file to the TFTP server, from C caller extern "C" int addTFTPFile(void * server, char* filename, unsigned int filenamelen, char* file, unsigned int filelen){ string filenamestr(filename,filenamelen); string filestr(file,filelen); ((TFTPserv*)server)->addFile(filenamestr,filestr); return 0; }