Solved

Invoking a DOS program from Delphi v3

Posted on 1998-02-18
9
247 Views
Last Modified: 2010-04-04
Hi...
  I asked this question before and Zitt gave an answer which didn't work. I'm re-asking it:
  In v1 I used the following routine which worked well when invoking a DOS app. In my app I must wait for the DOS app to complete before proceeding...this method worked well:

Function WinExecAndWait(Path : string; Visibility : word) : word;
var
  InstanceID : THandle;
  PathLen : integer;
begin
  { inplace conversion of a String to a PChar }
  PathLen := Length(Path);
  Move(Path[1],Path[0],Pathlen);
  Path[PathLen] := #00;
  { Try to run the application }
  InstanceID := WinExec(@Path,Visibility);

  if InstanceID < 32 then { a value less than 32 indicates an Exec error }
     WinExecAndWait := InstanceID
  else begin
    Repeat
      Application.ProcessMessages;
    until Application.Terminated or (GetModuleUsage(InstanceID) = 0);
    WinExecAndWait := 32;
  end;
end;


..now that I am in v3, I see the "GetModuleUsage" command is not present. All I want to do is invoke a DOS app and wait for it to complete. The v3 help files are so horrible and cryptic that I can't understand a word they're talking about! Read a little about some "CreateProcess" command but couldn't make heads or tails of it! Any suggestions?

  Also, on another note, my app in v1 used a TabbedNotebook with 10 tabs - with the TabsPerRow property set to 5 so there were 2 rows of 5 tabs each...nice and neat. I notice in v3 that the TabsPerRow property doesn't work...it strings out all 10 tabs in one row...one after another...really ugly. Is there any way to solve this without me having to resort to the new PageControl component of v3...I have a LOT of controls on my old TabbedNoteBook and it would be hell to try and move them all over to a PageControl component.

Hope you can help!

Cheers!
  Shawn Halfpenny
  drumme59@sprint.ca
0
Comment
Question by:aztec
  • 5
  • 4
9 Comments
 
LVL 3

Accepted Solution

by:
Matvey earned 50 total points
ID: 1359540
Hi!

I think I tryed to help you with the TabsPerRow some time ago, and some other things. Was that you?
Try to see your form in text mode and understand how the both of your tabbet components work, and then try to change yours to the working one in D3 in that text mode and then in the form code.
:) Hope it works!

I sent you a component for executing programs, tt will work for DOS app too!

Good luck!
Matvey
0
 

Author Comment

by:aztec
ID: 1359541
Hello matvey...
   You write:

I think I tryed to help you with the TabsPerRow some time ago, and some
                      other things. Was that you?
                      Try to see your form in text mode and understand how the both of your
                      tabbet components work, and then try to change yours to the working one in
                      D3 in that text mode and then in the form code.

..I don't understand what you mean by this. Please explain more clearly.

Shawn Halfpenny
0
 
LVL 3

Expert Comment

by:Matvey
ID: 1359542
When you click with the right mouse button on you form you have an option like "view as text" or something like this. Try to understand, within that text mode for your form, how the components are arranged in this tabbed controll. Then create a new project and try to understand the same for the new control taht comes with D3 (the one that works), and then try to exchange them within the text mode and save.

If you want then send your form to me (bosism@netvision.net.il) -glad if I can help!

Did you recieve the component?
0
 

Author Comment

by:aztec
ID: 1359543
Matvey...
  It appears that even the new PageControl component (which is apparently supposed to take the place of TabbedNoteBook in Delphi 1) of Delphi 3 also does not have a property to set Tabs Per Row. There is no need for me to send you my form code...you can test this easily yourself - just create a TabbedNoteBook with 6 tabs and 3 TabsPerRow. Then check the text source of the form. Then create a PageControl with 6 Tabs. You'll see there's no place in the PageControl component to specify Tabs Per Row. It appears to be a bug in Delphi 3 where it does not correctly handle the TabsPerRow property of the old TabbedNoteBook component.

Regards,
   Shawn Halfpenny
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 3

Expert Comment

by:Matvey
ID: 1359544
Do you think we should try to fix this component?

I have an idea! how about trying to replace the one we got with D3 with the one from D1 uh?

I'll try it.

Reply soon...
Matvey
0
 

Author Comment

by:aztec
ID: 1359545
Any luck Matvey?

Shawn
0
 
LVL 3

Expert Comment

by:Matvey
ID: 1359546
:-( Sorry pal, there is no source for it in D1 (check maybe you have), but I think I understand why it doesn't works in D3 - the TabsPerRow property isn't used at all!!! I mean everything ignores it, and the tabs are aligned with a method that doesn't treats this property at all!!!

The last resort is to contact Borland, I think.

I'm really sorry but I can't change the component now because there is no even the source of the original D1 version of this control, so it's really not easy to "invent the wheel again".

Hope Borland can help you! -good luck!
Matvey
0
 

Author Comment

by:aztec
ID: 1359547
Ok Matvey...thanks for trying I will contact Borland...meanwhile give yourself an 'A' for effort (and for the component you sent me) !

Cheers!
   Shawn Halfpenny
0
 
LVL 3

Expert Comment

by:Matvey
ID: 1359548
Hey aztec! -thanks for some points!

Tell me when Borland answeres, OK?

my email: bosism@netvision.net.il
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
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…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

895 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now