mIRC Home    About    Download    Register    News    Help

Topic Options
#11969 - 19/02/03 11:44 AM How to make my DLL change control's properties
netgert Offline
Nutrimatic drinks dispenser

Registered: 19/02/03
Posts: 8
Loc: Estonia
Hi,
I need to make a DLL which will change the text and background of a control. The dialog's handle, controls id and the color is passed to the DLL and parsed correctly, but calling the SetTextColor (from Windows API) has no function, same with SendMessage. Why doesn't it work? I can get the correct properties, but why can't I set them??? I'm using Delphi as the programming language, but can understand C/C++ or VisualBasic too. Please help ASAP

Top
#11970 - 19/02/03 02:21 PM Re: How to make my DLL change control's properties
vcv Offline
Babel fish

Registered: 09/12/02
Posts: 87
Loc: Amherst, NY
That's not how you change colors of a dialong control.

You have to handle the proper WM_CTLCOLORBTN/WM_CTLCOLORDLG/WM_CTLCOLOREDIT/WM_CTLCOLORLISTBOX/WM_CTLCOLORSTATICWM_CTLCOLORSCROLLBAR message to set the color.

Top
#11971 - 19/02/03 08:17 PM Re: How to make my DLL change control's properties
codemastr Offline
Hoopy frood

Registered: 12/12/02
Posts: 2809
That will likely have no effect at all. Reading MSDN:

The WM_CTLCOLORBTN message is sent to the parent window of a button before drawing the button. The parent window can change the button's text and background colors. However, only owner-drawn buttons respond to the parent window processing this message.

Note the "owner-drawn buttons", the buttons in mIRC, to my knowledge, are not owner drawn. So that means they would ignore this. What you likely need to do is get the DC of the control and modify it like that.

Top
#11972 - 19/02/03 08:29 PM Re: How to make my DLL change control's properties
vcv Offline
Babel fish

Registered: 09/12/02
Posts: 87
Loc: Amherst, NY
Read further, and you'll find that is only true for buttons, and I think listbox's. Static controls do not need to be owner-drawn to process that message, I guarantee that.

Top
#11973 - 20/02/03 01:00 PM Re: How to make my DLL change control's properties
netgert Offline
Nutrimatic drinks dispenser

Registered: 19/02/03
Posts: 8
Loc: Estonia
But what's the use for SetTextColor and SetBkColor. They're not marked as obsolote. They should send the message to the control to change the color. It is a bad idea to check for that control's type and then send the right message. Why does it all have to be so complicated? Also some other messages, like WM_ENABLE(D - ?) with 0 value does not disable the control. And are all control ID's 6000 + ID in script??? Like when in script my button control ID is 1 then actually it is 6001. Khaled should write developers documentation.

Top
#11974 - 20/02/03 02:14 PM Re: How to make my DLL change control's properties
vcv Offline
Babel fish

Registered: 09/12/02
Posts: 87
Loc: Amherst, NY
They're used for setting the current working colors of a DC (Device Context). use SetTextColor on a DC, then DrawText, and you will see what I mean.

It is NOT used to change the colors of a control.

Top
#11975 - 20/02/03 06:28 PM Re: How to make my DLL change control's properties
Necroman Offline
Babel fish

Registered: 09/12/02
Posts: 89
Khaled is unlikely to write any documentation for developers, as it would bound him to maintain a kind of backward compatibility. He's been using the "6000+id" formula for long, but you aren't getting any guarantees.

Don't wonder why, otherwise you'll probably receive a bunch of "mIRC's his baby" arguments. We are to accept the current state of things. My advice is to taylor your application to a specific version of mIRC. If things change, you'll have to update your application.

Of course it means you can't develop anything serious for mIRC.
_________________________
Sincerely,
Necroman, #mIRC @ Undernet

Top