🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.nativeapi
11 messages
11 total messages Started by Nate Lockwood Sat, 25 Feb 2006 22:58
COPYDATASTRUCT problem
#4242
Author: Nate Lockwood
Date: Sat, 25 Feb 2006 22:58
25 lines
1566 bytes
I send a message to a already running application from one that has just 
been started.  This works just fine AFAIK except when I try to get to 
the LParam.  Eventually I expect to retrieve a char string. I get this 
error:

[C++ Error] Main.cpp(171): E2316 'WParam' is not a member of 'tagMSG'

I'm perplexed since I got this line from another post by a TeamB member.

Nate

void __fastcall TFormMain::AppMessage(MSG &Msg, bool &Handled)
{
   if( (Msg.message == WM_MYMSG) && (WM_MYMSG != 0) )
     {
     COPYDATASTRUCT* cds = reinterpret_cast 
<COPYDATASTRUCT*>(Msg.LParam);  // compile error
     FileList->Clear();      // TStringList *
     Application->Restore();
     Show();
     Handled = true;
     }
   else
     Handled = false;
}
Re: COPYDATASTRUCT problem
#4244
Author: Jonathan Benedicto
Date: Sun, 26 Feb 2006 00:13
10 lines
1185 bytes
Nate Lockwood wrote:
>I send a message to a already running application from one that has just 
>been started.  This works just fine AFAIK except when I try to get to the 
>LParam.  Eventually I expect to retrieve a char string. I get this error:

Use .lParam and .wParam

HTH

Jonathan 
Re: COPYDATASTRUCT problem
#4246
Author: Dennis Jones
Date: Sun, 26 Feb 2006 00:25
25 lines
2029 bytes
"Nate Lockwood" <RNLockwoodREMOVE@attglobal.net> wrote in message
news:4400e10b$1@newsgroups.borland.com...
> I send a message to a already running application from one that has just
> been started.  This works just fine AFAIK except when I try to get to
> the LParam.  Eventually I expect to retrieve a char string. I get this
> error:
>
> [C++ Error] Main.cpp(171): E2316 'WParam' is not a member of 'tagMSG'

Read the help.  Or look at the header file (winuser.h) where tagMSG is
declared.  You will see that the members are 'wParam' and 'lParam' (note the
lower-case 'W' and 'L').

> I'm perplexed since I got this line from another post by a TeamB member.

TeamB members aren't perfect -- they make mistakes just like the rest of us
mortals.  So just because you got something from a TeamB member doesn't
necessarily mean it's accurate.  Many times people here answer questions
with pseudo-code or don't bother testing what they use as an example.  So
you should always do a little extra research after you receive some sample
code to make sure that it correctly applies to your situation and/or that is
written correctly.

- Dennis
Re: COPYDATASTRUCT problem
#4245
Author: Jonathan Benedicto
Date: Sun, 26 Feb 2006 00:27
8 lines
1254 bytes
Dennis Jones wrote:
> So you should always do a little extra research after you receive some
> sample code to make sure that it correctly applies to your situation
> and/or that is written correctly.

I wait for the compiler to tell me that :-)

Jonathan
Re: COPYDATASTRUCT problem
#4247
Author: Ed Mulroy
Date: Sun, 26 Feb 2006 00:52
9 lines
1218 bytes
> TeamB members aren't perfect -- they make mistakes
> just like the rest of us mortals.

Oh darn.  Now that you've told them they'll know :-(

.  Ed

> Dennis Jones wrote in message
> news:4400f58a$1@newsgroups.borland.com...
Re: COPYDATASTRUCT problem
#4251
Author: Nate Lockwood
Date: Sun, 26 Feb 2006 01:10
13 lines
1300 bytes
Dennis Jones wrote:

> TeamB members aren't perfect -- they make mistakes just like the rest of us
> mortals.  So just because you got something from a TeamB member doesn't
> necessarily mean it's accurate.

Actually I was kind of amused as well as perplexed as the thread this 
was in continued on for some time with several other posts but no 
comment on the error.

Thanks

Nate
Re: COPYDATASTRUCT problem
#4248
Author: Nate Lockwood
Date: Sun, 26 Feb 2006 01:11
10 lines
1133 bytes
Jonathan Benedicto wrote:

> 
> I wait for the compiler to tell me that :-)
> 

Yeah, a lot of people don't know that its primary use is as a syntax 
checker.

Nate
Re: COPYDATASTRUCT problem
#4250
Author: Nate Lockwood
Date: Sun, 26 Feb 2006 01:12
10 lines
1172 bytes
Dennis Jones wrote:
> 
> Read the help.  Or look at the header file (winuser.h) where tagMSG is
> declared.  You will see that the members are 'wParam' and 'lParam' (note the
> lower-case 'W' and 'L').


I knew it was simple, thanks.

Nate
Re: COPYDATASTRUCT problem
#4256
Author: Dennis Jones
Date: Mon, 27 Feb 2006 00:44
14 lines
1481 bytes
"Jonathan Benedicto" <invalid@nobody.com> wrote in message
news:4400f5e7$1@newsgroups.borland.com...
> Dennis Jones wrote:
> > So you should always do a little extra research after you receive some
> > sample code to make sure that it correctly applies to your situation
> > and/or that is written correctly.
>
> I wait for the compiler to tell me that :-)

If the bad code will result in a compiler error, that's fine.  But if
not...well, you know, good luck!   :-)

- Dennis
Re: COPYDATASTRUCT problem
#4258
Author: Dennis Jones
Date: Mon, 27 Feb 2006 00:44
11 lines
1251 bytes
"Ed Mulroy" <dont_email_me@bitbuc.ket> wrote in message
news:4400fbce$1@newsgroups.borland.com...
> > TeamB members aren't perfect -- they make mistakes
> > just like the rest of us mortals.
>
> Oh darn.  Now that you've told them they'll know :-(

Sorry...I thought it was public knowledge!

- Dennis
Re: COPYDATASTRUCT problem
#4269
Author: Remy Lebeau (TeamB)
Date: Mon, 27 Feb 2006 20:50
34 lines
2018 bytes
"Nate Lockwood" <RNLockwoodREMOVE@attglobal.net> wrote in message
news:4400e10b$1@newsgroups.borland.com...

> I send a message to a already running application from one that
> has just been started.  This works just fine AFAIK except when
> I try to get to the LParam.  Eventually I expect to retrieve a char
> string.

Your code is completely wrong for that.  You cannot use COPYDATASTRUCT with
any message other than the WM_COPYDATA message.  And you cannot use the
TApplication::OnMessage event to catch WM_COPYDATA messages, because the
OnMessage event is only triggered for messages that are posted to the
message queue, which WM_COPYDATA never is.

> I get this error:
>
> [C++ Error] Main.cpp(171): E2316 'WParam' is not a member of 'tagMSG'

WParam (capital letters) is a VCL naming convension.  tagMSG is a Win32 API
structure, not a VCL structure.  If you look at the definition of MSG in the
Win32 API, you will see the following:

    typedef struct tagMSG {
        HWND   hwnd;
        UINT   message;
        WPARAM wParam;
        LPARAM lParam;
        DWORD  time;
        POINT  pt;
    } MSG;


Gambit
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads