Implementing Windows System tray

From: ouj (ouj_at_aludra.usc.edu)
Date: 10/28/04

  • Next message: Bigdakine: "Re: BLT problem"
    Date: Thu, 28 Oct 2004 11:26:36 -0700
    
    

    First of all, I know that winico is there. The purpose of doing it myself
    is to help me to better understand the programming model of Tcl/Tk and
    compare them with Java. Also, it seems that winico follows different
    approach from mine for handling this issue.

    I developed a Java JNI class dealing with System tray on Windows myself.
    Now, I want to move my code from Java to Tk. Every thing is fine until the
    last step of my code requires the following loop.

    This loop is fine for Java since Java is multithreaded. Java won't wait
    for the completion of an command and continue to execute the other stuff.
    Thus, having such an event loop in JNI is fine for Java. However, Tcl/Tk
    is single-threaded by default. It seems to me that Tk uses some loops to
    handle its own messages. However, I have to deal with the event loops for
    the Windows system tray. Is there any way that I can add this message loop
    to the Tk's own event loop? Or is there any better solution for this
    kind of problems?

    Sincerely hope that some one can help me out. Thanks a lot in advance!

    Jingzhao

    ========================================
        MSG msg; BOOL bRet;
        // Start the message loop.
        while((bRet = GetMessage(&msg, NULL, 0, 0)) != 0)
        {
            if (bRet == -1)
            {
                // handle the error and possibly exit
            }
            else
            {
                TranslateMessage(&msg);
                DispatchMessage(&msg);
            }
        }
    ========================================


  • Next message: Bigdakine: "Re: BLT problem"

    Relevant Pages

    • Re: threads and GUIs
      ... idea to run things in a loop, currently instead iterations beyond the first are activated manually) would somehow waste memory. ... Java manages memory for you. ... Foo foo = new Foo; ... Java is optimized for short-lived objects, ...
      (comp.lang.java.programmer)
    • Re: StackOverflow Exception in JNI
      ... > I have a loop written in C/JNI which calls back a Java object (which ... temporary objects in your native method and then return a valid ... reference without thinking too much about these issues. ...
      (comp.lang.java.programmer)
    • Re: Challenge: Loop in Common Lisp and in Java
      ... > In the process of extending Linj (the Lisp to Java compiler) to support ... > the extended loop macro, I found some funny examples in Paul Dietz ANSI ... > challenges for the Common Lisp community. ...
      (comp.lang.lisp)
    • Re: Are there any Garbage Collector improvements?
      ... Foo foo = new Foo; ... loop so that it can be GCed by a minor collection instead of a major ... The referenced links explain it better than I probably can, but the key is that Java uses a generational garbage collector. ... Young generation collections are very fast, and object creation is blazingly fast. ...
      (comp.lang.java.programmer)
    • Re: for loop and index variable declaration
      ... specifying specific statements that are run at specific times. ... the loop may result in different things being left over in n when it's ... Java also doesn't like leaving behavior ... the results of these irrelevant choices by letting the variable go out ...
      (comp.lang.java.programmer)