|
M A V wrote:
The problem Is that when the program is terminated incorrectly, the garbage appears inside a file sometimes....
If you manually open the file in append mode, write to the file, and then manually close it every time then you are unlikely to experience the corruption you are talking about.
The only way it could get corrupted is if the system were incorrectly shut down during the few milliseconds that the file were open.
|
|
|
|
|
Is there a way to get the position of the users mouse, and/or move the cursor to a selected part of the screen in MFC? Any help would be appreciated.
-Dev578
|
|
|
|
|
GetCursorPos, SetCursorPos
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Wasn't expecting it to be that easy, ty Believe it or not that actually helped me out quite a bit.
thanks again
-Dev578
|
|
|
|
|
Hi there...
I'm using VC6 & STL in my program along with Openssl.
I'm getting compilation error in OpenSSL\bn.h
The error is as follows:-
error C2955: 'modulus' : use of class template requires template argument list
c:\program files\microsoft visual studio\vc98\include\functional(57) : see declaration of 'modulus'
There seems to be some kind of conflict in template names, because STL and OpenSSL structure are using same template name.
Is there any simple workaround for this ?
Any help is appreciated.
Cheers,
Sheetal.
|
|
|
|
|
Have you inserted
using namespace std; before including "bn.h" ? If so, try deleting the using directive.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
How do I always show the vertical scrollbar in an CListCtrl (report view)? Just call ShowScrollBar( SB_VERT, true ); in every OnSize method doesn't work, because then the last column (which has the flag LVSCW_AUTOSIZE_USEHEADER) is too big.
The implementation of the CListCtrl seems to be really clumsy, because it is somehow handled completely different than in any other WIN32-Control. Thanks for any answer.
Konrad
|
|
|
|
|
Hi,
I'm trying to solve the very same problem and I haven't been successfull with that ShowScrollbar-function either.. It doesn't help that I'm not that experienced with MFC.
I'm wondering that could this be solved by simply using the WS_VSCROLL style when creating the control?
Well, in my app the scrollbar _does_ show in certain situations when using that style (even if there are only few items in the report view and therefore no actual need for the scrollbar) but I haven't been able to pinpoint the exact conditions for this. My guess is that this behavior has something to do with redrawing.. You tell me
But hey, give it a try and let the world know if it works..
-Jussi
|
|
|
|
|
How to overcome this error following error
LINK : fatal error LNK1181: cannot open input file "..\..\..\..\Program Files\Microsoft Visual Studio\VC98\Lib\WINMM.LIB"
What can be the reason for this?
How to overcome?
Thanks In advance
__________________
Leave Your Mark Wherever You Go
|
|
|
|
|
Your path to the lib-files seems to be invalid. Just set the correct path in Visual Studio. If you use version 2003 go to Tool->Options->Projects->Vc++ Directories and set the correct path for library files.
In Visual Studio 6 it should be very similar.
Konrad
|
|
|
|
|
I have an edit box to be enabled when user tick check box and disabled when box is unchecked.
I want the disabling/enabling to be done immediately after user use the mouse click to check/uncheck. How do i detect the mouse click? currently the code is:
if(left mouse click and box is checked){
GetDlgItem( IDC_BUTTON1 )->EnableWindow(TRUE);}
else{
GetDlgItem( IDC_BUTTON1 )->EnableWindow(FALSE);
}
|
|
|
|
|
Handle the BTNCLICK massage for the check box.Note associate a boollean member variable with the checkbox tocheck the current status.
|
|
|
|
|
Hi all!
Help me,please!
How to hook and override api fuctions?
Example DrawText funtion
|
|
|
|
|
read codeproject.com and stop making exaggarative use of exclamation marks, that makes your question in no way more important than other threads.
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Hi all!
Help me,please!
How to hook and override api fuctions?
Example DrawText funtion
|
|
|
|
|
Hello!
Take some time and read:
http://research.microsoft.com/sn/detours/
|
|
|
|
|
How can i change the background of scrollbar control in MSFlexGrid????
|
|
|
|
|
Hi All,
Win32 console based application
How to lock a Edit control such that it accepts only AlphaNumeric datas?
I tried to get WM_COMMAND and then EN_CHANGE, and remove the invalid data and placed it back in the Edit control by using Sendmessage and SetDlgItemText. But, the cursor moves to the begin of the Edit control?
How to move to the cursor back to the end of the text in the Edit Control??
Or else, is there is any other way to do that?
With Best Regards,
A.Ilamparithi
|
|
|
|
|
Re try catching WM_CHAR message, if not a valid result set nChar to 0;
Good Luck.
|
|
|
|
|
Hi,
What is nChar??
I am not able to catch the WM_CHAR message.
Control is not coming there. Instead it is going to WM_COMMAND.
How to do it?
With Thanks,
A.Ilamparithi
|
|
|
|
|
Iam creating an mdi application where in if we save the page each child window would be saved under one name.How can i group several pages or child windows and save as one project under one name and when i open it i must be able to view all the child windows created in that project.
How can it be done?
|
|
|
|
|
I have a wierd situation. I have a MFC based dialog application that loads dynamically an MFC dialog based dll.
If I build the application in release mode and try to load the debug mode dll the application crashes. Likewise if I build the application in debug mode and load the release mode dll the application crashes.
Any ideas why?
Steve
|
|
|
|
|
Hello!
Most probably (for sure) it is because of different memory allocators in release and debug version. Also, there might be problems with alignment (though I do not suspect that you have different alignment in debug and release).
Does it work in both debug and both release?
|
|
|
|
|
Yes, it works fine with either both in debug or both in release.
Both make use of threads if that could have anything to do with it.
What do you mean by different memory allocators?
I will have to look into this alignment issue. I changed several things in the process of
learning to get plug-ins working and everything else working as well.
Oh, I am using a GDI+ header helper file that I believe I found on codeproject that does some strange things to fix some memory issues.
Thanks,
Steve
#ifndef _GDIPLUSH_H_INCLUDED_
#define _GDIPLUSH_H_INCLUDED_
//
// GDI+ helper file v1.0
//
// Written by Zoltan Csizmadia (zoltan_csizmadia@yahoo.com)
//
// GDIPLUS_NO_AUTO_INIT:
// GDI+ won't be initialized at program startup,
// you have to create GdiPlus::GdiPlusInitialize object to
// initialize GDI+ ( GDI+ will be uninitialized, when destructor
// is called.
#define GDIPLUS_NO_AUTO_INIT
// GDIPLUS_USE_GDIPLUS_MEM:
// GdipAlloc and GdipFree is used for memory operations
// In this case _Crt functions cannot be used to detect
// memory leaks
//#define GDIPLUS_USE_GDIPLUS_MEM
// GDIPLUS_NO_AUTO_NAMESPACE:
// Gdiplus namespace wont' be defined as a used namespace
// In this case you have to use Gdiplus:: prefix
//#define GDIPLUS_NO_AUTO_NAMESPACE
#ifdef _GDIPLUS_H
#error Gdiplus.h is already included. You have to include this file instead.
#endif
// Fix for STL iterator problem
#define iterator _iterator
#define list _list
#define map _map
#define _GDIPLUSBASE_H
namespace Gdiplus
{
namespace DllExports
{
#include "GdiplusMem.h"
};
class GdiplusBase
{
public:
#ifdef _DEBUG
static void* __cdecl GdiplusAlloc( size_t nSize, LPCSTR szFileName, int nLine )
{
#ifdef GDIPLUS_USE_GDIPLUS_MEM
UNREFERENCED_PARAMETER(szFileName);
UNREFERENCED_PARAMETER(nLine);
return DllExports::GdipAlloc(nSize);
#else
return ::operator new( nSize, szFileName, nLine );
#endif
}
static void GdiplusFree( void* pVoid, LPCSTR szFileName, int nLine )
{
#ifdef GDIPLUS_USE_GDIPLUS_MEM
UNREFERENCED_PARAMETER(szFileName);
UNREFERENCED_PARAMETER(nLine);
DllExports::GdipFree(pVoid);
#else
::operator delete( pVoid, szFileName, nLine );
#endif
}
void* (operator new)(size_t nSize)
{
return GdiplusAlloc( nSize, __FILE__, __LINE__ );
}
void* (operator new[])(size_t nSize)
{
return GdiplusAlloc( nSize, __FILE__, __LINE__ );
}
void * (operator new)(size_t nSize, LPCSTR lpszFileName, int nLine)
{
return GdiplusAlloc( nSize, lpszFileName, nLine );
}
void (operator delete)(void* pVoid)
{
GdiplusFree( pVoid, __FILE__, __LINE__ );
}
void (operator delete[])(void* pVoid)
{
GdiplusFree( pVoid, __FILE__, __LINE__ );
}
void operator delete(void* pVoid, LPCSTR lpszFileName, int nLine)
{
GdiplusFree( pVoid, lpszFileName, nLine);
}
#else // _DEBUG
static void* __cdecl GdiplusAlloc( size_t nSize )
{
#ifdef GDIPLUS_USE_GDIPLUS_MEM
return DllExports::GdipAlloc(nSize);
#else
return ::operator new(nSize);
#endif
}
static void GdiplusFree( void* pVoid )
{
#ifdef GDIPLUS_USE_GDIPLUS_MEM
DllExports::GdipFree(pVoid);
#else
::operator delete( pVoid );
#endif
}
void* (operator new)(size_t nSize)
{
return GdiplusAlloc( nSize );
}
void* (operator new[])(size_t nSize)
{
return GdiplusAlloc( nSize );
}
void (operator delete)(void* pVoid)
{
GdiplusFree( pVoid );
}
void (operator delete[])(void* pVoid)
{
GdiplusFree( pVoid );
}
#endif
};
};
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
#include <Gdiplus.h>
#ifdef _DEBUG
#undef new
#endif
#pragma comment (lib, "Gdiplus.lib")
namespace Gdiplus
{
class GdiPlusInitialize
{
public:
GdiPlusInitialize()
{
GdiplusStartupInput Startup;
GdiplusStartup( &m_Token, &Startup, NULL );
}
~GdiPlusInitialize()
{
GdiplusShutdown( m_Token );
}
protected:
ULONG_PTR m_Token;
#ifndef GDIPLUS_NO_AUTO_INIT
static GdiPlusInitialize m_Initialize;
#endif
};
#ifndef GDIPLUS_NO_AUTO_INIT
GdiPlusInitialize GdiPlusInitialize::m_Initialize;
#endif
}
#ifndef GDIPLUS_NO_AUTO_NAMESPACE
using namespace Gdiplus;
#endif
// STL problem
#undef iterator
#undef list
#undef map
#endif
|
|
|
|
|
Hello!
"What do you mean by different memory allocators?"
In debug build, memory allocator allocates for example guardians (additional bytes before and after allocated block of memory). Guardians are used to detect memory overwrites.
Generally, there are a lot of differences between allocating memory in release and debug version. See msdn for more details
|
|
|
|