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

  • SEARCH
  • Home
  • 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 8025049
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T23:02:26+00:00 2026-06-04T23:02:26+00:00

I need to display the text on Text Box whatever data retrieve from files.

  • 0

I need to display the text on Text Box whatever data retrieve from files.

On push of particular button (IDB_SHOW_BUTTON) in windows application, I am doing as mentioned below:-

case IDB_SHOW_BUTTON:{  
   char buf[1000];  
   vReadFileFromHardisk(buf); //storing the read data of file to buffer
   SendMessage(editHwnd,WM_SETTEXT,NULL,(LPARAM)buf);//Due to this, I get junk text.
}
break;

I am reading data from file and storing it into buffer. I don’t understand why i am getting junk text whenever I am clicking on the button.

When I change the 4th parameter of SendMessage i.e. as mentioned below, I get the proper output on push of a particular button:-

SendMessage(editHwnd,WM_SETTEXT,NULL,(LPARAM)L"My First Edit Window");

Please let me know to how to display the proper text in case of storing data to buf and sending the same through SendMessage.

Thanks in advance.

  • 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-06-04T23:02:29+00:00Added an answer on June 4, 2026 at 11:02 pm

    See the ‘L’ in the working example? You’re passing a narrow character string into a function that expects Unicode.

    You’ll need to either

    1. convert the text you’ve read in into Unicode – you can do this using MultiByteToWideChar amongst others; you’ll need to know what encoding the input is, e.g. UTF-8
    2. send the narrow form of the message, WM_SETTEXTA, to use the current system encoding for the data you’ve read
    3. change your program settings from Unicode to Multi-byte (but don’t do this)

    I strongly recommend 1 and getting used to using Unicode (a.k.a. UTF-16) throughout your program.

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

Sidebar

Related Questions

I have windows application in which i need to convert amount entered in text-box
Can a windows message box be display using the cout syntax? I also need
I need to display some text in a box with an explicit width/height. If
I need to display the text retrieved from the database in the <textarea> tag.
I need to get View SQL Query to display it in some text box
I need to validate the text box value from the generated html table (grid)
I need to display text along with values of variables in a CEdit controlled
I need to the display the Text which is having the & symbol in
I'm using MKMap with overlay. The overlay display text. I need the text to
I need to display a character symbol (Not alphanumeric, or on the keyword) textField.text

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.