Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Mobile Development
  3. Mobile
  4. Singelton CF Apps

Singelton CF Apps

Scheduled Pinned Locked Moved Mobile
tutorialquestion
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    RB Emphasys
    wrote on last edited by
    #1

    Hello Everyone, I've searched some posts and articles, and I can't seem to find a good example of making a cf app single instance only. I see that some posts use various Mutex classes that are not fully featured in the cf. Has anyone come across a solution to this? Thanks, Ryan

    G 1 Reply Last reply
    0
    • R RB Emphasys

      Hello Everyone, I've searched some posts and articles, and I can't seem to find a good example of making a cf app single instance only. I see that some posts use various Mutex classes that are not fully featured in the cf. Has anyone come across a solution to this? Thanks, Ryan

      G Offline
      G Offline
      Giannakakis Kostas
      wrote on last edited by
      #2

      I think that OpenNetCF has a named mutex implementation that can be used across different processes, but I am not sure about it. The most common solution is to check if a Window is already present and not start a new process: [DllImport("coredll.dll", EntryPoint="FindWindow")] private static extern IntPtr FindWindow(string lpClassName,string lpWindowName); [DllImport("coredll.dll")] private static extern int SetForegroundWindow(IntPtr hWnd); [MTAThread] static void Main(string [] args) { string windowName = "MyForm"; IntPtr window = FindWindow(windowName); if (window == IntPtr.Zero) { Application.Run(new MainForm(windowName)); } else { SetForegroundWindow(window); } } This is not a bullet proof solution, but it works.

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups