×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Creating a Control

Creating a Control

Creating a Control

(OP)
How does a control handle having multiple instances of itself with different stats?  Am I right in assuming that it has something to do with SetWindowLong and GWL_USERDATA?  How does a control handler get its own title string?

"Information has a tendency to be free.  Which means someone will always tell you something you don't want to know."

RE: Creating a Control

By control do you mean a user control.  The only way to do that is through using indexes.

Craig, mailto:sander@cogeco.ca

"Procrastination is the art of keeping up with yesterday."

I hope my post was helpful!!!

RE: Creating a Control

(OP)
User control or not, a control still has to handle multiple instance of itself with possibly different statuses.  Presumably the way Microsoft recommends to programmers is the way they themselves did it with their own controls.

Can you expound on how they do that with indices?  How is it done?  I have an example in a REALLY OLD book, but it uses a static variable because it's only done once in an instance and in a modal dialog box at that.

"Information has a tendency to be free.  Which means someone will always tell you something you don't want to know."

RE: Creating a Control

There is a really good explanation to this In the Visual Basic(Microsoft) -Version 5 & 6.  Thread222-16995

Craig, mailto:sander@cogeco.ca

"Procrastination is the art of keeping up with yesterday."

I hope my post was helpful!!!

RE: Creating a Control

(OP)
I'm doing this in assembly and I can't make head or tails about all that VB stuff.

Okay, here's what I need to do:

I have two of these child control windows in my program (actually more, but for purposes of testing...).

At a particular time, one of them might have the mouse, or neither might have.

While the child has the mouse, it has a different background.  So it somehow has to save its state (has mouse or does not have mouse) so that the Paint procedure of the control knows whether or not to change the background.

"Information has a tendency to be free.  Which means someone will always tell you something you don't want to know."

RE: Creating a Control

(OP)
I tried doing SetWindowLong() with GWL_USERDATA and it worked.

"Information has a tendency to be free.  Which means someone will always tell you something you don't want to know."

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close