Board index » cppbuilder » Resource ID from VCL Controls?

Resource ID from VCL Controls?


2005-03-06 06:01:41 AM
cppbuilder55
Hi,
how can i retrieve "Resource IDs" from
VCL Controls like TComboBox ?
I mean such Resource Ids like "IDD_DIALOG 100" from
Resource.h Files.
I need them for WinHelp Calls with HELP_CONTEXTMENU Option.
regards
Helge
 
 

Re:Resource ID from VCL Controls?

"Helge" < XXXX@XXXXX.COM >wrote in message
Quote
how can i retrieve "Resource IDs" from
VCL Controls like TComboBox ?
You cannot, because there are no such IDs available to begin with.
Quote
I mean such Resource Ids like "IDD_DIALOG 100" from
Resource.h Files.
That is not how the VCL works. The VCL does not use dialogs at all, and
does not use dialog IDs.
Quote
I need them for WinHelp Calls with HELP_CONTEXTMENU
Option.
Why do you need the IDs for that? Please elaborate.
Gambit
 

Re:Resource ID from VCL Controls?

Hi,
i need that Resource IDs to Implement such "What's this" WinHelp Topics.
The WinHelp() Option HELP_CONTEXTMENU need DWORD pairs
of [ResoruceID, TopicID].
But i think i found a way to do.
I override the Dialogs WndProc and handle the WM_CONTEXTMENU Message.
In that i got the Windowhandle (FindVLCWindow, FindControl or whatever), of
the desired Control and get his Windowhandle.
From that Windowhandle i got the LOWORD and that works (or is?) the
desired Resource ID.
Now i put that ID in DWORD dwID[ResID, HelpTopicID]; and it works.
Or is there an easier way to to get that "What's this" help?
Btw: With GroupBoxes and Panels or something it doesnt work. Why?
Helge
"Remy Lebeau (TeamB)" < XXXX@XXXXX.COM >schrieb im Newsbeitrag
Quote

"Helge" < XXXX@XXXXX.COM >wrote in message
news:d0daap$ck7$04$ XXXX@XXXXX.COM ...

>how can i retrieve "Resource IDs" from
>VCL Controls like TComboBox ?

You cannot, because there are no such IDs available to begin with.

>I mean such Resource Ids like "IDD_DIALOG 100" from
>Resource.h Files.

That is not how the VCL works. The VCL does not use dialogs at all, and
does not use dialog IDs.

>I need them for WinHelp Calls with HELP_CONTEXTMENU
>Option.

Why do you need the IDs for that? Please elaborate.


Gambit


 

{smallsort}

Re:Resource ID from VCL Controls?

"Helge" < XXXX@XXXXX.COM >wrote in message
Quote
i need that Resource IDs to Implement such "What's this" WinHelp
Topics.
Then I suggest you make use of the Tag property that every component has.
Store your custom values there and retreive them when needed.
Quote
The WinHelp() Option HELP_CONTEXTMENU need
DWORD pairs of [ResoruceID, TopicID].
No, HELP_CONTEXTMENU does not take a pair of values. It takes a single
value - the ID of the specific topic to display. There are no resource IDs
involved.
Quote
I override the Dialogs WndProc and handle the WM_CONTEXTMENU
Message. In that i got the Windowhandle (FindVLCWindow, FindControl
or whatever), of the desired Control and get his Windowhandle. From that
Windowhandle i got the LOWORD and that works (or is?) the desired
Resource ID.
Again, VCL control *do not* use any resource IDs at all! The VCL does not
use any dialogs to begin with.
Gambit
 

Re:Resource ID from VCL Controls?

Hi and thanks for answering.
Quote
>The WinHelp() Option HELP_CONTEXTMENU need
>DWORD pairs of [ResoruceID, TopicID].

No, HELP_CONTEXTMENU does not take a pair of values. It takes a single
value - the ID of the specific topic to display. There are no resource
IDs
involved.
Strange. How can my WinHelp call work properly with that pair of Values ?
// CtrlID und Hilfe Topic ID als paar zusammenfassen
// für HELP_CONTEXTMENU benötigt
dwID[0] = (DWORD)LOWORD(pWinControl->Handle);
dwID[1] = (DWORD)pWinControl->HelpContext;
WinHelp(pWinControl->Handle,
(LPCTSTR)Application->HelpFile.c_str(),
HELP_CONTEXTMENU,(DWORD) (LPVOID) dwID);
This works fine.
If i Call that with only pWinControl->HelpContext as dwID, it crashes.
That will only Work with the Option HELP_CONTEXT or something.
Quote

>I override the Dialogs WndProc and handle the WM_CONTEXTMENU
>Message. In that i got the Windowhandle (FindVLCWindow, FindControl
>or whatever), of the desired Control and get his Windowhandle. From that
>Windowhandle i got the LOWORD and that works (or is?) the desired
>Resource ID.

