|
In my solution I have 2 projects, a static library project and a executable project.
How do you set the entry point on the executable project to the WinMain() inside the static library?
|
|
|
|
|
In the linker/advanced properties of the project, you should be able to set
an entry point.
Remember you may be bypassing CRT library initialization if that applies.
See /ENTRY (Entry-Point Symbol)[^]
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi,
I want to make my program full screen on device, now when a device key is hit a message or a tool bar come on top and does not go. I want that message dose not come or go after few seconds.
Please help
Thanks a lot
|
|
|
|
|
Suggestion: You can use DirectX APIs to get an exclusive full screen.
|
|
|
|
|
I have to use a third-party ActiveX control in my project,it creates many classes when used in VC 6.0 and is very powerful,but in VC.NET,it creates only one class,and only a few methods,and there are many methods that we can not know the meaning by their names,such as Wrapper1(),Wrapper2()...,so I can not use the control easily,can you tell me how I can use it`s all methods,thanks very much!
|
|
|
|
|
I have picture box within dialog box.
I want to find it's location on dialog box
I used the function as
CRect myRect;
CWnd *ptr = GetDlgItem(IDC_PICTURE);
ptr->GetClientRect(&myRect);
but this gives me height and width of picture box
but i want to find the exact location of picture box
i.e. top-left coordinate of picturebox according to the dialog box client area.
Please help me for this......
Chetan
|
|
|
|
|
CRect myRect;
CWnd *ptr = GetDlgItem(IDC_PICTURE);
ptr->GetWindowRect(&rect);
ScreenToClient(&rect); Using GetWindowRect() returns the screen coordinates of the control. The ScreenToClient() call converts the screen coordinates to client coordinates, in this case relative to the dialog.
Software Zen: delete this;
|
|
|
|
|
Hi,
I recently installed VS8, but don't like it much and would like to switch back to VS6.
Is it possible to install VS8 and VS6 on the same WinXP system. Will this create any conflict?
Thanks.
Fortitudine Vincimus!
|
|
|
|
|
Tara14 wrote: Hi,
I recently installed VS8, but don't like it much and would like to switch back to VS6.
Is it possible to install VS8 and VS6 on the same WinXP system. Will this create any conflict?
Yes, it is possible. I do it without a problem. Just make sure you install VS6 first (uninstall VS8 if currently installed and then reinstall it after VS6).
John Carson
|
|
|
|
|
Thank you.
Fortitudine Vincimus!
|
|
|
|
|
as John said, yes, Both IDE can cohabit.
BTW, do you know that VC6 compiler doesn't fit to the C++ standard ?
VS2003 is far more compliant, and it's said that VS2005 respect it to about 98%.
it's up to you to use VC6 then, but you'd better used yourself to VS2005 anyways...
|
|
|
|
|
We can't blame them for not writing with Industry standard. The finalized version of Visual C++ standard was last released in 1998. I think at the time time, Microsoft released Visual C++ 98 (version 12 I think). still many people are using the same compiler and IDE as they've made up their system using this popular old compiler.
-Sarath.
"Great hopes make everything great possible" - Benjamin Franklin
|
|
|
|
|
Sarath. wrote: still many people are using the same compiler and IDE as they've made up their system using this popular old compiler.
My job still depends on it.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
DavidCrow wrote:
My job still depends on it.
me too
-Sarath.
"Great hopes make everything great possible" - Benjamin Franklin
|
|
|
|
|
Hi,
I have an application written in VC++6 using DAO 3.5 to connect to MS Access. Will this application work in Windows Vita if installed just the way it is? Or will I have to make changes to it?
Unfortunately, I do not have a Vista machine to verify. The application was made to be compatible with win98/XP and now it is required to make it Vista compatible too.
Thank you.
Fortitudine Vincimus!
|
|
|
|
|
It should work, but you have to provide all the required DLLs.
to figure out which one you need to bring with your exe, use Dependency Walker[^] (if you have VC6, you already have it under the name depends.exe )
|
|
|
|
|
|
NOTE: In the following text and code I use [] rather than the greater than and less than signs because of the HTML editor.
I read about class templates in three books and MSDN and thought I understood. So, I created a SDI test project in VC++ to learn about them. I added only this single CTestTemp class. As you can see, I didn't get far. The following code keeps giving me a C2955 (use of class template requires template argument list) error in TestTemp.cpp each place a function is defined (or BEGIN MESSAGE MAP).
I have tried all kinds of argument lists in the constructor function, tried putting template[class T] in various places in the code, but nothing works. If I add a new function, the same error flags the new function. It appears I'm doing somehting wrong in the function definition. I'm at such a basic point, I figure I must be doing somehting equally basic wrong. Ideas? Thanks.
//TestTemp.h
template[class T] <--only thing I add
class CTestTemp : public CWnd
{
public:
CTestTemp();
virtual ~CTestTemp();
protected:
DECLARE_MESSAGE_MAP()
};
//TestTemp.cpp
CTestTemp::CTestTemp() <---error C2955
{
}
CTestTemp::~CTestTemp() <---error C2955
{
}
BEGIN_MESSAGE_MAP(CTestTemp, CWnd) <---error C2955
//{{AFX_MSG_MAP(CTestTemp)
// NOTE - the ClassWizard will add and remove mapping macros here.
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
|
|
|
|
|
you need, at least, to put 'T' into your constructor:
CTestTemp(T t);
without it, you have no way to tell the compiler what type to use for T
|
|
|
|
|
Fixing the constructor/destructor syntax is one thing.
I'm not sure how you're going to get a template class through the
CWnd message map macros though...
template <class T>
class CTestTemp : public CWnd
{
public:
CTestTemp();
virtual ~CTestTemp();
protected:
DECLARE_MESSAGE_MAP()
};
template <class T> CTestTemp<T>::CTestTemp()
{
}
template <class T> CTestTemp<T>::~CTestTemp()
{
}
<font color="Red">
BEGIN_MESSAGE_MAP(CTestTemp<int>, CWnd)
END_MESSAGE_MAP() Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
The problem with templates is that you can't have the definition in a .h and the implementation in .cpp
Templates are like macros in that they are processed before the compilaton proper. There is a reason that I can't remember why that causes the problem... something to do with operating at the file scope rather than program scope
There are a few ways around it, one is to write everything into the class defintion in the .h file. Contrary to popular belief this will not stop your code from working, but it is generally not good practice. There are some more elaborate workarounds out there if you look on Google...
Hope this helps.
|
|
|
|
|
Hi,
I use a c++ class library.
All of the class are derived from one base class (ex 'CObject')
Some class's methods return a pointer(allocated using 'new') to class objects.
So i have to delete those objects. (its hard because of heavy usage of such classes/methods all over the code)
and i have a plan to delete all pointers when app close using a pointer array.
// File : cobject.h
std::vector <CObject*> vecObjPtr;
class CObject
{
CObject::CObject()
{
vecObjPtr.push_back(this);
}
};
// File : keyboard.h
class Keyboard: public CObject
{
Keys* getKeys()
{
return new Keys();
}
};
// File : keys.h
class Keys : public CObject
{
Key* getKey(int value)
{
return new Key(value);
}
};
// File : key.h
class Key : class CObject
{
Key(int value)
{
//...
}
};
#include <cobject.h>
#include ...
...
void main()
{
Keyboard *keybrd = new Keyboard();
Key *key = keybrd->getKeys()->getKey(10);
// done
delete the pointer returned by getKeys,getKey and keybrd by
poping items from vecObjPtr and delete;
}
is it a right way to do or is there any standard way of freeing memory like this ?
thanks in advance
-- modified at 11:36 Sunday 18th November, 2007
|
|
|
|
|
Why do you need a pointer?
e.g. if Key has a constructor Key(int) then instead of "return new Key(10)" with return type Key* you should be doing "return Key(10)" with return type Key. This way the compiler handles the allocations and frees for you.
The only time I ended up keeping track of pointers as you described is when generating strings for an object, and only that one time because I didn't think hard enough about a solution. You can always avoid these situations with better design.
|
|
|
|
|
Thanks Jheriko++,
The c++ library i use returns the allocated pointers and expect from the user of the library to delete these objects. The library has many such methods that returns newly allocated pointers so i cant change it.
every getSomethingX returns a new pointer
getSomething1->getSomething2->getSomething3->getSomething4....
for the flexibility reason i write code like the above otherwise i have to declare new pointer variable for every getSomethingX returned pointer so i can delete it later.
|
|
|
|
|
Its a shame that you are restricted by the library... you can at least avoid this trap in your own code though.
|
|
|
|