Results 1 to 4 of 4

Thread: Threads?

  1. #1

    Threads?

    Hi guys.
    I'm a C++ programmer that started to program with Delphi, and have a few question..

    I don't know what happens, but sometimes, when executing my program, a nice and uggly screen called 'CPU' appears. It has a lot of assembly coding, and in front of it, a message dialog with 'access violation at 0xbff, etc'.

    I'm sure that my code is not wrong... And I think this problem is related to threads...

    I'm not using threads on my application, but it seems that a lot of components in delphi use it.

    When I execute my program, I have a few impression that after calling a function, the program doesn't wait until it finishs to return. The program returns, and continue executing the function on the background. And I think this cause the 'access violations' that I'm getting.

    Is there a way to avoid this?

    Thank you, and sorry for the bad english... (i'm brazillian).
    Fernando.

  2. #2

    Threads?

    Well, of course all programmers would never admit that there's something wrong with their code, but it looks just like it.
    Your problem may be thread-related, probably caused by one of the components you use (The components that come with Delphi are very reliable, so I guess you use 3rd-party components) or by your own code. Try to remove one component you use after the other to see which one causes the problem...
    Ask me about the xcess game development kit

  3. #3

    Threads?

    I looked at my code and found the function that is causing the error.

    It's SwapBuffers.

    When I call this function, sometimes the program crashes.

    I looked at the Borland Help and there they said:

    "A multithreaded application should flush the drawing commands in any other threads drawing to the same window before calling the SwapBuffers function."

    What this means in practice?
    Fernando

  4. #4

    Threads?

    Hi. I started another application because the other one had a lot of errors.
    Now, I want to construct everything in a right way.

    Changing the threads topic, I would like to know why the Window Handle is not available when we override the Create Method when creating new components. And if it's possible to have a Create method with a Handle already available.

    Thank you.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •