Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 700433
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T03:29:50+00:00 2026-05-14T03:29:50+00:00

I ran dotTrace on my application (which is having some issues). IntPtr System.Windows.Forms.UnsafeNativeMethods.CallWindowProc(IntPtr, IntPtr,

  • 0

I ran dotTrace on my application (which is having some issues).

IntPtr System.Windows.Forms.UnsafeNativeMethods.CallWindowProc(IntPtr, IntPtr, Int32, IntPtr, IntPtr)

Void System.Windows.Forms.UnsafeNativeMethods.WaitMessage()

Are the two main functions that came up, taking about 94% of the application time.

Since I didn’t know what these two functions were, I ran through my code line by line. It runs smooth and efficiently until a point where it just hangs. “newFrm.Show()”.

The newFrm only contains a textbox. The larger the file I load into the text box (it’s a notepad program), the longer it takes. Now normally this makes sense, but it takes about 30 seconds for a 167 kB file.

Now I’m not sure what to do. It runs incredibly slow/stops functioning when you load a textfile and try to resize the window containing the text file too.

Then I realized that it is only struggling to open text files with a long string of hex inside (ie) “XX-XX-XX-” etc. With other similarly sized files it struggles with resizing somewhat, but opens within a couple seconds.

Does this have something to do with the textbox properties? I’ve set it to multiline and set maximum characters to 0 (so unlimited).

How do I solve this issue? Is there some way I can see what is being called in those functions?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T03:29:51+00:00Added an answer on May 14, 2026 at 3:29 am

    It is normal for a profiler to show that most execution takes place in those Windows API calls. CallWindowProc() runs the default message handler for a control, you are measuring how long it takes for the native edit box control built into Windows to handle your text file. WaitMessage() spins, waiting for a message from Windows that something interesting happened. This makes profiling GUI code difficult, you have to lift the code you wrote into a unit test style program. Not practical here, you didn’t write any of the code that is taking all the CPU cycles.

    Your problem is that TextBox isn’t a very good text editor. It doesn’t have any of the optimizations that you’d find in a full-blown editor. Be sure to turn the WordWrap property off, that’s especially expensive. And be sure not to fill the TextBox line-by-line from a file, that’s very slow as the native control constantly has to re-allocate its buffer. Use File.ReadAllText() or use a StringBuilder, then assign Text.

    Something like the open source ScintillaNET does a much better job.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 375k
  • Answers 375k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer You are indeed drawing a textured quad that is not… May 14, 2026 at 8:08 pm
  • Editorial Team
    Editorial Team added an answer A simple dead man's switch accomplishes this. Appoint long term… May 14, 2026 at 8:08 pm
  • Editorial Team
    Editorial Team added an answer Depends what you mean by "performance". I have had a… May 14, 2026 at 8:08 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.