تبلیغات :
ماهان سرور
آکوستیک ، فوم شانه تخم مرغی ، پنل صداگیر ، یونولیت
دستگاه جوجه کشی حرفه ای
فروش آنلاین لباس کودک
خرید فالوور ایرانی
خرید فالوور اینستاگرام
خرید ممبر تلگرام

[ + افزودن آگهی متنی جدید ]




نمايش نتايج 1 به 8 از 8

نام تاپيک: تابع Doevents ؟

  1. #1
    داره خودمونی میشه Hamid_pro's Avatar
    تاريخ عضويت
    Mar 2006
    پست ها
    156

    پيش فرض تابع Doevents ؟

    کسی ميتونه بهم بگه تابع doevents چيکار ميکنه؟

  2. #2
    در آغاز فعالیت
    تاريخ عضويت
    Jan 2006
    پست ها
    14

    پيش فرض

    این مثال توضیح بسیار خوبی از این فانکشن عالی هست. امیدوارم کمکی کند !
    Do You DoEvents?

    Lots of programmers don't even know about Visual Basic's DoEvents function. This is not surprising because few Visual Basic programs need it. DoEvents returns control to the operating system temporarily, allowing it to process other events that may have occurred. In my experience, the only time DoEvents is needed is when a program has code that takes a long time to execute, such as certain complex mathematical calculations. By calling DoEvents at strategic locations in your code you can improve program responsiveness.

    To see what I mean, create a Standard EXE project in Visual Basic and place one CommandButton and one TextBox on the form. Then, put the following code in the Command Button's Click event procedure:

    کد:
    برای مشاهده محتوا ، لطفا وارد شوید یا ثبت نام کنید
    You can see that the code has one loop within another, loops that will take a few seconds to complete (You may want to adjust the value that the inner loop counts to depending on the speed of your system). Each time the outer loop iterates, the current value of i is displayed in the text box. When the loops are finished, "done" is displayed.

    What actually happens when you run the program, however, is that the text box does not change until "done" is displayed. The problem is that the system was so busy executing the loops that the requests to display i in the text box got stalled in Windows queue. When the loops were finished, all these requests were processed, too quickly for you to see on the screen.

    Now, place a call to DoEvents in the code, just after the Text1.Text = i statement. When you run the program you will see that the text box "counts up" the values of i, just as you would expect. Calling DoEvents frees up the system to process the request, then returns control to the Visual Basic program.

    DoEvents is not without potential problems. For example, if you call DoEvents from a procedure you must be sure that the same procedure cannot be called again before execution returns from the first call - otherwise unpredictable results may occur. Likewise, DoEvents should be avoided if other applications could interact with the procedure in unforeseen ways. Use of a Timer control or isolation of long-running code in an ActiveX component are two other approaches to improving program responsiveness.

  3. #3
    اگه نباشه جاش خالی می مونه whisper's Avatar
    تاريخ عضويت
    Dec 2006
    پست ها
    295

    پيش فرض

    دوستان میشه یه خورده واضح تر توضیح بدید ما تازه کارام سر در بیاریم

  4. #4
    داره خودمونی میشه Hamid_pro's Avatar
    تاريخ عضويت
    Mar 2006
    پست ها
    156

    پيش فرض

    Thnax _cracki_ .Very comprehensive explanation.

  5. #5
    داره خودمونی میشه Hamid_pro's Avatar
    تاريخ عضويت
    Mar 2006
    پست ها
    156

    پيش فرض

    دوستان میشه یه خورده واضح تر توضیح بدید ما تازه کارام سر در بیاریم
    توضيح فارسيش اين ميشه whisper:
    اين تابع برای مدته کوتاهی کنترل رو به سيستم عامل برميگردنه، و اجازه پردازش وقايع ديگه رو بهش ميده.
    مثالش همين کده زيره:

    کد:
    برای مشاهده محتوا ، لطفا وارد شوید یا ثبت نام کنید
    بعد از اجرا شدن اين کد، ما فقط 'done' رو ميبينيم، چون برنامه ابتدا حلقه ها رو اجرا ميکنه و در نهايت توی textbox نشون ميده که خيلی سريعه.
    حالا اگه يک doevents بعد از text1.text = i اضافه کنيم، ميتونيم تغييرخروجی رو ببينيم.

  6. #6
    اگه نباشه جاش خالی می مونه black_storm's Avatar
    تاريخ عضويت
    Jul 2006
    محل سكونت
    Iran
    پست ها
    263

    پيش فرض

    ببین کار به روز رسانی رویداد ها را انجام میده !
    -------------------------

  7. #7
    داره خودمونی میشه
    تاريخ عضويت
    Jul 2006
    پست ها
    60

    پيش فرض

    بعضي برنامه ها پردازش سنگيني به سيستم تحميل مي كنند
    اين دستور به ويندوز تنفس مي ده تا كارهاي ديگه كامپيوتر رو هم انجام بده
    يعني برنامه مذكور اجازه مي ده Cpu به برنامه هاي ديگه و سخت افزارها هم وقت بده

  8. #8
    داره خودمونی میشه
    تاريخ عضويت
    May 2005
    محل سكونت
    فولادشهر
    پست ها
    137

    پيش فرض

    یه جور ساده ترم من بگم . اگر برنامت تویه حلقه ای بیوفته که تمام کارهای ویندوز مختل به قول خودومون سیستم هنگ کنه با استفاده از این دستور از هنگ کردن کامپیوتر جلوگیری می کنی .

Thread Information

Users Browsing this Thread

هم اکنون 1 کاربر در حال مشاهده این تاپیک میباشد. (0 کاربر عضو شده و 1 مهمان)

User Tag List

قوانين ايجاد تاپيک در انجمن

  • شما نمی توانید تاپیک ایحاد کنید
  • شما نمی توانید پاسخی ارسال کنید
  • شما نمی توانید فایل پیوست کنید
  • شما نمی توانید پاسخ خود را ویرایش کنید
  •