|
We have several VC7 MFC and ATL applications and are wondering whether to port them over to VC8. The main reason is so that we don't have a mix of development environments - some projects using vs2003 and some using vs2005.
But are there any advantages as far as the libraries go - STL/ATL/MFC? I understand the main change is in the C runtime string functions to reduce buffer overflow problems. Any other changes for better or worse?
|
|
|
|
|
Yes, basically if you use C string functions, you'll get a warning. Beyond that, I see no compelling reason to change, there are some breaking changes for standards, but all reasonably obscure.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Sir,
I want to learn how to make a web application in vc++.net.
Please send any link .
Thanks.
|
|
|
|
|
I don't believe you can use C++ for ASP.NET. Your profile says you know ASP.NET, why do you want to write a web app in c++ ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Hi..
Is there a way to prevent a file from being opened in windows ....
The System is not a part of any network..
There is No other users except Administrator is available in the system.
Thanks
Luck is Opportunity with hardwork
|
|
|
|
|
Asking the question again will not change the answer....
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Luck is Opportunity with hardwork
|
|
|
|
|
Sir,
I want to connect the database(Sql Server) to vc++.net 1.1 programically.I also want to use insert delete update queries in the form .Please help me or please send any link for the problem.
Thanks.
|
|
|
|
|
Did you search on codeproject?
|
|
|
|
|
it is the classic "hello,world" example, I am using VC++6.0,when I create a project and include the .h and .cpp file into it and compile, it pops out these errors:
--------------------Configuration: chapter 1_0 - Win32 Debug--------------------
Compiling...
hello.cpp
Linking...
nafxcwd.lib(thrdcore.obj) : error LNK2001: unresolved external symbol __endthreadex
nafxcwd.lib(thrdcore.obj) : error LNK2001: unresolved external symbol __beginthreadex
Debug/chapter 1_0.exe : fatal error LNK1120: 2 unresolved externals
Error executing link.exe.
chapter 1_0.exe - 3 error(s), 0 warning(s)
[code]
//Hello.h
class CMyApp : public CWinApp
{
public:
virtual BOOL InitInstance ();
};
class CMainWindow : public CFrameWnd
{
public:
CMainWindow ();
protected:
afx_msg void OnPaint ();
DECLARE_MESSAGE_MAP ()
};
//Hello.cpp
#include <afxwin.h>
#include "Hello.h"
CMyApp myApp;
/////////////////////////////////////////////////////////////////////////
// CMyApp member functions
BOOL CMyApp::InitInstance ()
{
m_pMainWnd = new CMainWindow;
m_pMainWnd->ShowWindow (m_nCmdShow);
m_pMainWnd->UpdateWindow ();
return TRUE;
}
/////////////////////////////////////////////////////////////////////////
// CMainWindow message map and member functions
BEGIN_MESSAGE_MAP (CMainWindow, CFrameWnd)
ON_WM_PAINT ()
END_MESSAGE_MAP ()
CMainWindow::CMainWindow ()
{
Create (NULL, _T ("The Hello Application"));
}
void CMainWindow::OnPaint ()
{
CPaintDC dc (this);
CRect rect;
GetClientRect (&rect);
dc.DrawText (_T ("Hello, MFC"), -1, &rect,
DT_SINGLELINE ¦ DT_CENTER ¦ DT_VCENTER);
}
|
|
|
|
|
See MSDN article Q126646.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Oh, I forgot the project setting: "using MFC in a shared DLL"
|
|
|
|
|
|
Hello everyone!
OK, I've been making posts about this specific mother-freaking hair-greener problem, but now I got it just where I want it: I got it down to a 34-line file, no references to it in the rest of the program, just included once in my Includes.h file... Here it is:
<br />
#ifndef _MAPHANDLING_H_<br />
#define _MAPHANDLING_H_<br />
<br />
namespace MapHandling<br />
{<br />
struct TileFile<br />
{<br />
SDL_Surface *layers[4];<br />
<br />
int s, w, h;<br />
<br />
TileFile() : s(0), w(0), h(0) {}<br />
<br />
TileFile(int size, int w, int h, const std::string& filename) :<br />
s(s), w(w), h(h)<br />
{<br />
layers[1] = IMG_Load(filename.c_str());<br />
<br />
if (!layers[1])<br />
exit(0);<br />
}<br />
} Tilesets[1];<br />
<br />
void LoadTiles()<br />
{<br />
Tilesets[0] = TileFile(24, 3, 2, "./Graphics/Tiles.png");<br />
}<br />
};<br />
<br />
#endif // _MAPHANDLING_H_
Note that the exact same thing happens on both VC++ 2005 and Code::Blocks. (Different error messages, of course, but same idea)
These are the VC++ errors:
1>------ Build started: Project: War Game, Configuration: Release Win32 ------<br />
1>Compiling...<br />
1>Player.cpp<br />
1>Main.cpp<br />
1>HelperFuncs.cpp<br />
1>Game.cpp<br />
1>Generating Code...<br />
1>Linking...<br />
1>HelperFuncs.obj : error LNK2005: "void __cdecl MapHandling::LoadTiles(void)" (?LoadTiles@MapHandling@@YAXXZ) already defined in Game.obj<br />
1>HelperFuncs.obj : error LNK2005: "struct MapHandling::TileFile * MapHandling::Tilesets" (?Tilesets@MapHandling@@3PAUTileFile@1@A) already defined in Game.obj<br />
1>Main.obj : error LNK2005: "void __cdecl MapHandling::LoadTiles(void)" (?LoadTiles@MapHandling@@YAXXZ) already defined in Game.obj<br />
1>Main.obj : error LNK2005: "struct MapHandling::TileFile * MapHandling::Tilesets" (?Tilesets@MapHandling@@3PAUTileFile@1@A) already defined in Game.obj<br />
1>Player.obj : error LNK2005: "void __cdecl MapHandling::LoadTiles(void)" (?LoadTiles@MapHandling@@YAXXZ) already defined in Game.obj<br />
1>Player.obj : error LNK2005: "struct MapHandling::TileFile * MapHandling::Tilesets" (?Tilesets@MapHandling@@3PAUTileFile@1@A) already defined in Game.obj<br />
1>..\Release/War Game.exe : fatal error LNK1169: one or more multiply defined symbols found<br />
1>Build log was saved at "file://c:\Incoming\War Game\Visual Studio 2005\Release\BuildLog.htm"<br />
1>War Game - 7 error(s), 0 warning(s)<br />
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
If I remove the #include to this file, it compiles zezw. (Zero Errors, Zero Warnings).
Can anyone tell me what's the problem? I have another file that does the same thing, so I'll post it if needed... Thanks!
Windows Calculator told me I will die at 28.
|
|
|
|
|
Aha! The problem is with variable and function declaration... Look:
<br />
#ifndef _MAPHANDLING_H_<br />
#define _MAPHANDLING_H_<br />
<br />
namespace MapHandling<br />
{<br />
struct TileFile<br />
{<br />
SDL_Surface *layers[4];<br />
<br />
int s, w, h;<br />
<br />
TileFile() : s(0), w(0), h(0) {}<br />
<br />
TileFile(int size, int w, int h, const std::string& filename) :<br />
s(s), w(w), h(h)<br />
{<br />
layers[1] = IMG_Load(filename.c_str());<br />
<br />
if (!layers[1])<br />
exit(0);
}<br />
} TF;
<br />
void func() {};
};<br />
<br />
#endif // _MAPHANDLING_H_<br />
Look at the lines with the HERE on them... Those two cause trouble (a few redefinition errors). So, anyone guess what's wrong? Thanks!
(PS: I doubleposted because the first post would look too long... )
Windows Calculator told me I will die at 28.
|
|
|
|
|
Hello all,
I've downloaded Visual C++ Express Edition for the first time and I enjoy programming with it. I have a question that I can't seem to figure out. Everytime I start a new C++ project, I have to constantly write the preprocessor directive "#include <iostream>" in my programs. How do I go about starting new projects with this directive already included in my programs? Thanks!
|
|
|
|
|
You can't. Having to put that through your files is part of C++. You may be able to create an appwizard that has the includes you tend to use in your main cpp file, but that's about it.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
I have a grid (Chris Maunder's MFC Grid) on a formview in one pane of a CSplitterWnd object. The formview has a function called Refresh(). Inside of Refresh(), I call a function of the grid (SetRowCount(1)). Within SetRowCount() it checks to see if 'rows' that I sent in is equal to GetRowCount() like so:
ASSERT(nRows >= 0);
if (nRows == GetRowCount())
return bResult;
This works fine when Refresh is called from anywhere else within the form itself. The Refresh() function is public and from another pane I get the CMainFrame* (which has a pointer to the Form that has the grid) and I call the Refresh() function and I get an Access Violation error on this line:
int GetRowCount() const { return m_nRows; }
which is being called from the code above in SetRowCount(). Does anyone have any idea what the ^&*( is going on?
Thanks,
|
|
|
|
|
before you make that call to GetRowCount, what does the pointer to the Grid look like ? is it the same value you see when you call Grid functions that don't cause AVs ?
cause, that sounds a bit like a bogus pointer problem...
|
|
|
|
|
BlackDice wrote: Does anyone have any idea what the ^&*( is going on?
Is this NULL or a dangling/invalid pointer? Sounds like it...
--
Secreted by the Comedy Bee
|
|
|
|
|
I found out what it was. I've got 5 different panes that all call back to CMainFrame with functions like SetLeftView(), SetRightView(), etc. I called SetRightView() instead of SetLeftView(), but I'm surprised it even made it that far.
Thanks,
|
|
|
|
|
Hi all.
I'd search in the board how an can get text that is at the coordinate x,y (I have a flexgrid on external program and want to get the text of some row/column by its x,y coordinates.
I didn't found nothing. Can someone help me?
Please, help me.
Thx in advance.
Best Regards,
Marco Alves.
|
|
|
|
|
capture the window as a bitmap, then do some OCR to try to figure out what the text is
|
|
|
|
|
<sarcasm>Yeah, that's what he was looking for</sarcasm>
led mike
|
|
|
|
|
that's wasn't sarcasm. text isn't stored on-screen anywhere as text. by the time the output of TextOut gets to the screen, it's just brightly-glowing dots. the only way to know what text is at x,y is if you keep track of that info as you draw it. but if you're not the one drawing it...
|
|
|
|