Solved

How can i create a application that can only run from a dll

Posted on 2002-03-19
8
132 Views
Last Modified: 2010-04-05
Hello i created a program called Phonebook.exe
i only want to be able to execute it from within a DLL

Does anyone know what code to put in the PhoneBook.exe
so it cannot be double clicked on to open..
thankyou kindly
0
Comment
Question by:Dinkleburger
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
8 Comments
 
LVL 11

Accepted Solution

by:
robert_marquardt earned 20 total points
ID: 6880091
The easiest trick is to have a secret command line parameter. Only the DLL knows it.
If the commandline parameter is missing in Phonebook.exe then it simply quits without doing anything.
Place the code to check the param in the .dpr
0
 
LVL 6

Expert Comment

by:Stuart_Johnson
ID: 6881671
Robert's suggestion is the way I'd do it too.

if ParamCount = 0 then
  Halt;

As he said, do it in the DPR so that none of your forms are made visible first.

Stu.
0
 

Author Comment

by:Dinkleburger
ID: 6881715

Thanks
But i am not understanding this

Can my Dll read inside the exe?

or is the Exe reading inside the Dll?

All my Dll is doing is Executing the Phonebook.exe

the same if it is Double clicked on

now i am lost... maybe some sample code for the exe and what i must put in the dll if anything

Thanks in advance
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 6

Expert Comment

by:Stuart_Johnson
ID: 6881729
If you double clicked the exe from Explorer, because you're not providing any parameters to the exe, it will close.

When you execute the PHONEBOOK.EXE from your DLL, you do it like this:

ShellExecute(hInstance, 'OPEN', 'PHONEBOOK.EXE,'','/WHATEVER', SW_SHOW);

The /WHATEVER is a dummy parameter that's passed to the EXE.  So, when ShellExecute starts the EXE, it actually runs:

PHONEBOOK.EXE /WHATEVER

Because a parameter is passed, the exe runs perfectly.

Hope this helps,

Stu
0
 

Author Comment

by:Dinkleburger
ID: 6881826
Yes Thankyou now i am understanding better
thank you all very very much
0
 

Author Comment

by:Dinkleburger
ID: 6881836
Ps Guys i only have the

Accept Comment As Answer Button next to my own Name and Roberts
there is no Button next to your Name Stuart so i want to Accept your answer

I will check back after and see if it is working..

0
 
LVL 6

Expert Comment

by:Stuart_Johnson
ID: 6884349
Hi Dinkleburger,

As Robert was the person who suggested the way to do this, it's only fair that he recieves the points.  All I was doing was helping you implement it (something Robert would have no doubtly done if I hadn't jumped in an made a noise).

Cheers all!

Stu

0
 

Author Comment

by:Dinkleburger
ID: 6890435
Just one more thing

ShellExecute(hInstance, 'OPEN', 'PHONEBOOK.EXE,",'/WHATEVER', SW_SHOW);

Where the WHATEVER is

i keep getting undeclared identifier

any ideas??
thanks
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Suggested Courses
Course of the Month4 days, 9 hours left to enroll

635 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question