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 8242213
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T21:05:29+00:00 2026-06-07T21:05:29+00:00

I ended up a simple program sending and receiving a RS-232 message. My parameters

  • 0

I ended up a simple program sending and receiving a RS-232 message. My parameters (baudrate, COM port) are stored in an INI file (the file will be created automatically if not existing). The progam runs without error but I don’t know why it cuts off the path that point to INI file when the path length exceed a limit (there are Unicode Japanese characters in the path string)

My path string in New function (construction) is like this: "D:\通信プログラム20120709\新しいフォルダー\新しいフォルダー\新しいフォルダー\新しいフォルダー\Debug\Config.ini"

and in an event function, it will become: D:\通信プログラム20120709\新しいフォルダー\新しいフォルダー\新しいフォ・

After consulting some source on Internet, they show me that a .NET String would have a very huge capacity so I guess my problem not concerned to VB.NET String.

Any help would be appreciated.


From Comments

I found that the path is changed after the first line of code below

RS232TransPort = IniRoutine.GetString(IniSectionName, ConfigName.COMPort, "COM3")
RS232Baudrate = IniRoutine.GetInteger(IniSectionName, ConfigName.Baudrate, 9600)

This is the function to get a string:

Public Function GetString(ByVal Section As String, ByVal Key As String, ByVal [Default] As String) As String 

    Dim intCharCount As Integer 
    Dim objResult As New System.Text.StringBuilder(256) 

    intCharCount = GetPrivateProfileString(Section, Key, [Default], objResult, objResult.Capacity, strFilename) 
    GetString = String.Empty 

    If intCharCount > 0 Then GetString = Left(objResult.ToString, intCharCount) 

End Function 

where strFilename is a local variable of this class.

And this is the API declaire:

Private Declare Ansi Function GetPrivateProfileString _ 
        Lib "kernel32.dll" Alias "GetPrivateProfileStringA" _ 
        (ByVal lpApplicationName As String, _ 
        ByVal lpKeyName As String, ByVal lpDefault As String, _ 
        ByVal lpReturnedString As System.Text.StringBuilder, _ 
        ByVal nSize As Integer, ByVal lpFileName As String) _ 
        As Integer 
  • 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-07T21:05:30+00:00Added an answer on June 7, 2026 at 9:05 pm

    You are using GetPrivateProfileStringA instead of GetPrivateProfileStringW.

    Since you are using Unicode, you need to use GetPrivateProfileStringW instead.

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

Sidebar

Related Questions

I am writing a simple shell program that must take input from a file
I decided to implement a very simple program recursively, to see how well Java
I have a simple video html5 tag, bound to an ended event: $('#video').show().trigger(play).bind('ended', function
I'm working on a simple c program that has to connect to my database,
I am making simple ANSI C program, that simulates Unix shell. So I am
I'm trying to get a simple send and receive UDP program working, but I'm
I'm currently working on a program that analyses a wav file of a solo
I am trying to create a simple Input Verifier for a JTable. I ended
Im trying to write a simple program that takes 5 images and allows you
I'm looking for some good ideas for a simple 3d graphics program as my

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.