|
Have a look at the Shell API functions PathIsUNCServerShare(), PathIsUNCServer(), PathIsUNC(). If it isn't a UNC use GetFullPathName() and then compare the drives. If it is the get the UNC and sharename and compare those.
Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com
|
|
|
|
|
I'm a bit confused on the difference between MFC, C# and Visual Basic. I started to study MFC, but it seems that many programmers are migrating into C#. I'm thinking I should abandon MFC and pursue C# instead. I am using VC++ and am asking these questions from the perspective of an VC++ user.
Do you program C# using Visual C++ or is there a different program? If so, what is it?
Is C# similar to MFC?
How does Visual Basic relate to C# for creating desktop applications?
Are both MFC and C# based on the Windows API?
Is C# based upon MFC?
Can you just program using C++ and the Windows API? I believe the answer to this is yes. If so, is this what a lot of programmers do? I just bought Charles Petzold's book on Window's Programming 5th edition. It's very interesting. He appears to be creating everything from scratch using the Windows API. SO I'm thinking that MFC, C# and Visual Basic are simply Microsoft's attempt to simplify programming with the Windows API by creating a higher level language(but at the expense of programming ability and power). Is this true or am I thinking wrong on this?
Thanks, Dave
I sure would appreciate any information as I'm trying to decide which direction to go here in my studies.
Thanks,Dave
"The man who reads nothing is better educated than the man who reads nothing but newspapers."- Thomas Jefferson
|
|
|
|
|
C# is a new language that looks a bit like C++ and a bit like Java, but it is distinct from both. It is designed to work with the .NET Framework, which is (from the 1000-mile perspective) a virtual machine - it doesn't compile to native code in this environment.
You can currently compile programs written in C# either with the .NET Framework SDK[^] (I would have provided a direct link but MS' Downloads page is down at the moment...) or with Visual Studio .NET[^].
C# is just a language; to provide windowing, the .NET Framework provides the Windows Forms environment (the System.Windows.Forms namespace). This is much like VB 6.0 in that it's designed for form-based applications more than document/view applications. However, document/view isn't completely impossible in C#...
If you need to write a document-based application, I'd stick to MFC for the moment. Forms are easier in VB 6/Windows Forms; document-based applications are easier in MFC, IMO.
If you find that you need access to the Win32 SDK directly, you can always call it from C++, whatever framework you use for writing your application. MFC is an open framework in this regard. In C# you can use the [DllImport] attribute to use a facility called Platform Invoke (or P/Invoke for short) to escape the managed environment.
|
|
|
|
|
|
Thanks Mike
"The man who reads nothing is better educated than the man who reads nothing but newspapers."- Thomas Jefferson
|
|
|
|
|
Hello,
I program using VC++ and MFC.
C# is a language that combines C++ and Java. ( I might be wrong, but the syntax looks similar to the syntax of Java ). The goal of C# is to make programming a lot easier, but you have to pay the price that the performance is not completely in you hands among other things!
The windows api is written in C and other low languages I believe (this is just a guess!) but I know one thing for sure. MFC wraps these api's. The reason is to honor the OOP concept. C++ is a OOP language so why should anyone use api's. There are several reasons you should find yourself.
The power you have with C/C++ is not lost with MFC, it's more secure. You can do anything that was legal in pure C! If you want to do some crazy things, just work around the MFC or rewrite some of the core functions...
I don't know anything about VB...
Wich direcion you should go depends on what you want. If you are a control freak like myself you should study MFC and C++ (then again I don't know anything about VB). If you are lazy and prefer fast development study C#. If you want a bit of everything, study a bit of everything .
I hope this information helps. Good luck...
|
|
|
|
|
Thanks Bob...every bit of advice helps.
"The man who reads nothing is better educated than the man who reads nothing but newspapers."- Thomas Jefferson
|
|
|
|
|
I assume you are talking about the file view of your project?? If you look on the disk there is no folder created.
John
|
|
|
|
|
Yes, in the file view. What disk are you referring to? Do you mean on the CD? Even if I create a program from scratch, I still get the "External Dependencies" folder. I was just curious what it was, I see from Andrew's post that it's for defining different size vaiables. I'm not sure why that happens...I thought everything was defined in the program...hmmm.
Thanks
"The man who reads nothing is better educated than the man who reads nothing but newspapers."- Thomas Jefferson
|
|
|
|
|
DaveE9th wrote:
What disk are you referring to?
The disk drive where your project is located. The "External Dependencies" folder is harmless and gives you a list of the files that are included in your project by other include files and not in a .cpp file.
John
|
|
|
|
|
Thanks again
"The man who reads nothing is better educated than the man who reads nothing but newspapers."- Thomas Jefferson
|
|
|
|
|
It lists all include files that are included indirect in my project. then why doesn't it list afx.h, ... when I only include afxwin.h?
thanks
|
|
|
|
|
I am not exactly sure. It may be do to the way you include them #include <afx.h> or #include "afx.h". I do know that all the header files from libraries that I have included using a single include file in my stdafx.h file are put in this list. For me this is several hundred files..
John
|
|
|
|
|
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.)
|
|
|
|