AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

Windows API design

Ein Thema von frankly · begonnen am 5. Mai 2003 · letzter Beitrag vom 7. Mai 2003
Antwort Antwort
Seite 1 von 4  1 23     Letzte »    
frankly

Registriert seit: 5. Mai 2003
22 Beiträge
 
#1

Windows API design

  Alt 5. Mai 2003, 12:04
Hi ppl,

I have some design questions about windows API, actually I'm quite new to windows API, really hope u guyz can give me some help, thanz really!!

I have a main window now and I created 6 child windows, each for running an executable C program.
I have 6 C programs which are actually socket programs. They talk to each other using TCP .

What I'm doing now is simply use a child window to display the input and output messages of these 6 C programs (like TextOut and input for these 6 programs).

The main window there is just for grouping the 6 child windows together to make it more convenient. So I think there won't be any message loop for the main window. Just creating the child windows. And the child windows will execute the C programs. These C programs will run and output messages to their own child window like a screen and get input from their corresponding child window.

So If I have A B C D E F for the executable C programs. I will also have child windows A B C D E F and these 6 child windows will be created by the main window. And the input and ouput of messages on the screen of child window A will be all handled by the .exe of program A.

What I wanna ask is...is this possible at all? And how do I actually implement this? I think the complicated part is how do those 6 programs handle the in and out of messages on the screen of their own child window?

Not sure I make it clear coz I am always lack of organization, so if you don't understand my design, just drop me a few lines, thanz so much!!
  Mit Zitat antworten Zitat
roderich
(Gast)

n/a Beiträge
 
#2
  Alt 5. Mai 2003, 14:53
hi Frankly,

You have various ways for communication between processes, for example OLE, COM, messaging .... or just creating DLL's instead of EXE files.

I would propose a simple messaging via SendMessage from/to the C program. In this case You have to modify the source of the C programs to tell them the handle of the associated Delphi program's form (e.g. via runtime parameter). Another way is to call FindWindow from the C program to get the correct form handle.

Then send a message to the other form by calling
SendMessage(WM_CopyData, handle, hwnd, pcds)
where
handle is address handle
hwnd is handle of sending window
pcds points to a structure to transfer

regards
Roderich
  Mit Zitat antworten Zitat
frankly

Registriert seit: 5. Mai 2003
22 Beiträge
 
#3
  Alt 5. Mai 2003, 15:01
Oh thank you sooo much for your reply, Roderich, I'm very desperately to get some replies bcoz I'm totally stuck here...

I think that FindWindow thing is quite interesting bcoz I don't think I'm gonna modify those codes for the 6 programs bcoz they are supposed to be like this...and this GUI is only trying to let ppl to better understand what I'm doing. Like if I integrate the codes of these 6 programs, it will lose the orginial purpose and meanings.

So I'll try to avoid making and changes. As little as possible I mean.
So I have to use FindWindow in these 6 programs to ge the handle first? Is it the child's handle? hehe sorry for the stupid questions...me very new to Windows API
  Mit Zitat antworten Zitat
Daniel B
(Gast)

n/a Beiträge
 
#4
  Alt 5. Mai 2003, 16:01
Hi,

i shifted the Thread after Win-API.
The section General-Programming is only for other programming languages.

Bye, Daniel
  Mit Zitat antworten Zitat
frankly

Registriert seit: 5. Mai 2003
22 Beiträge
 
#5
  Alt 5. Mai 2003, 16:12
Oh cool thanz hehe
me can't read German very well...sorry...
  Mit Zitat antworten Zitat
frankly

Registriert seit: 5. Mai 2003
22 Beiträge
 
#6
  Alt 6. Mai 2003, 08:15
OK I have some progress now

I have created 6 child windows and trying to execute the C executable in these child windows 8)

I am using WinExec but there are only two parameters so how do I pass the child window handle to the command to make the .exe to be run in the specified child window?

Thanz
[edit] Oh....or should I be using CreateProcess() to get the handle?
  Mit Zitat antworten Zitat
Benutzerbild von Luckie
Luckie

Registriert seit: 29. Mai 2002
37.621 Beiträge
 
Delphi 2006 Professional
 
#7
  Alt 6. Mai 2003, 08:32
First of all you should not use WinExec because it's obsolete. use instead Shelllexecite or CreateProcess.

Now my idea would be: Pass the Window-Handle as a parameter, when you start your process.
Michael
Ein Teil meines Codes würde euch verunsichern.
  Mit Zitat antworten Zitat
frankly

Registriert seit: 5. Mai 2003
22 Beiträge
 
#8
  Alt 6. Mai 2003, 08:56
a very dunb question...bcoz I usually set all the attributes to NULL, so which one should I set now for the handle? I couldn't find one suits the meaning "handle"...or did I missed something?
  Mit Zitat antworten Zitat
Benutzerbild von Luckie
Luckie

Registriert seit: 29. Mai 2002
37.621 Beiträge
 
Delphi 2006 Professional
 
#9
  Alt 6. Mai 2003, 09:03
I don't know what your c-programs accept for parameters and how they handle them.

But I still wonder what you mean when you say, "execute the C executable in these child windows".

As a matter of fact you have two processes: Your own and the c-program you started from within your application (process). Now tell me what do you want to do with the second process you started from within your application.

I'm afraid you try do something that can't be done or there is a better solution than yours.
Michael
Ein Teil meines Codes würde euch verunsichern.
  Mit Zitat antworten Zitat
frankly

Registriert seit: 5. Mai 2003
22 Beiträge
 
#10
  Alt 6. Mai 2003, 09:15
Oh yes, I have 6 programs written in C and they communicate with each other using TCP connections. So one can simply execute them and then they would automatically send predefined messages to each other.

But one of these 6 programs require an input when running and then it will go back to run and then run till the end. These programs will end properly. I mean you can just leave it there after entering the input.

I created a main window and created 6 child windows now. And I want each of these child windows to display the "printf" that is outputted by the 6 programs. So the child windows are like some screens display messages. And as I mentioned above, one of them will need input so one of these windows need to accept input.

So what I want to do is to execute these 6 programs in the main window, I want to make a menu option "execute", and once it is clicked, the 6 programs will be called and executed. This is why I'm thinking of WinExec...but now I think I have to use CreateProcess().

So when this "execute" option is chosen, my program should call the 6 .exe to run the programs. And I am still messing with the attributes...

Hope this would help you to understand more of my program, I appreciate very much that you're trying to help me as best as you could. Just want to say a BIG thank you to you
  Mit Zitat antworten Zitat
Antwort Antwort
Seite 1 von 4  1 23     Letzte »    


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 00:23 Uhr.
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz