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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T05:30:33+00:00 2026-05-29T05:30:33+00:00

Good evening! I’m currently in the first stages of development with a new application

  • 0

Good evening!

I’m currently in the first stages of development with a new application in Firemonkey. It’s my first run in with Firemonkey, but i’ve got a few years experience with Delphi.

So far, i’ve got an external application that extracts an icon from an exe and then saves it to a file as a BMP. I’ve coded in the ability to pass a parameter to this application (which provides a string value to tell it where the .exe to extract from is). It was built in VCL as i want to use the firemonkey framework mostly for the 3D features, but also allow me expansion onto Mac at a future date if i so wish. The external application is working correctly, so the code there doesn’t need tweaking.

The issue i’m having is passing the parameter from my firemonkey application. I’m using a customised “fOpen” unit which allows passing of parameters;

unit fOpen;

interface

uses
{$IFDEF MSWINDOWS}
Winapi.ShellAPI, Winapi.Windows;
{$ENDIF MSWINDOWS}
{$IFDEF POSIX}
  Posix.Stdlib;
{$ENDIF POSIX}

type
  TMisc = class
class procedure Open(sCommand, Params: string);
end;
implementation

class procedure TMisc.Open(sCommand, Params: string);
begin
{$IFDEF MSWINDOWS}
  ShellExecute(0, 'OPEN', PChar(sCommand), PChar(Params), '', SW_SHOWNORMAL);
{$ENDIF MSWINDOWS}
{$IFDEF POSIX}
  _system(PAnsiChar('open ' + AnsiString(sCommand)));
{$ENDIF POSIX}
end;
end.

As you can see, i’ve added the “Params” variable to the MSWINDOWS isdef.

On my firemonkey form, there’s 2 buttons. 1 of them executes a TOpenDialog and outputs the selected filename into a TEdit. The other button executes the external application (the one that extracts the icon) and then loads the bitmap image that was saved into a TImageControl.

Here’s the code i’m trying to use;

fOpen.TMisc.Open('HypExIcon.exe', '"' + edit1.Text +'"');

The issue is that the first line, which should execute the file with the parameter, doesn’t actually work as intended. It doesn’t even execute the file at all (i.e. there’s no indication of the application launching as there should be). However, if i change it to this…

fOpen.TMisc.Open('HypExIcon.exe', 'C:\Windows\Notepad.exe');

…it functions as would be expected, executing the external application and creating the icon included in the parameter field. I’ve tried using PChar('"' + Edit1.text + '"'), as well as a similar PWideChar function, but neither of them remedy the issue.

I’m confident it’s something extremely simple that i’m missing here. I’m so used to using PChar or PWideChar for these sorts of things in VCL, that it’s thrown me off.

Any ideas?

  • 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-29T05:30:34+00:00Added an answer on May 29, 2026 at 5:30 am

    As we worked out in the comments, the problem is that the file dialog is changing the working directory behind your back. You can, and should, set the ofNoChangeDir option.

    However, I recommend that you do not rely on relative paths when starting processes. When starting processes you really ought to maintain tight control over the location of the process. I would do it like this:

    AppPath := ExtractFilePath(Application.ExeName);
    fOpen.TMisc.Open(AppPath+'HypExIcon.exe', ...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Good evening guys. I'm currently trying to get started on development of a project
Good evening, I am currently developing an application for android using phonegap and sencha
Good evening guys! I'm currently designing a desktop interface with various features using Firemonkey/FMX.
Good evening, In my app that I'm currently developing, I have a class that
Good evening, I am working on a program where some application config info is
Good evening! Been searching all over, and I'm afraid I've just got something completely
good evening. ingore all other elements, I want get first image in each foreach.
Good Evening All, A client has asked that I develop a web application as
Good Evening, Recently I found the taglib library. It's a really nice one but
Good evening all. I'm currently working on a small personal project. It's purpose is

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.