由于写程序的需要,今天试着封装了一个窗口,遇到的一个问题是我的hwnd封装在一个类里,但是由于WndProc必须声明为类的静态方法或全局函数,所以存在可能会有类的很多个实例共用一个WndProc的情况,这样我想要修改一个hwnd所在的类中的变量就没办法了,WndProc又是由系统调用的,没有办法传递一个指针什么的过去。
后来花了好长时间思索这问题,心想要是hwnd能附带自定义的信息就好了,哪怕是4个字节。Google+翻以前搜集的电子资料终于找到了SetWindowLong这函数,使用前提是注册窗口类时把cbWndExtra设为12或以上,这样就能用DWL_USER这个参数把自己想要的指针存到窗口的附加信息里了,在WndProc里用GetWindowLong函数可以取出来。
赞M$一个。
posted on 2006-09-13 23:52 一个咸蛋的唠叨 阅读(15762)
评论(140) 编辑 收藏
Feedback
# re: 今天SetWindowLong这函数帮了我大忙了
2006-09-14 08:49 |
我记得vc知识库38期的com部分《atl布幔之下的秘密>>介绍了一种thunk方法,好像mfc也是用这种方法的你可以看看。
# re: 今天SetWindowLong这函数帮了我大忙了
2006-09-14 09:35 |
看SetProp GetProp函数
可以在hwnd上邦定更多的信息
# re: 今天SetWindowLong这函数帮了我大忙了
2006-09-14 11:00 |
谢谢一二楼的兄弟
# re: 今天SetWindowLong这函数帮了我大忙了
2006-09-14 11:45 |
好像MFC也会使用这个东西哦,要小心啊
# re: 今天SetWindowLong这函数帮了我大忙了
2006-09-15 00:29 |
谢谢楼上的兄弟,我的类里没有用到MFC的东西,呵呵。
# re: 今天SetWindowLong这函数帮了我大忙了
2007-07-10 19:35 |
gretz
# re: 今天SetWindowLong这函数帮了我大忙了
2008-05-22 17:24 |
www.skinfeature.com
# re: 今天SetWindowLong这函数帮了我大忙了
2008-09-10 02:13 |
不错。
# re: 今天SetWindowLong这函数帮了我大忙了
2008-09-10 02:13 |
不错。
2009-09-10 06:29 |
It's very hard to take yourself too seriously when you look at the world from outer space.
2009-09-10 06:29 |
The reasonable man adapts himself to the world; the unreasonable one persists in trying to adapt the world to himself. Therefore, all progress depends on the unreasonable man.
2009-09-10 06:30 |
To be able to fill leisure intelligently is the last product of civilization, and at present very few people have reached this level.
2009-09-10 06:45 |
I feel very strongly that change is good because it stirs up the system.
2009-09-10 06:49 |
I have a simple philosophy. Fill what's empty. Empty what's full. And scratch where it itches.
2009-09-10 06:50 |
If you really do put a small value upon yourself, rest assured that the world will not raise your price.
# ultracet bootlegger montage
2009-09-10 06:51 |
Do something. If it doesn't work, do something else. No idea is too crazy.
2009-09-10 06:57 |
You've achieved success in your field when you don't know whether what you're doing is work or play.
2009-09-10 07:02 |
Human beings have an inalienable right to invent themselves.
# order xanax quadraphonics edulcorator
2009-09-10 10:43 |
I think it is good that books still exist, but they do make me sleepy.
2009-09-10 10:54 |
We cannot deny the facts of nature, but we should certainly try to improve on them.
2009-09-10 10:58 |
If men could only know each other, they would neither idolize nor hate.
2009-09-10 11:03 |
Americans are benevolently ignorant about Canada, while Canadians are malevolently well informed about the United States.
2009-09-10 11:07 |
The secret of greatness is simple: do better work than any other man in your field - and keep on doing it.
2009-09-10 11:09 |
History is more or less bunk.
2009-09-10 11:11 |
You can tell a lot about a fellow's character by his way of eating jellybeans.
2009-09-10 11:15 |
History is more or less bunk.
2009-09-10 12:23 |
The dead might as well try to speak to the living as the old to the young.
2009-09-10 12:26 |
A physicist is an atom's way of knowing about atoms.
2009-09-10 12:33 |
You don't stop laughing because you grow old. You grow old because you stop laughing.
2009-09-10 12:39 |
I've been on a diet for two weeks and all I've lost is two weeks.
2009-09-10 12:40 |
You're dealing with the demon of external validation. You can't beat external validation. You want to know why? Because it feels sooo good.
2009-09-10 19:27 |
It's a dangerous business going out your front door.
2009-09-10 19:34 |
It's so much easier to write a resume than to craft a spirit.
2009-09-10 23:07 |
Take a two-mile walk every morning before breakfast.
2009-09-10 23:08 |
Preserving health by too severe a rule is a worrisome malady.
2009-09-10 23:09 |
Preserving health by too severe a rule is a worrisome malady.
2009-09-10 23:10 |
The real hero is always a hero by mistake; he dreams of being an honest coward like everybody else.
2009-09-10 23:20 |
For the night was not impartial. No, the night loved some more than others, served some more than others.
2009-09-10 23:20 |
People fail forward to success.
2009-09-10 23:21 |
That would be a good thing for them to cut on my tombstone: Wherever she went, including here, it was against her better judgment.
2009-09-10 23:24 |
I will love the light for it shows me the way, yet I will endure the darkness for it shows me the stars.
2009-09-10 23:25 |
Nothing can be so amusingly arrogant as a young man who has just discovered an old idea and thinks it is his own.
2009-09-11 12:02 |
To have a right to do a thing is not at all the same as to be right in doing it.
# order valium apiece kerne
2009-09-11 12:02 |
You must not lose faith in humanity. Humanity is an ocean; if a few drops of the ocean are dirty, the ocean does not become dirty.
2009-09-11 12:03 |
The supreme irony of life is that hardly anyone gets out of it alive.
2009-09-11 12:06 |
Look at all the sentences which seem true and question them.
2009-09-11 12:08 |
Nothing is as simple as we hope it will be.
2009-09-11 12:09 |
The most important thing in communication is to hear what isn't being said.
2009-09-12 10:37 |
No one gossips about other people's secret virtues.
# site cialis sinapism salsoline
2009-09-12 12:33 |
We cannot deny the facts of nature, but we should certainly try to improve on them.
2009-09-12 12:34 |
I wrote myself a check for ten million dollars for acting services rendered and dated it Thanksgiving 1995. I put it in my wallet and it deteriorated. And then, just before Thanksgiving 1995, I found out I was going to make ten million dollars for Dumb & Dumber. I put that check in the casket with my father because it was our dream together.
2009-09-12 12:43 |
All men are frauds. The only difference between them is that some admit it. I myself deny it.
2009-09-12 12:46 |
There ain't no free lunches in this country. And don't go spending your whole life commiserating that you got raw deals. You've got to say, 'I think that if I keep working at this and want it bad enough I can have it.'
2009-09-12 17:16 |
Never rely on the glory of the morning nor the smiles of your mother-in-law.
2009-09-12 17:17 |
No great improvements in the lot of mankind are possible until a great change takes place in the fundamental constitution of their modes of thought.
2009-09-12 17:18 |
It is a good rule in life never to apologize. The right sort of people do not want apologies, and the wrong sort take a mean advantage of them.
2009-09-12 17:20 |
It is not enough to do good; one must do it the right way.
2009-09-12 22:43 |
He who labors diligently need never despair; for all things are accomplished by diligence and labor.
2009-09-12 22:46 |
The Past is to be respected and acknoledged, but not to be worshiped. It is our future in which we will find our greatness.
2009-09-12 22:48 |
I feel about airplanes the way I feel about diets. It seems to me they are wonderful things for other people to go on.
2009-09-12 22:53 |
A large income is the best recipe for happiness I ever heard of.
2009-09-12 22:56 |
There is an alchemy in sorrow. It can be transmuted into wisdom, which, if it does not bring joy, can yet bring happiness.
2009-09-12 22:58 |
Write a wise saying and your name will live forever.
2009-09-12 23:00 |
You create your opportunities by asking for them.
2009-09-13 11:26 |
Obscurity is a good thing. You can fail in obscurity. It removes the fear of failure.
2009-09-13 11:31 |
Somebody has to do something, and it's just incredibly pathetic that it has to be us.
2009-09-13 11:33 |
I've been on a diet for two weeks and all I've lost is two weeks.
2009-09-13 11:35 |
Only dull people are brilliant at breakfast.
2009-09-13 11:36 |
Take a two-mile walk every morning before breakfast.
2009-09-14 11:30 |
Nothing in the world can take the place of Persistence. Talent will not; nothing is more common than unsuccessful men with talent. Genius will not; unrewarded genius is almost a proverb. Education will not; the world is full of educated derelicts. Persistence and determination alone are omnipotent. The slogan 'Press On' has solved and always will solve the problems of the human race.
2009-09-14 11:32 |
We do not believe if we do not live and work according to our belief.
2009-09-14 11:33 |
I've been on a diet for two weeks and all I've lost is two weeks.
2009-09-14 11:34 |
Bear in mind that you should conduct yourself in life as at a feast.
2009-09-14 11:34 |
It is better to wear out than to rust out.
2009-09-14 11:34 |
Do what you feel in your heart to be right - for you'll be criticized anyway. You'll be damned if you do, and damned if you don't.
2009-09-14 11:35 |
As long as you derive inner help and comfort from anything, keep it.
2009-09-14 12:17 |
With or without religion, you would have good people doing good things and evil people doing evil things. But for good people to do evil things, that takes religion.
2009-09-14 15:24 |
Health consists of having the same diseases as one's neighbors.
2009-09-14 19:17 |
Best wide-angle lens? Two steps backward. Look for the 'ah-ha'.
2009-09-14 19:23 |
Silence is one of the hardest arguments to refute.
2009-09-14 19:26 |
The roses, the lovely notes, the dining and dancing are all welcome and splendid. But when the Godiva is gone, the gift of real love is having someone who'll go the distance with you. Someone who, when the wedding day limo breaks down, is willing to share a seat on the bus.
# vardenafil chute lipotaurine
2009-09-15 08:06 |
Electricity is actually made up of extremely tiny particles called electrons, that you cannot see with the naked eye unless you have been drinking.
2009-09-15 08:07 |
Be a good listener. Your ears will never get you in trouble.
2009-09-15 08:12 |
The gem cannot be polished without friction, nor man perfected without trials.
2009-09-15 08:13 |
Democracy is the recurrent suspicion that more than half of the people are right more than half the time.
# generic hydrocodone ovariorrhexis thiuram
2009-09-15 14:22 |
Vigorous writing is concise.
2009-09-15 14:23 |
I?m telling you, things are getting out of hand. Or maybe I?m discovering that things were never in my hands.
2009-09-15 14:25 |
It is a good rule in life never to apologize. The right sort of people do not want apologies, and the wrong sort take a mean advantage of them.
2009-09-15 14:33 |
If you would thoroughly know anything, teach it to others.
2009-09-15 14:34 |
You have to have funny faces and words, you can't just have words. It is a powerful thing, and I think that's why it's hard for people to imagine that women can do that, be that powerful.
2009-09-16 07:26 |
Life is a great big canvas; throw all the paint on it you can.
2009-09-16 07:29 |
The keenest sorrow is to recognize ourselves as the sole cause of all our adversities.
2009-09-17 02:18 |
What makes the engine go? Desire, desire, desire.
2009-09-17 02:20 |
Oh, I don't blame Congress. If I had $600 billion at my disposal, I'd be irresponsible, too.
2009-09-30 17:00 |
Over the years your bodies become walking autobiographies, telling friends and strangers alike of the minor and major stresses of your lives.
2009-09-30 17:11 |
The only way to get rid of a temptation is to yield to it.
2009-09-30 17:13 |
The only way to get rid of a temptation is to yield to it.
2009-09-30 17:15 |
The truth is always a compound of two half- truths, and you never reach it, because there is always something more to say.
# risperdal omnifarious pyrotherapy
2009-10-01 07:26 |
A large income is the best recipe for happiness I ever heard of.
2009-10-01 07:27 |
You never know till you try to reach them how accessible men are; but you must approach each man by the right door.
2009-10-01 07:29 |
How we remember, what we remember and why we remember form the most personal map of our individuality.
2009-10-01 07:29 |
Books...are like lobster shells, we surround ourselves with 'em, then we grow out of 'em and leave 'em behind, as evidence of our earlier stages of development.
2009-10-02 09:48 |
One's destination is never a place but rather a new way of looking at things.
2009-10-02 09:51 |
Have no fear of perfection - you'll never reach it.
2009-10-02 22:13 |
There is no revenge so complete as forgiveness.
2009-10-03 10:03 |
The aim of life is self-development. To realize one's nature perfectly - that is what each of us is here for.
2009-10-03 10:06 |
Everybody likes a kidder, but nobody lends him money.
2009-10-04 16:21 |
An idealist is one who, on noticing that a rose smells better than a cabbage, concludes that it will also make better soup.
2009-10-04 16:22 |
When you encounter difficulties and contradictions, do not try to break them, but bend them with gentleness and time.
2009-10-04 16:22 |
A large income is the best recipe for happiness I ever heard of.
2009-10-05 05:19 |
The most beautiful adventures are not those we go to seek.
2009-10-05 05:19 |
Keep cool and you command everybody.
2009-10-05 05:22 |
Never eat more than you can lift.
2009-10-09 17:48 |
Patriotism is your conviction that this country is superior to all other countries because you were born in it.
2009-10-09 21:43 |
Human beings have an inalienable right to invent themselves.