Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2002-03-19
8
Medium Priority
?
135 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
  • 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Integration Management Part 2
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Suggested Courses

926 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