BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

COPYDATASTRUCT problem

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (Native API)
View previous topic :: View next topic  
Author Message
Nate Lockwood
Guest





PostPosted: Sun Feb 26, 2006 12:03 am    Post subject: COPYDATASTRUCT problem Reply with quote



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;
}
Back to top
Jonathan Benedicto
Guest





PostPosted: Sun Feb 26, 2006 1:03 am    Post subject: Re: COPYDATASTRUCT problem Reply with quote



Dennis Jones wrote:
Quote:
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
Back to top
Dennis Jones
Guest





PostPosted: Sun Feb 26, 2006 1:03 am    Post subject: Re: COPYDATASTRUCT problem Reply with quote



"Nate Lockwood" <RNLockwoodREMOVE (AT) attglobal (DOT) net> wrote in message
news:4400e10b$1 (AT) newsgroups (DOT) borland.com...
Quote:
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').

Quote:
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
Back to top
Jonathan Benedicto
Guest





PostPosted: Sun Feb 26, 2006 1:03 am    Post subject: Re: COPYDATASTRUCT problem Reply with quote

Nate Lockwood wrote:
Quote:
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
Back to top
Nate Lockwood
Guest





PostPosted: Sun Feb 26, 2006 2:03 am    Post subject: Re: COPYDATASTRUCT problem Reply with quote

Jonathan Benedicto wrote:

Quote:

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
Back to top
Nate Lockwood
Guest





PostPosted: Sun Feb 26, 2006 2:03 am    Post subject: Re: COPYDATASTRUCT problem Reply with quote

Dennis Jones wrote:

Quote:
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
Back to top
Nate Lockwood
Guest





PostPosted: Sun Feb 26, 2006 2:03 am    Post subject: Re: COPYDATASTRUCT problem Reply with quote

Dennis Jones wrote:
Quote:

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
Back to top
Ed Mulroy
Guest





PostPosted: Sun Feb 26, 2006 2:03 am    Post subject: Re: COPYDATASTRUCT problem Reply with quote

Quote:
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

Quote:
Dennis Jones wrote in message
news:4400f58a$1 (AT) newsgroups (DOT) borland.com...
Back to top
Dennis Jones
Guest





PostPosted: Mon Feb 27, 2006 2:03 am    Post subject: Re: COPYDATASTRUCT problem Reply with quote

"Jonathan Benedicto" <invalid (AT) nobody (DOT) com> wrote in message
news:4400f5e7$1 (AT) newsgroups (DOT) borland.com...
Quote:
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 Smile

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

- Dennis
Back to top
Dennis Jones
Guest





PostPosted: Mon Feb 27, 2006 2:03 am    Post subject: Re: COPYDATASTRUCT problem Reply with quote

"Ed Mulroy" <dont_email_me (AT) bitbuc (DOT) ket> wrote in message
news:4400fbce$1 (AT) newsgroups (DOT) borland.com...
Quote:
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 Sad

Sorry...I thought it was public knowledge!

- Dennis
Back to top
Remy Lebeau (TeamB)
Guest





PostPosted: Mon Feb 27, 2006 10:03 pm    Post subject: Re: COPYDATASTRUCT problem Reply with quote

"Nate Lockwood" <RNLockwoodREMOVE (AT) attglobal (DOT) net> wrote in message
news:4400e10b$1 (AT) newsgroups (DOT) borland.com...

Quote:
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.

Quote:
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
Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (Native API) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.