Delphi-PRAXiS
Seite 3 von 4     123 4      

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Win32/Win64 API (native code) (https://www.delphipraxis.net/17-win32-win64-api-native-code/)
-   -   Delphi Windows API design (https://www.delphipraxis.net/4581-windows-api-design.html)

frankly 6. Mai 2003 10:32

Zitat:

Zitat von Luckie
But me and all the others will try to help as best as possible. Maybe we can help you if you provide some code or something we can work with to help you.

Oh...you guyz are just sooooooooo good :oops:
Codings? The 6 programs are very long and as I am just executing them in the windows API program I'll simply supply the windows API main program, is that ok? :shock:
Bcoz those 6 programs are real real long and if you want them of coz it is ok, anything you say actually, I can send them to you :shock:
I need to finish this...I have to.. :(

frankly 6. Mai 2003 10:35

What does the "application" means? :shock:
But hey I don't quite understand...I have all the 6 programs comunicate with each othe already, I mean they can work very fine already. So I still have to use pipes or WM_COPYDATA?
What are the communications for? :shock:

Zitat:

And don't worry we'll make it.
Thanz for comforting me...the thing that I need most now is your name...and your help of coz :D

Luckie 6. Mai 2003 10:36

Please don't send me any code. I wont have the time to do your work. Just post the relavent code. But I found some code for WM_COPYDATA. But again you will have to modify your c-programs:

First program, the sender:
Delphi-Quellcode:
function FindWindowByTitle(WindowTitle : string) : Hwnd;
var
  NextHandle : Hwnd;
  NextTitle : array[0..260] of char;
begin
  NextHandle := GetWindow(Application.Handle,GW_HWNDFIRST);
  while (NextHandle > 0) do
  begin
    GetWindowText(NextHandle,NextTitle,255);
    if (pos(WindowTitle,StrPas(NextTitle)) <> 0) then
    begin
      result := NextHandle;
      exit;
    end
    else
      NextHandle := GetWindow(NextHandle,GW_HWNDNEXT);
    end;
    result := 0;
end;
procedure TForm1.Button1Click(Sender: TObject);
var
  struct: CopyDataStruct;
begin
  struct.cbData := Length(Edit1.Text);
  struct.lpData := PChar(Edit1.Text + #0);
  SendMessage(FindWindowByTitle('Form2'), WM_COPYDATA, handle, Integer(@struct));
end;
Second program, the receiver:
Delphi-Quellcode:
type
  TForm1 = class(TForm)
    Label1: TLabel;
    procedure GetData(var msg: TMessage); message WM_COPYDATA;
...
procedure TForm1.GetData(var msg: TMessage);
var
  struct: PCopyDataStruct;
begin
  struct := Ptr(msg.LParam);
  Form1.Label1.Caption := PChar(struct^.lpData);
end;

Luckie 6. Mai 2003 10:40

Zitat:

Zitat von frankly
What does the "application" means? :shock:

That's your program.
Zitat:

I have all the 6 programs comunicate with each othe already, I mean they can work very fine already.
But you want one of them to communicate with you Delphi programm, don't you?
Zitat:

So I still have to use pipes or WM_COPYDATA?
If I don't misunderstand you - yes.

And if you want your c-program to communicate (receive and send data) you will have to modify your c-program.

frankly 6. Mai 2003 10:46

Oh actually I just want one of the 6 programs to get input and output from the screen. So...this is what you mean? the communication? :shock:

Oh but...can't this C program just output something to the screen and then get it back, and having all these done inside the C program itself?
Or you're saying I just have to do the pipes in order to do this? :shock: Bcoz I thought the inputs and outputs can all be done inside the C program. And the GUI program (windows API) is simply creating the child windows and then execute the C programs. So it is not that easy? :shock:

Luckie 6. Mai 2003 10:53

Zitat:

Zitat von frankly
Oh actually I just want one of the 6 programs to get input and output from the screen. So...this is what you mean? the communication? :shock:

That's exactly what I want to express by saying "communication".

Zitat:

Or you're saying I just have to do the pipes in order to do this? :shock:
That what I think.
Zitat:

And the GUI program (windows API) is simply creating the child windows and then execute the C programs. So it is not that easy? :shock:
I ain't sure how all your programs work, what they do, what kind of output tey have and what kind of input they need and how the should receive the input and what they do with the input. That's your job. All I can do is to tell you how applications can communicate. But I see your problem. Your programs weren't designed for this purpose. And that's the point, that makes it so difficult.

frankly 6. Mai 2003 10:58

Zitat:

I ain't sure how all your programs work, what they do, what kind of output tey have and what kind of input they need and how the should receive the input and what they do with the input. That's your job.
Yes I know, you're helping me here is very generous I understand...I am very happy that you're helping really..thank you sooooooo much!! :bounce2:

Zitat:

I ain't sure how all your programs work, what they do, what kind of output tey have and what kind of input they need and how the should receive the input. That's your job. All I can do is to tell you how application can communicate. But I see your problem. Your programs weren't designed for this purpose. And that's the point, that makes it so difficult.
Yes...I appreciate very much for your understanding...actually I wrote a program to be run on UNIX system :(

And then I thought it'll be better to make a windows GUI...so yes...it's vesy messy...so do you think it'll help you to learn better if you can see the windows API codings? Or you have to see also the C programs? :shock:

And what changes are needed for that C program? You mentioned it has to be changed in order to communicate right? And yes, the other 5 C programs, they don't have to be changed right? :shock: They will just display outputs to the screen.

[edit]
Oh I'm terribly sorry, I didn't see your message before
Zitat:

Please don't send me any code. I wont have the time to do your work. Just post the relavent code.
OK, I'll keep reading the pipes from MSDN...and your source codes in teh message (bcoz I just happened to miss the while message...don't know why)hope you will be back soon...need help very very desparately... :(

frankly 6. Mai 2003 11:08

Oh I think I get a better idea of what you mean now

I have 6 C programs and I have a windows API program
the pipes are for the 6 C programs to communicate with the API program, bcoz the C programs have to pass parameters to the API program, am I right?

Oh...that would be real nasty then...I thought I'll only have to write a little program. And now I think it's another big program...

So these 6 C programs, I have to make them to be "application window" when I create a project right? Bcoz I was making "console window" before for the UNIX running

[edit]
Oh sorry, one more thing, do I have to use named pipes or anonymous pipes? :shock:
Thanz!! :D

frankly 6. Mai 2003 11:54

Oh I'm terribly sorry, I didn't see your message before :oops:
Zitat:

Please don't send me any code. I wont have the time to do your work. Just post the relavent code.
OK, I'll keep reading the pipes from MSDN...and your source codes in teh message (bcoz I just happened to miss the while message...don't know why)hope you will be back soon...need help very very desparately... :(

So where did you get the codes? Can you send me the link? I want to got there to have a look too. Bcoz I don't know what is the function pos(), I searched through MSDN but couldn't find much details on that.

Thanz :P
[edit]
Oh yes, that is not a C function... :shock:

frankly 6. Mai 2003 12:09

Oh unbelievable!! I jsut found this link while searching for refernce of WM_COPYDATA
what do you think? :D
http://www.codeproject.com/dialog/quickwin.asp


[edit by Admin]link fixed.[/edit]


Alle Zeitangaben in WEZ +1. Es ist jetzt 14:17 Uhr.
Seite 3 von 4     123 4      

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz