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. Form instances

Form instances

Scheduled Pinned Locked Moved Mobile
questiondatabaseperformance
3 Posts 3 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.
  • B Offline
    B Offline
    Blue_Boy
    wrote on last edited by
    #1

    When I run application on PPC,forms draws itself in memory how many times I open it, if I open twice one form it draw itself in memory as two instances. How can I let the application to draw form only single time?


    I Love SQL

    C S 2 Replies Last reply
    0
    • B Blue_Boy

      When I run application on PPC,forms draws itself in memory how many times I open it, if I open twice one form it draw itself in memory as two instances. How can I let the application to draw form only single time?


      I Love SQL

      C Offline
      C Offline
      Christopher Fairbairn
      wrote on last edited by
      #2

      What development environment are you creating your application in? Typically the template/wizard code for your environment (with Visual Studio atleast) will have inserted code which restricts your application to one instance. You may like to read the following thread on the MSDN Forums website (where the opposite problem is discussed, i.e. how to allow multiple instances) - http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1576750&SiteID=1[^] Basically in the WinMain method of your application you should put some code similiar to the following: //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; } The call to find window is used to detect the existing copy of your application based upon it's window class and window title. Just alter the two arguments to match that of your application's main window. Hope it helps, Christopher Fairbairn

      1 Reply Last reply
      0
      • B Blue_Boy

        When I run application on PPC,forms draws itself in memory how many times I open it, if I open twice one form it draw itself in memory as two instances. How can I let the application to draw form only single time?


        I Love SQL

        S Offline
        S Offline
        Soleil couchant
        wrote on last edited by
        #3

        Try using showDialog() to open up the form. This shows the form as a modal dialog box with the currently active window set as its owner. The form being opened will show only once then, I think..

        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