Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2002-03-19
8
Medium Priority
?
133 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 80 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses

721 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