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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T05:44:57+00:00 2026-06-11T05:44:57+00:00

I want to pass a string to my dll funcfion, but the function cannot

  • 0

I want to pass a string to my dll funcfion, but the function cannot get the value.
first I get the string from cmd line using GetMyParam function. it’s right.then, i pass
the value to my dll using innotest function.

function innotest(PName:string):Integer;
external 'innotest@E:\client\branch\maintain\1.4\bin\sdostate-debug\update.dll stdcall setuponly';

function GetMyParam(PName:string):string;
var
  CmdLine : String;
  CmdLineLen : Integer;
  i : Integer;
begin
    Result := '';
    CmdLineLen:=ParamCount();
    for i:=0 to CmdLineLen do
    begin
    CmdLine:=ParamStr(i);
    if CmdLine = PName then
      begin
          CmdLine:=ParamStr(i+1);
          Result := CmdLine;
          Exit;
      end;
    end;
end;

procedure CurStepChanged(CurStep: TSetupStep); 
var 
res: String;

begin
if (CurStep = ssPostInstall) and (Pos('setup', WizardSelectedTasks(false)) > 0)then
begin
res := GetMyParam('-myParam');
MsgBox(res, mbInformation, mb_Ok);
innotest(res);
end;
end;

Msgbox has the res value.
here is my dll code: the string’s length is 1.

DWORD Update::innotest(string str)
{
    LPCWSTR s = StringHelper::ANSIToUnicode(str).c_str();
    MessageBox(0,s,0,0);
    return 0;
}
  • 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-11T05:44:59+00:00Added an answer on June 11, 2026 at 5:44 am

    You’re using string type in your function parameter, what is a sequence of characters in memory, that InnoSetup cannot reach directly. You have to use pointer to string type to get it to work. So when you are using Unicode InnoSetup, change your library function parameter to have an Unicode string pointer type the following way. Then you can keep your InnoSetup script as it is:

    DWORD Update::innotest(LPCWSTR str)
    {
        MessageBox(0,s,0,0);
        return 0;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a UInt32 value I want to pass to an external dll using
I am using window.opener to pass a string value from a child window to
I want to pass a string value from broadcast receiver to a service.If someone
Well, I want to pass a string value from one file to another, how
I want to pass string as a parameter in with my jni. but when
i want to pass a string from an input box that after submition automatically
I want to pass an object (not just a string or integer) from a
I want to be able to pass a string (['parent_array']['child_array']) to a function that
A function takes a string as argument, example fn(string). I want to pass different
Under Linux ,if I want to pass pure string from PHP to C, how

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.