Windows Mobile Developer Center > Smart Device Development Forums > Windows Marketplace for Mobile > New Document: Application Submission Requirements for Windows® Marketplace for Mobile
Ask a questionAsk a question
 

LockedNew Document: Application Submission Requirements for Windows® Marketplace for Mobile

Locked

All Replies

  • Thursday, June 25, 2009 9:19 PMMal Loth Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Those requirement seem to be much more reasonable then the previous one :).
    Thanks for the info, Joel.

    BTW. How it is that they point towards that DVD which we can order and is for WM6 devices.
    On MS page they don't write that this DVD has any WM6.5 related content, while in this document You provided it seems that on that DVD there are a lot of useful info. Is it new edition or what? What do You think?
    If You'll find my answer satisfactory or helpful - mark it as answered! Thank You. PS. Votes also doesn't hurt :).
  • Sunday, June 28, 2009 3:28 PMdayjur Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Thanks Joel, you see this is the kind of thing Microsoft should be doing communicating via email to those who have paid the sign up fee for marketplace, me like many others have heard nothing from Microsoft since sign up apart from navigating in ones web browser and comming on here.

    Anyways reading the docs I see they require a single instance of the app only to be run, but isnnt this default under Windows Mobile under Windows  you can check the box 'make single instance' in Visual Studio project properties
    I do not see this under smart device development, besides when you start your app in windows mobile and try to fire it up again it simply 'brings to front' the app thats already running

    Am I missing something ?
  • Sunday, June 28, 2009 4:08 PMMal Loth Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    You can make it via using CreateMutexEx with constant name like "My App" and checking for the last error in Program.cs.
    If last error is ERROR_ALREADY_EXISTS, just do Application.Exit. Else Run(new MainForm());.
    Easy as it sounds, but MS didn't implement it anywhere and they require it to be for their Marketplace ::aplause::.
    I suppose that about 70% of apps won't have this feature, unless MS will add proper example to it's documentation.

    If You'll find my answer satisfactory or helpful - mark it as answered! Thank You. PS. Votes also doesn't hurt :).
  • Sunday, June 28, 2009 5:15 PMJoel Ivory Johnson Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Anyways reading the docs I see they require a single instance of the app only to be run, but isnnt this default under Windows Mobile under Windows...Am I missing something ?

    It's a default behaviour if the application window has already been created.  But there are scenarios in which an application is started multiple times in a very short period of time.  In this scenario you could end up with multiply instances of the application which are not able to detect each other since their interface has not started up.  The end result is multiple instance of the application.

    Named objects are usually used as a tool to ensure only one instance exists.  Mal Loth has given the example of the Mutex named object being used in this context.  If you would like an expanded explanation and demonstration of a scenario in which multiple instances can be invoked you can see this Microsoft video with example code:

    http://msdn.microsoft.com/en-us/windowsmobile/bb943002.aspx
    Joel Ivory Johnson
  • Monday, June 29, 2009 2:54 PMSeva Alekseyev Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Has Code
    Named mutex, like everyone said. If the application finds out that another instance is already running, then it's a good practice to find the window of the other instance and activate it. In native C, it goes like this:

     

    int WINAPI _WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,LPTSTR lpCmdLine, int nCmdShow)
    {
        HANDLE hMu = CreateMutex(0, 0, L"MyApplicationRunOnce");
        if(GetLastError() == ERROR_ALREADY_EXISTS)
        {
            HWND hw;
            if(hw = FindWindow(0, L"MyApplicationWindowTitle"))
                SetForegroundWindow((HWND)((DWORD)hw | 1));
    CloseHandle(hMu); return 0; } //...
    CloseHandle(hMu); }

     

     

  • Monday, June 29, 2009 5:26 PMSteve BellMSFT, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    Joel, Mal, Dayjur and Seva - I'm very glad to see that you feel the requirements are an improvement over the previous draft. A considerable amount of time was spent in analyzing developer feedback and other data to arrive at the achievable requirements we have today.

    Thanks again.

    - Steve


    Senior Product Manager - Microsoft
  • Tuesday, June 30, 2009 2:49 PMjpapayan Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Thank you for the link Joel, much appreciated.

    Just another question though. The example given in the presentation works as intended as long as the application terminates normally. Unfortunately, when I use the task manager to kill the application, the resources aren't deallocated and I can no more launch the app (unless I reboot). Is there a way to detect and respond to the "kill" signal before my app terminates?
  • Tuesday, June 30, 2009 2:58 PMMal Loth Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Has Code
    This class works in every exit case - TaskManager, reset, Application.Exit, this.Close etc.

    public class SingleInstance
    {
    	private const int ERROR_ALREADY_EXISTS = 183;
    
    	[DllImport("coredll.dll", EntryPoint="GetLastError")]
    	private static extern int GetLastError();
    
    	[DllImport("coredll.dll", EntryPoint="CreateMutexW")]		
    	private static extern int CreateMutex(IntPtr lpMutexAttributes, bool InitialOwner, string MutexName);
    		
    	public static bool IsInstanceRunning()	
    	{
    		GetLastError(); // zerowanie innych błędów
    		CreateMutex(IntPtr.Zero, true, "MyApp");
    		int errNr = GetLastError();
    
    		return (errNr == ERROR_ALREADY_EXISTS);
    	}
    }
    

    You should use it in Program.cs like this:

    static class Program
    {
    	[MTAThread]
            static void Main(string[] args)
    	{
    		bool isAlreadyRunning = SingleInstance.IsInstanceRunning();
    
    		if(!isAlreadyRunning) Application.Run(new MainForm());
    		else Application.Exit();
    	}
    }
    

    And go with God :).

    If You'll find my answer satisfactory or helpful - mark it as answered! Thank You. PS. Votes also doesn't hurt :).
  • Tuesday, June 30, 2009 4:35 PMjpapayan Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Has Code
    Hmm,

    You are using a mutex so you rely on WM auto-releasing the mutex in any type of process termination. Sounds good! :-)
    Just to let you know though, the guy from the above presentation mentioned that you should not check for a given error as you do in
    return
     (errNr == ERROR_ALREADY_EXISTS);
    He said something about WM not always returning ERROR_ALREADY_EXISTS. In rare cases, he said, it is possible that another error code is returned. So instead, he suggested going for GetLastError()!=0.

    Thanks for the reply!
  • Tuesday, June 30, 2009 5:37 PMSeva Alekseyev Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    Doesn't the OS kernel close the object handles when the process dies? That's how was is in the NT kernel, last time I checked...

  • Wednesday, July 01, 2009 12:00 PMMal Loth Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Yes, normally as You said "in rare cases it is possible that another error code is returned".
    But... :) that's why I use GetLastError two times. First - zeroes all possible errors, so that second always gets the proper one.
    If You'll find my answer satisfactory or helpful - mark it as answered! Thank You. PS. Votes also doesn't hurt :).
  • Wednesday, July 01, 2009 4:21 PMReed RobisonMSFT, AnswererUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    Joel is right on.  Under normal conditions you should *not* have to write extra code to deal with enforcing a single instance of an application on Windows Mobile.  For managed code, the Compact Framework typically handles this for you and when you create any new smart device project in C++ the following code is added to InitInstance which activates the previous instance and terminates the current one:

     

      //If it is already running, then focus on the window, and exit

        hWnd = FindWindow(szWindowClass, szTitle); 

        if (hWnd)

        {

            // set focus to foremost child window

            // The "| 0x00000001" is used to bring any owned windows to the foreground and

            // activate them.

            SetForegroundWindow((HWND)((ULONG) hWnd | 0x00000001));

            return 0;

        }

     

    There are some rare scenarios where you can end up with multiple instance of NETCF apps running.  If you run into those, you might find yourself writing code to enforce single instance startup.  If you do, check out Jim's video and also

    http://blog.opennetcf.com/afeinman/PermaLink,guid,ec034858-e071-4daa-b1be-0323b7f54b11.aspx

     

    Cheers,

    Reed

  • Wednesday, July 01, 2009 9:32 PMjpapayan Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Another question, about the Hopper test this time.
    The updated guidelines mention:

    "There is a new version of Hopper for Windows Mobile 6.5 which also runs on Windows Mobile 6.0 and 6.1. The required Hopper version is 2.0.24.7025, created May 28, 2009. The Hopper utility for Windows Mobile 6.0, 6.1 and 6.5 is available in the Windows Mobile 6.5 Developer Resource Kit located here."

    The problem is that the current Hopper version included in the WM6.0 SDK is much older, Hop 2.0.15.7472. The link provided is irrelevant and outdated:
    http://msdn.microsoft.com/en-us/windowsmobile/bb264329.aspx
    The WM6.5 Developer Toolkit doesn't seem to contain any Hopper folder and google doesn't help either.

    Any ideas?!










  • Wednesday, July 01, 2009 9:34 PMJoel Ivory Johnson Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    It might be better to create a new thread instead of adding a new question to this one.  You are going to get lower visibility for your question in this thread since the thread's topic is set to be about a new document and this thread isn't flagged as a question.
    Joel Ivory Johnson
  • Wednesday, July 01, 2009 9:41 PMjpapayan Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Yep, you are right. Still though, this question is directly relates to the aforementioned document so it's more of a clarification to the information contained in it. In any case, I won't be offended if a moderator decides otherwise..! ;-)
  • Friday, July 17, 2009 6:18 AMjaybo_nomad Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    I second the comment above about being dead in the water until Hopper version 2.0.24.7025, (created May 28, 2009) for WM6.5 is available for download.  This doesn't seem to be available anywhere, yet is a requirement for AppStore testing.

    Older versions of Hopper just seem to do nothing on WM6.5 (at least on a 6.5 emulator).

  • Tuesday, July 21, 2009 12:21 AMSteve BellMSFT, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    Publishing Hopper for Windows Mobile 6.5 is my top priority. I will create a new post in the forum once Hopper is available for download.

    Thanks.

    - Steve


    Senior Product Manager - Microsoft
  • Wednesday, July 22, 2009 10:34 PMSteve BellMSFT, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    Great news. The second version of the Application Submission Requirements for Windows® Marketplace for Mobile, version 1.1, is now live at - https://developer.windowsmobile.com/resources/en-US/Application%20Submission%20Guidelines.pdf

    The document details the requirements Windows Mobile 6.0, 6.1, 6.5 applications and Widgets need to meet in order to pass certification. Only applications that pass certification will be listed in the Windows Marketplace. The main difference between this document and version 1.0 are the references to test cases applying to Windows Mobile 6.0 and 6.1.

    The requirements document is also the primary resource to use in your application development and test cycles to help ensure your applications will pass Windows Marketplace certification testing quicker and with less resource investment. Now is the perfect time to review the requirements to get your Windows Mobile 6.0, 6.1, 6.5 applications and Widgets ready for Windows Marketplace submission beginning July 27, 2009.

    Thanks.

    - Steve


    Senior Product Manager - Microsoft
  • Thursday, July 30, 2009 6:44 PMJoel Ivory Johnson Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals