cesky english
  Symbian   Travels
Symbian (Applications)

 The Wall
Symbian (Examples)

 LogToPC (SendAppUi)

Platform: Series 60 (Symbian)



Tested on: Siemens SX1, Nokia 3650

Should also work on: All Series60 devices.
(If you run this game on one of these phones please send me an email so I can mark this phone as supported.)


I decided to write this example to show how send some data (file) from a phone to another device (for example PC), because I quite frequently meet a questions (on various developer forums) about sending files through various means from phone to the PC or other phone. This can be done quite nicely using CSendAppUi class (part of MTM framework). What is necessary to know to use this approach? Well, not much. It can be done in pretty straightforward way and you can be completely oblivious about the MTMs.

So what it is possible to learn from the example?

  • use of SendUi for moving files to PC
  • use of some file system related stuff (list of files in a directory)

    First of all lets link our application against Sendui.lib (add this line to your .mmp file: "LIBRARY Sendui.lib").

    In our application two files must be included. The second one is quite interesting because it give you the access to standard resources like "Send" item in menu.

    #include <sendui.h>
    #include <sendnorm.rsg>

    And now we come to the magic itself. This is the heart of our application that will provides us with the ability to use standard menu for invoking "Send" functionality.

    void CSendLogToPC::DisplayMenuItemsL(TInt /*aResourceId*/, CEikMenuPane* aMenuPane)
    	if (!iSendUI)
    	iSendUI->DisplaySendMenuItemL(*aMenuPane, iFirstCommandID, TSendingCapabilities (0, 50000, 0));
    void CSendLogToPC::DisplayCascadeMenuItemsL(TInt aResourceId, CEikMenuPane* aMenuPane)
    	if (!iSendUI)
    	if ( aResourceId == R_SENDUI_MENU )

    It is pretty clear how it works so just one small comment about the mysterious TSendingCapabilities class. Few quotation from SDK's help

    IMPORT_C TSendingCapabilities (TInt aBodySize, TInt aMessageSize, TInt aFlags);
    enum TSendingFlags { 
      EAllMTMs = 0, ESupportsAttachments = 1, ESupportsBodyText = 2, ESupportsBioSending = 4, 
      ESupportsAttachmentsOrBodyText = 8 

    We will be able to send files no bigger than 50kB using any of the available MTMs, without any text or any other fancy stuff.

    Again let us look to the SDK documentation and see what it can offer to us for the last step: sending the file out of the device.

    virtual IMPORT_C void CSendAppUi::CreateAndSendMessageL  ( 
    	const TUid    aMtmUid,  
    	const CRichText *    aBodyText = NULL,  
    	MDesC16Array *    aAttachments = NULL,  
    	const TUid    aBioTypeUid = KNullUid,  
    	MDesC16Array *    aRealAddresses = NULL,  
    	MDesC16Array *    aAliases = NULL,  
    	TBool    aLaunchEmbedded = ETrue 
    )  [virtual] 

    Creates message to be sent and then calls corresponding mtm to edit the message.

    Parameters: aMtmUid: uid of the mtm aBodyText: pointer to body text to be added to message aAttachments: pointer to attachment array which includes file paths of the attachments to be added to the message aBioTypeUid: bio type uid aRealAddresses: pointer to the array which includes real addresses (in email's case real email addresses for ex: "my.address@host.com" aAliases: pointer to the array which includes alias names to be displayed in editor (in email's case for ex: "My name"). aLaunchEmbedded: ETrue if editor should be launched embedded. Otherwise editor is launched stand-alone.

    In our case the first and third parameter are the only once of any use. UID of the MTM will be passed to our application from the "Send" menu and the third is a list of files/attachments we want to transfer.

    iSendUI->CreateAndSendMessageL(aCommand, NULL, array);

    To get the proper Command IDs to our application we must add command to .hrh file. It is necessary to be aware of the fact that you need several "free" places after the "send" command. The reason is that they will be filled up by the values obtained from MTM framework.

    enum TLogToPCCommandIds
    	// you can place stuff before
    	ELogToPCCmdSendCommandID = 1
    	// you cannot place stuff immediately after it
    	// so lets start next command ID with value of "10"

    And that basically it is. When you run the application you should be able to send the file over to other devices using standard GUI and standard means of transportation that are supported by your device. The only drawback of this approach is that it works only in GUI applications. If you want to do it without user interaction (for example in .exe) you will have to devise some other (more complicated) way. I'd also like to point out that you cannot send files that are opened/in use.

    I tried to write the example as much simple as possible and also to don't break any "coding rules" for Symbian / Series 60 platform. But it is possible that you can find some problem with the example. In that case I'd really appreciate if you could send me an e-mail.

    design, programming: Tomas Kucera (2002)
    e-mail: sopta (at) post.cz, icq: 33297193
    last change: 2005/01/29