Again, VCL control *do not* use any resource IDs at all! The VCL does not
use any dialogs to begin with.
i understand, but WHAT Value i got when i get th LOWORD(DlgControlHandle) ?
Quote


Gambit


 

Re:Resource ID from VCL Controls?

"Helge" < XXXX@XXXXX.COM >wrote in message
Quote
dwID[0] = (DWORD)LOWORD(pWinControl->Handle);
Why are you extracting an ID from a window handle? Window handle values are
arbitrary memory addresses, they are meaningless as ID numbers. As I
already explained to you several times now, you cannot extract any ID number
from a VCL control, because there is no ID number available to begin with!
That is not how the VCL works.
If I were you, I would try using HELP_CONTENT or HELP_CONTEXTPOPUP instead
of HELP_CONTEXTMENU. HELP_CONTEXT/POPUP only needs the topic ID, no control
ID at all.
Quote
If i Call that with only pWinControl->HelpContext as dwID, it crashes.
You did not show that code, but it is probably because you did not format
your data properly.
Quote
i understand, but WHAT Value i got when i get th LOWORD(DlgControlHandle)
?
There is no dialog handle. VCL forms and controls are not based on dialogs.
That is a completely different kind of programming.
Gambit
 

Re:Resource ID from VCL Controls?

I understand what you say but, WHY this works:
DWORD dwID[2];
case WM_CONTEXTMENU:
// Position of Control
P.x = Message.LParamLo;
P.y = Message.LParamHi;
// Get Handle
pWinControl = FindVCLWindow( P );
//
// CtrlID and Help Topic ID
dwID[0] = (DWORD)LOWORD(pWinControl->Handle);
dwID[1] = (DWORD)pWinControl->HelpContext;
WinHelp(pWinControl->Handle,
(LPCTSTR)Application->HelpFile.c_str(),
HELP_CONTEXTMENU,(DWORD) (LPVOID) dwID);
break;
As you told me, this CANT be work, but it does. Why?
if i Do that:
WinHelp(pWinControl->Handle,
(LPCTSTR)Application->HelpFile.c_str(),
HELP_CONTEXTMENU,(DWORD) (LPVOID)
pWinControl->HelpContext);
it crashes!
I want the HELP_CONTEXTMENU because it open a "Whats this" Menu befor
showing Help!
I doent know, if an other Option of WinHelp do that too?
It confuse me a little bit :o)
regards
Helge
"Remy Lebeau (TeamB)" < XXXX@XXXXX.COM >schrieb im Newsbeitrag
Quote

"Helge" < XXXX@XXXXX.COM >wrote in message
news:d0kfa0$npp$01$ XXXX@XXXXX.COM ...

>dwID[0] = (DWORD)LOWORD(pWinControl->Handle);

Why are you extracting an ID from a window handle? Window handle values
are
arbitrary memory addresses, they are meaningless as ID numbers. As I
already explained to you several times now, you cannot extract any ID
number
from a VCL control, because there is no ID number available to begin with!
That is not how the VCL works.

If I were you, I would try using HELP_CONTENT or HELP_CONTEXTPOPUP instead
of HELP_CONTEXTMENU. HELP_CONTEXT/POPUP only needs the topic ID, no
control
ID at all.

>If i Call that with only pWinControl->HelpContext as dwID, it crashes.

You did not show that code, but it is probably because you did not format
your data properly.

>i understand, but WHAT Value i got when i get th
LOWORD(DlgControlHandle)
?

There is no dialog handle. VCL forms and controls are not based on
dialogs.
That is a completely different kind of programming.


Gambit


 

Re:Resource ID from VCL Controls?

"Helge" < XXXX@XXXXX.COM >wrote in message
Quote
I understand what you say but, WHY this works:
My guess would be that the resource ID is being ignored, so it doesn't
matter what value you assign to it. The topic ID is what is important.
Quote
if i Do that:
<snip>
it crashes!
As well it should. HELP_CONTEXTMENU expects 2 DWORD values, and you are
only providing 1, so it tries to access invalid memory when looking for the
other DWORD.
Gambit
 

Re:Resource ID from VCL Controls?

Quote
My guess would be that the resource ID is being ignored, so it doesn't
matter what value you assign to it. The topic ID is what is important.
The ID in dwID[0] isn´t ignored.
If i put diffrent Values tha LOWORD (Handle) in it, it doesnt word, means
it does not view the HelpTopic after "Whats this" than.
Only with LOWORD(Handle) in dwID[0] it works.
Strange.
Quote
As well it should. HELP_CONTEXTMENU expects 2 DWORD values, and you are
only providing 1, so it tries to access invalid memory when looking for
the
other DWORD.
Thats what i say.
But would this be mean, VCL Dialogs cant be have a HELP_CONTEXTMENU Help?
regards
Helge