|
OK so I have my project open and im looking at the current file and on the left is my workspace. Workspace has three tabs
ClassView
ResourceView
FileView
Sometimes, it appears random but im sure its something im doing, one of my classes dissapears from the ClassView. The #include files are still there and everything compiles fine I just cant see the class in the workspace. This also causes the wonderfull shortcuts where you type -> or . to access member functions to no longer work forcing me to look up class definitions of many libraries. Why does this happen and how can I stop it?
Eric
|
|
|
|
|
Install Visual Assist. It will help with the . -> thing, and even turn . into -> where needed ( no good for smart pointers ).
Christian
come on all you MS suckups, defend your sugar-daddy now. - Chris Losinger - 11/07/2002
|
|
|
|
|
Thanks for your help Chris
|
|
|
|
|
This problem comes from a bad update of the .ncb file.
Send me a mail, and i´ll mail you back the OpenVC dll which installs an add-in in VC++ (a button which erases .NCB file and reopens your windows). It is very easy to do, and kicks ass.
~RaGE();
|
|
|
|
|
This is what I use...
BOOL DoEvents()
{
MSG msg;
while ( ::PeekMessage( &msg, NULL, 0, 0, PM_NOREMOVE ) )
{
if ( !AfxGetApp()->PumpMessage( ) )
{
::PostQuitMessage( 1 );
return FALSE;
}
}
LONG lIdle = 0;
while (AfxGetApp()->OnIdle(lIdle++ ) )
;
return TRUE;
}
|
|
|
|
|
Is there any simple method to convert from double to CString(i have seen _ecvt(),_gcvt(),_fcvt() but too complex )i need something like Javas .toString(1234.4432) method.
THANX
|
|
|
|
|
Check for the Format member function for CString s.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Ok, here's the deal.
I got an "array" of 60 normal variables
and a separate "array" of 10 filler (fake) variables
I need to go through the "array" of 60 and
as I do I need to randomly place all the variables
of the "array" of 10 between some of those of the first array
if I just do something like if(rand()%(60/10))
use normal;
else
use filler;
I might not get all ten variable in. What algorythm should I use
to randomly run each of the 10 variables between the 60 normal ones, and to make sure I do not get a systematic large chunk of normal variables?
P.S. I don't know if what I said is very clear, sorry about that....
|
|
|
|
|
Something like this should work:
int fillers_used=0;
for(int i=n;i<60;++i){
if(fillers_used<10 && rand()%((60-i)/(10-fillers_used))) {
}
else{
++fillers_used;
}
}
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Thanks a lot...
but this way wouldn't the frequency of the filler used be increased as I go through the array?
(nnnnnnnnfnnnnnnnfnnnnnfnnnnfnnfnnff)?
|
|
|
|
|
Well there's a deficiency due to truncation problems, I guess you should use something like this instead:
static double rand01()
{
int r;
while((r=rand())==RAND_MAX);
return (double)rand/RAND_MAX;
}
...
if(rand01()<(double)(10-fillers_used)/(60-i)){
... Apart from this, the process is unbiased. To prove this, we can use a little probability. Let's call Pn the probability that the process uses a filler value at position n. Also, let p=10/60, q=1-(10/60).Then:
P0 = 10/60
P1 = P0·(9/59)+(1-P0)·(10/59) = (10/60)·(9/59)+(50/60)·(10/59) = 590/3540 = 10/60
Pn = pn·((10-n)/(60-n)) + pn-1·q·((10-(n-1))/(60-n)) + ··· + qn·(10/(60-n))
It can be formally proven that Pn = 10/60 for every n, but also a small test program doing the calculations will convince you.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
I have an application written in MFC. The document data of the application contains the File Preview as form of Bitmap.
I show the File Preview in the File Open dialog of my application.
Now I want to enhance this to show the Thumbnail File Preview when the user selects the File in Windows Explorer. This is similar to what the .BMP & .JPEG File does. How can I make the OS aware and as to where the OS can look the File Preview in the File.
Thanks
|
|
|
|
|
"thumbnail preview" is based on .HTT template and a preview activeX. There's a good article on MSDN about this. Have a look to "More Windows 2000 UI Goodies: Extending Explorer Views by Customizing Hypertext Template Files" , msdn.microsoft.com/msdnmag/issues/0600/w2kui2/w2kui2.asp
HTH,
We do not inherit the Earth from our ancestors. We borrow it from our children.
Antoine de Saint Exupéry (1900-1944)
|
|
|
|
|
Thanks Karl.
I shall investigate & let you know after I have implemented it.
|
|
|
|
|
ok I have a pointer to a COblist
CObList* m_Unsorted_Members = GetDocument()->Get_Unsorted();
and im inserting members of the class State. The State Class is inherited from CObject since CObList only takes CObject type.
Container = new State(Name, Loc, pop, area);
m_Bookmark = m_Unsorted_Members->AddTail(Container);
all is good
however when I try and retrieve a member from the list
State* pObject = m_Unsorted_Members->GetAt(m_Bookmark);
I get an error saying that it cant convert from type CObject* to State*
Why is GetAt(m_Bookmark) not returning the same type that I inserted and instead is returning the base class?
thanks in advance,
Eric
|
|
|
|
|
Ok I just fixed my own problem (about 2 min after I wrote this post of course)
needed to add
State* pObject = (State*) m_Unsorted_Members->GetAt(m_Bookmark);
Is that extra code converting from base class to child class? I dont exactly understand the functionality of it.
Either way code works now
|
|
|
|
|
Instead of using CObList directly, you should use CTypedPtrList to make the list typesafe. You can put any pointer which is derived from CObject into a CObList. You also need to cast the value when you take it out of a CObList (which again could lead to errors if the actual pointer is not the type that you are casting it to).
To use CTypedPtrList to contain pointers to State objects, you can declare it as follows:
CTypedPtrList<CObList,State *> stateList;
This list works the same as CObList, except that you can only put State * objects into the list, and any objects you get from the list are State * objects.
So, this works:
m_Bookmark = stateList.AddTail( new State(Name,Loc,pop,area) );
And, this works:
State *pObject = stateList.GetAt( m_Bookmark ); // note: no cast
Best regards,
John
|
|
|
|
|
Thanks for your response. The reason I chose not to make the list typesafe is because I am under the impression that it is more dificult to perform serialization on lists of it is a CTypedPtrList. This is my first time performing serialization using MFC's DOC/VIEW structure as opposed to straight writing to text files.
Was my information correct or is serialization identical for both types of lists?
|
|
|
|
|
You should have no problems with serialization of CTypedPtrList. It is a simple wrapper class for whatever list type is passed as the first argument. Since CObList is being passed as the first argument, it supports serialization the same way as CObList. If you passed a CPtrList as the first argument, it wouldn't support serialization, as serialization isn't supported by CPtrList.
Best regards,
John
|
|
|
|
|
uh whats OLE? whats does it mean? whats the concept? in short: what is it????
I see a lot about OLE controls and all but whats specific about OLE? and is it good?
Kuniva
--------------------------------------------
|
|
|
|
|
stands for Object Linking and Embedding. is a COM based technology and a precursor for activex technology. the older version of OLE which was first used to embed office documents in other documents(like an Excel sheet in a Word doc) and later eveolved into activex/COM/DCOM.
|
|
|
|
|
I am working on a project in CWeb, where I work on a source file foo.w , which is then compiled by a custom build step to produce foo.c , foo.h , and foo.tex . I include foo.c , foo.h , and foo.tex in my project, and use the basic C compiler settings to control the compilation of the .c files and another custom build rule to control the compilation of the documentation foo.tex to foo.pdf .
Here is where I get into trouble. A makefile would have no problem understanding that foo.tex depends on foo.w and that foo.pdf depends on foo.tex , so if foo.w has been changed, a build must FIRST compile foo.w to foo.tex and THEN compile foo.tex to foo.pdf .
I can't seem to get DevStudio to understand this, so when I edit foo.w and hit build, it first compiles foo.tex to foo.pdf and then compiles foo.w to foo.tex !. Any thoughts? This is analogous to things people must also have gone through working with Bison and Flex in DevStudio.
Bomb our homes and threaten our children, and, as difficult as it is, we will still love you --- Martin Luther King, Jr.
|
|
|
|
|
Hi,
Why not create 2 different projects and just have foo.w in one and the other files in the other project. You can then set project dependencies to have the second project (the one with .c,.h and .tex) files to be dependent on the first one. So, when you hit build it will compile the first project (seeing your .w has changed) and then compile the second one (with the newly generated files).
I've never worked with Bison and Flex but this may work..
HTH
Jignesh
|
|
|
|
|
I developed two activex controls, in two seperate projects. Is there an easy way to combine them, so that when the project builds I get two seperate ocx's.
Thanks in advance...
|
|
|
|
|
Say your two controls are Actrl and Bctrl
Open the Actrl project.
Select Insert project into workspace from the Project menu.
Choose the Bctrl project.
Select Dependencies from the Project menu.
Check the Bctrl project.
When ever you build Actrl, Bctrl will also be built if it has changed. A Rebuild all will do both.
A variation of this is to create a wrapper project and add both controls to it.
|
|
|
|