|
If you are in a worker thread you can't make direct calls to CWnd objects created in the main (GUI) thread. Instead, you need to pass a window handle (HWND) to the thread function and use it there to send or post private messages (WM_USER + n) from the worker thread to that window.
--
jlr
http://jlamas.blogspot.com/[^]
|
|
|
|
|
This thread is a user-interface thread, I overrode CWinThread and pass the runtime class name to AfxBeginThread just as the documentation say you're supposed to do for a user-interface thread. I was trying to figure out a way to use messages but maybe I don't know as much as I need to.
I defined a message like:
#define WM_UPDATECHILD (WM_APP + 1)
And tried to create a handler function for that message but it would never be run. I tried to override PreTranslateMessage, OnCmdMsg, and OnCommand to intercept this message, handle it, then return a nonzero result to show it was handled and none of this worked. I just don't know what to do.
|
|
|
|
|
When you invalidate a rectangle/region, this area does not get updated straight away. It will get updated the next time Windows decides to send your app a WM_PAINT message.
To force an update after you invalidate a region, call the UpdateWindow API
James
http://www.catch22.net
|
|
|
|
|
can an MFC DLL server created in VC be used by a VB client? because most articles that i read that allows VB client are ATL and win32 dlls.
|
|
|
|
|
if you are talking about ATL com, yes.
Then you need to take care of data been exchanged between VB and COM.
I dont remember where, but somewhere I have read on how to write a COM object in VC for VB.
-prakash
|
|
|
|
|
I'm having to develop an application that keeps track of horses with their winnings and other such information dealing with horse races. We only have to track 3 horses, but what if there were 100 horses, which it'll have to do eventually? I don't want to have to type HorseName.ShowStatistics that many times. Is there a way to loop through the horse objects and run that specific objects method within the loop? How would I go about doing that?
Thanks
|
|
|
|
|
Horses oHorses[100];
or Horses *pHoress = new Horses[100]
<<Initialise the horses members>>
for(i=0;i<100;i++)
{
pHorses[i]->ShowStat();
}
-prakash
-- modified at 21:41 Thursday 6th October, 2005
|
|
|
|
|
To complete previous response, you can use the vector from the STL. This will allow you to have an array of objects (Horses in your case) where you can dynamically add and remove elements.
|
|
|
|
|
I compile the following C++ code VS.NET2003 IDE and the compiler enter an infinit/endless compiling process, What's wrong within it?
The code is given as following:
//The testtempl.h
#ifndef __TESTTEMPL_H__
#define __TESTTEMPL_H__
#include <stdlib.h>
#include <stdio.h>
#include <vector>
template<int n> class MyTempl
{
public:
std::vector<int> m_array;
public:
MyTempl()
{
m_array.assign(n, n);
}
int Summation()
{
int rn = 0;
for(int i = 0; i < (int)m_array.size(); i++)
rn += m_array[i];
return rn;
}
int Foo()
{
if(n <= 1)
return 1;
else
{
int r = 0;
MyTempl<n-1> mtempl;
r = mtempl.Foo()*Summation();
return r;
}
}
};
typedef MyTempl<4> My4Foo;
#endif
//The testtempl.cpp file
#include "testtempl.h"
int main(int argc, char* argv[])
{
My4Foo myfoo;
int i = myfoo.Foo();
printf("foo value: %u\n", i);
return 0;
}
-- modified at 19:25 Thursday 6th October, 2005
|
|
|
|
|
First of all, check 'do not treat < as html' below, so we can SEE the code
I think this line
MyTempl<n-1> mtempl;
means that every time the compiler creates a template class, it needs to create a new one, recursively forever. Hence the error.
Christian Graus - Microsoft MVP - C++
-- modified at 18:51 Thursday 6th October, 2005
|
|
|
|
|
I haven't tested it, but I think one way to avoid the problem while maintaining the recursive nature of the solution would be to do as follows:
In the class declaration, declare only the prototype for the Foo method:
int Foo();
Then, provide a general implementation for Foo():
template<int n>
int MyTempl::Foo()
{
int r = 0;
MyTempl<n-1> mtempl;
r = mtempl.Foo()*Summation();
return r;
}
Finally, provide an explicit implementation for the 1 case, so as to end the recursion:
template<1>
int MyTempl::Foo()
{
return 1;
}
--
jlr
http://jlamas.blogspot.com/[^]
|
|
|
|
|
Kinda offtopic question;
Whenever I startup Windows Media Center, the actual program, not the OS, Visual C++ starts up and starts debugging. Everytime (I think its called ehShell.exe), the debugger starts up. Its slowing down the computer significantly. Is there anyway to stop this from doing it? Thanks alot
Dave
|
|
|
|
|
Anyone know of a good book covering Boost?
ed
~"Watch your thoughts; they become your words. Watch your words they become your actions.
Watch your actions; they become your habits. Watch your habits; they become your character.
Watch your character; it becomes your destiny."
-Frank Outlaw.
|
|
|
|
|
There are books on some Boost libraries, like Graph, and metaprogramming, but AFAIK, no book covers "all Boost".
My programming blahblahblah blog. If you ever find anything useful here, please let me know to remove it.
|
|
|
|
|
|
hi guyz
i am a complete begginer in programming stuff and it seems like i am stuck in a very bad situation, tht i have to do a project in c "motion capturing and detection"
now cause i ama compplete begginer....
i need ur help in these... plz help me by sending any good information or algorithm related this topic...
plzz i need ur help
u can also email me.
sH*t haPPeNs
|
|
|
|
|
It's a pity. So many interests, but no idea...
|
|
|
|
|
You little scumbag! I got your name, I got your ass! You will not laugh, you will not cry, you will learn by the numbers, I will teach you! Now get up off your face! Col.Walter.E.Kurtz you better unfuck yourself before I unscrew your head and sh*t down your neck!
Now choke yourself.
|
|
|
|
|
I've seen horrors... horrors that you've seen. But you have no right to call me a murderer. You have a right to kill me. You have a right to do that... but you have no right to judge me.
Horror and moral terror are your friends. If they are not then they are enemies to be feared.
|
|
|
|
|
Col.Walter.E.Kurtz, you climb obstacles like old people f***.
Now choke yourself.
|
|
|
|
|
I watched a snail crawl along the edge of a straight razor. That's my dream. That's my nightmare. Crawling, slithering, along the edge of a straight... razor... and surviving.
Horror and moral terror are your friends. If they are not then they are enemies to be feared.
|
|
|
|
|
I'll bet you're the kind of guy that would f*** a person in the ass and not even have the goddam common courtesy to give him a reach-around. I'll be watching you.
Now choke yourself.
|
|
|
|
|
You're an errand boy, sent by grocery clerks, to collect a bill.
Horror and moral terror are your friends. If they are not then they are enemies to be feared.
|
|
|
|
|
I am Gunnery Sergeant Hartman, your senior drill instructor. From now on you will speak only when spoken to, and the first and last word out of your filthy sewer will be sir.
Now choke yourself.
|
|
|
|
|
Gunnery Sergeant Hartman wrote:
I am Gunnery Sergeant Hartman, your senior drill instructor. From now on you will speak only when spoken to, and the first and last word out of your filthy sewer will be sir.
Is this your play ground..? Shut Up and get to your work (what ever you do).... disrespectful and rude language is not allowed here.. for any so called reason...?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
-- modified at 0:31 Friday 7th October, 2005
|
|
|
|