Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

MDI Drag & Drop + command line execution

Posted on 1998-08-27
4
Medium Priority
?
323 Views
Last Modified: 2010-04-04
Hi!

I'm making a simple MDI text editor.It based on text editor
sample program in '..\delphi 3\demos\doc'.

I have two questions.

First,How can I coding command line execution?
For example,'notepad sample.txt'.

Second,How can I create MDI child form from drag and drop file?
Drag file from explore and drop file at MDI parent form.How?

Have a nice day!
 
0
Comment
Question by:rnxotj
[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
  • 2
4 Comments
 
LVL 5

Expert Comment

by:inter
ID: 1337893
Hi,
1st,
----
You can use the following code snippet to read the comman line file(say you want to load it to a memo called memo1)
.
  if FileExists(ParamStr(1)) then
  begin
     Memo1.Lines.LoadFromFile(ParamStr(1));
  end else ShowMessage(ParamStr(1)+ 'does not exists');
.
2nd
----
To be able to detect a droped file use the following with your MainForms Handle
   DragAcceptFiles(MyMainWindow.Handle, true);
In this case when ever a file is tried to drop on your main form windows sends WM_DROPFILES message to your main form. So you should capture it and in it you can get the file names as follows:(assume you get wparam of WM_DROPFILES in hDrop interger variable)
var
  FName :  array[0..255] of char;
.
  // this only gets the first filename even multiple files are dropped
  DragQuerryFile(hDrop, 0, FName, sizeof(FName));
  DragFinish(hDrop);
  Memo1.Items.LoadFromFile(FName);
.
DO NOT FORGET TO:
   DragAcceptFiles(MyMainWindow.Handle, false); //at formdestroy

Regards, Igor

0
 
LVL 3

Expert Comment

by:Matvey
ID: 1337894
Hi rnxotj, Igor. If what you want to know is how to execute other apps like notepad, then the easiest way is something like:

ShellExecute(Handle, nil, 'notepad sample.txt', nil, 'D:\', 0);

--Matvey
0
 

Author Comment

by:rnxotj
ID: 1337895
Hi lgor!

It works very well!
Thank you very much..

Have a nice day....
0
 
LVL 5

Accepted Solution

by:
inter earned 90 total points
ID: 1337896
Fine,
Just ask if you need more...
Igor
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
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…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Suggested Courses

596 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