|
I've noticed that in many of my VC++ programs that a folder called "External Dependencies" is automatically created in the directory. It contains only one file, basetsd.h I'm curious what this is for. I've not seen that header file before. Thanks, Dave
"The man who reads nothing is better educated than the man who reads nothing but newspapers."- Thomas Jefferson
|
|
|
|
|
I think it's the predominantly the definitions of different sized variables.
typedef signed char INT8, *PINT8;<br />
typedef signed short INT16, *PINT16;<br />
typedef signed int INT32, *PINT32;<br />
typedef signed __int64 INT64, *PINT64;<br />
typedef unsigned char UINT8, *PUINT8;<br />
typedef unsigned short UINT16, *PUINT16;<br />
typedef unsigned int UINT32, *PUINT32;<br />
typedef unsigned __int64 UINT64, *PUINT64;
If you can keep you head when all about you
Are losing theirs and blaming it on you;
If you can dream - and not make dreams your master;
If you can think - and not make thoughts you aim;
Yours is the Earth and everything that's in it.
Rudyard Kipling
|
|
|
|
|
I have included a templated stack class in a visual c++ project(ver 6). It will compile and run fine, but when I try to use class wizard i get the following error message:
Parsing error: Identifier expected.
Input Line: "StackType<CString> hy_back;"
To quote Ned Flander's beatnik parents, "I have tried nothing and am all out of ideas."
Missing: Wonder Cow, LooseScrew, Clark, Screwage, AlterEgo, packingascwdriver, Rob Irtson, IB, George Harrison? I weep. (please, never ask...to painful.)
|
|
|
|
|
Do have this declared inside of the classwizard blocks?
Here are two examples of what I mean (there are more):
John
|
|
|
|
|
I checked but it appears OK. This is kind of a strange problem. My template class is in a header file, because for whatever reason, the compiler would not accept the template class seperated into two files. I tried putting it only in a implementation file, but I get a "unexpected end of file" compiler error. As is, it works, but I can't use class wizard to add functions to the view class, where the stacks are declared. Makes me want to pull my "fricking" hair out.
Below is my stack class, maybe there is something I am missing.
#include <cstddef>
#include <new>
template <class ItemType>
struct NodeType;
template<class ItemType>
class StackType
{
public:
StackType();
void MakeEmpty();
bool IsFull() const;
bool IsEmpty() const;
int LengthIs() const;
void Push(ItemType item);
void Pop(ItemType& item);
private:
NodeType<ItemType>* topPtr;
int length;
};
//implementation
template <class ItemType>
struct NodeType
{
ItemType info;
NodeType<ItemType>* next;
};
template<class ItemType>
StackType<ItemType>::StackType()
{
topPtr = NULL;
length = 0;
}
template<class ItemType>
void StackType<ItemType>::Pop(ItemType& item)
{
if (IsEmpty())
throw CString("PopOnEmptyStack");//PopOnEmptyStack();
else
{
NodeType<ItemType>* tempPtr;
tempPtr = topPtr;
item = topPtr ->info;
//cout<<item<<endl;
topPtr = topPtr->next;
delete tempPtr;
length--;
}
}
template<class ItemType>
bool StackType<ItemType>::IsFull() const
{
NodeType<ItemType>* location = NULL;
location = new NodeType<ItemType>;
if(location != NULL)
{
delete location;
return false;
}
else
{
return true;
}
}
template <class ItemType>
void StackType<ItemType>::Push(ItemType newItem)
{
if (IsFull())
throw CString("PushOnFullStack");//PushOnFullStack();
else
{
NodeType<ItemType>* ptr;
ptr = new NodeType<ItemType>;
ptr->info = newItem;
ptr->next = topPtr;
topPtr = ptr;
length++;
}
}
template <class ItemType>
void StackType<ItemType>::MakeEmpty()
{
NodeType<ItemType>* tempPtr;
while (topPtr != NULL)
{
tempPtr = topPtr;
topPtr = topPtr->next;
delete tempPtr;
}
length = 0;
}
template <class ItemType>
bool StackType<ItemType>::IsEmpty() const
{
return (topPtr == NULL);
}
template <class ItemType>
int StackType<ItemType>::LengthIs() const
{
return length;
}
Missing: Wonder Cow, LooseScrew, Clark, Screwage, AlterEgo, packingascwdriver, Rob Irtson, IB, George Harrison? I weep. (please, never ask...to painful.)
|
|
|
|
|
Wonderful Cow wrote:
I tried putting it only in a implementation file, but I get a "unexpected end of file" compiler error.
Well the short answer is you can't put it in an implementation file. Here is the explanation:
http://www.codeproject.com/cpp/templatesourceorg.asp?target=templates%7C%2Dasp[^]
As for the "unexpected end of file" compiler error that is because you are using precompiled headers. With precompiled headers the first statement in every implementation file must be #include "stdafx.h" otherwise you will have problems...
I would check your view class for the error, it is most likely there.
John
|
|
|
|
|
Perhaps you could try using the standard library stack adapter.
#include <stack>
and replace StackType<CString> hy_back with std::stack<CString> hy_back;
If you can keep you head when all about you
Are losing theirs and blaming it on you;
If you can dream - and not make dreams your master;
If you can think - and not make thoughts you aim;
Yours is the Earth and everything that's in it.
Rudyard Kipling
|
|
|
|
|
I doubt that the error has anything to do with the template for StackType but in my opinion it will be much better to do this. Unless your teacher or boss told you how to implement this I see no reason to reinvent a standard c++ template class...
John
|
|
|
|
|
Process of elimination.
If it won't work, delete the classwizard file and try to rebuild it...
If you can keep you head when all about you
Are losing theirs and blaming it on you;
If you can dream - and not make dreams your master;
If you can think - and not make thoughts you aim;
Yours is the Earth and everything that's in it.
Rudyard Kipling
|
|
|
|
|
The reason why I asked is that these are the tags that the classwizard uses to parse your code.
Move the line :
StackType<CString> hy_back;"
somewhere else in your class definition.
John
|
|
|
|
|
Thank you. That was the problem. It was in the view header between the afx comment tags. I moved it below and It worked. Before, I had been looking in another place. Thanks again.
Missing: Wonder Cow, LooseScrew, Clark, Screwage, AlterEgo, packingascwdriver, Rob Irtson, IB, George Harrison? I weep. (please, never ask...to painful.)
|
|
|
|
|
Thanks all for the tips. I will try a couple of these. I am sure that one will work.
Thanks a bunch.
Missing: Wonder Cow, LooseScrew, Clark, Screwage, AlterEgo, packingascwdriver, Rob Irtson, IB, George Harrison? I weep. (please, never ask...to painful.)
|
|
|
|
|
CMyFormview is a View in my dll.it is derived from CFormView.Why it does not respond to on_keydown message,also it does not respond to the overrided function PreTranslateMsg .
gucy
|
|
|
|
|
Hello all
I'm writing an application which needs to have name of application which is using serial port. Can any one tell me how to retrieve application name which is using serial port.
Thanks for your help.
Hari
|
|
|
|
|
I can't give you a better guide than to point you in the direction of HandleEx on www.sysinternals.com[^].
Iain.
|
|
|
|
|
How can I execute a function in the context of another thread?
I know about APCs, but these require that the target thread becomes alertable at some point in time. I can not (or do not want to) change the source to the other thread to call SleepEx(0) every so often.
Kernel-mode APCs are ideal for this, because the thread does not need to be alertable. However, it seems like they can only be used by ring 0 apps, and are platform-specific.
Is what I want to do even possible?
|
|
|
|
|
If the thread is a UI thread, use PostThreadMessage() and pass it a registered message, or a WM_APP+n value. You'll need to arrange some communication to have the sending thread wait until the second thread has finished.
--Mike--
"Big handwavy generalizations made from a position of deep ignorance is one of the biggest wastes of time on the net today.
-- Joel Spolsky
Ericahist | Homepage | RightClick-Encrypt | 1ClickPicGrabber
|
|
|
|
|
Yes, I thought of that. The only problem there is that I want this to work for any thread, whether it has a message loop or not.
|
|
|
|
|
In that case, you want fibers. They are like threads but you control the scheduling of when they run. Start by reading the docs on ConvertThreadToFiber()
--Mike--
"Big handwavy generalizations made from a position of deep ignorance is one of the biggest wastes of time on the net today.
-- Joel Spolsky
Ericahist | Homepage | RightClick-Encrypt | 1ClickPicGrabber
|
|
|
|
|
I'm creating a map editor for a game engine i've been working on. I'm hoping to create the interface in a similar fashion to photoshop. Basically, I have my MDI setup... and i'm creating and displaying small WS_EX_TOOLWINDOW'd dialogs, which will contain information and interaction tools for level editing. But, I'm having a couple problems.
Main Question:
In photoshop, when you click one of the palette windows, focus is not taken from the document. How can I do the same thing? As soon as I click on of my tool windows, no CDocument is active.
Secondary Question:
Also, I can get the small windows to show on top of the application (TOPMOST), and when the app is minimized, i hide the tool windows. But, if I put my app behind others, the tool windows are on top of EVERY window. I only want them on top of MY application, not every running window of every app.
Extra Question:
Also, is there a graceful way to detect when the active document has changed? An event handler, perhaps?
|
|
|
|
|
I keep getting the following error upon linking:
"error LNK2001: unresolved external symbol "public: class CString __thiscall CMyDoc::FKeyReset(int)"
This happens when I try to instantiate a function template. The code snippets are below. Does any one spot an obvious problem in it? Thanks,
Ralf.
MyDoc.h:
template<class t=""> CString FKeyReset(T RecSet);
MyDoc.cpp
template<class t=""> CString FKeyReset(T RecSet) {
CString str;
if(T > 0)
str.Format("message 1");
else
str.Format("message 2");
return str;
}
Elsewhere outside MyDoc:
CMyDoc *pMyDoc = (CFisheriesDoc *) //pointer to MyDoc
((CFrameWnd*) AfxGetApp()->m_pMainWnd)->GetActiveDocument();
CString szAstr;
int i = 2;
szAstr = pMyDoc ->FKeyReset(i); //offending line
ralf.riedel@usm.edu
|
|
|
|
|
|
I'm creating one of the biggest project I have undertaken N I'm a newbie, so I need lots of help. Because it's so big, I break it down into multiple parts (multiple projects, 1 DSP for 1 DSW), which I call utilities.
Now I want to use a "Utility", eg MyCustomStringCls, in another project. I have compiled N tested the "utility" so I have the OBJ file already.
Now here are my Q:
1. When I want to use an utility (eg MyCustomStringCls), in VC++, do I need to "Add To Project > Files" the MyCustomStringCls.h and the .CPP?
2. I want to call include with Angle bracket instead of DoubleQuote, do I just need to "Settings > C/C++ tab > Preprocessor" and add the path to "Additional Include directories" ?
I have done this, but everytime I add new method, which returns MyCustomStringCls object, in my new class, VC++ always add new #include with double quote. I'm fighting with it by manually delete that new include.
eg. For the new class, I want to have:
#include <mycustomstringcls.h>
BUT, VC++ always add this:
#include "..\Prj_MyCustomStringCls\MyCustomStringCls.h"
3. Every time I compile my new Project, it creates the MyCustomStringCls.OBJ and puts it in my new project folder. How do I tell VC++ compiler to skip creating OBJ for particular .H .CPP? And how do I tell linker to use the OBJ from MyCustomStringCls project folder?
Hope I don't confuse anybody. Please Help.
cheers,
Jo
|
|
|
|
|
consider creating LIB files for stuff you want to reuse.
A "lib" (library) is just a single file that contains one or more OBJ files. They are packaged into a single lib file, the linker can selectively pull obj files that are needed into your other projects....
To link this lib into other projects -- you'll need to update the settings on your project to generate a lib for a set of files. And also you'll need to create one or more H files to include in those other projects....
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br />
Peter Weyzen<br />
Staff Engineer<br />
<A HREF="http://www.santacruznetworks.com">Santa Cruz Networks</A>
|
|
|
|
|
Peter,
I have never made LIB file. I'm reading the VC++ help on creating LIB, but I'm kinda of lost. Can you give me more pointer on how to do it, please?
cheers,
Jo
|
|
|
|
|