|
In VC++, is there any way to override the global "new" operator in a DLL and have other DLLs (which link together with this one) and the main program
(which links with all the project's DLLs) use this operator? If there is a way, I would appreciate seeing how it is done.
My attempts so far have produced the following conclusion:
If I add an overloaded "new" operator definition with an additional parameter,
e.g.
__declspec(dllimport) void * operator new(size_t , unsigned long);
There is no error, but as soon as I include the prototype definition of my "new" operator which contains only one argument:
__declspec(dllimport) void * operator new(size_t);
I get the following error:
error C2375: 'new' : redefinition; different linkage
C:\TEMP\a00238if(73) : see declaration of 'new'
If there is no way to do this in compile time, but there is a way in run-time, I would appreciate seeing how that is done, as well.
Thanks,
Jacob.
|
|
|
|
|
The simplest solution would be to implement real allocator as exported function living inside your DLL -- and -- provide overloaded inline operator new that simply calls that function. Operator new would be defined in .h file that all DLLs and EXE would #include.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
Hi,
first of all, thank you very much for your consideration.
Please help me! I want to get a word on the screen (eg. on a label, on a button...) by clicking right mouse on it.
I guess that I must do some hook to API functions or window's messages, but I don't know how to do it.
Please show me the way or send me an example.
Once more thank you very much.
trungnq.
|
|
|
|
|
Override the OnContextMenu or MouseDown and draw your text.
|
|
|
|
|
|
Is it the same person asking this question over and over again ? I can't think of a use for this function myself, and I imagine the only way to do it would be with some simulated word selection and copying via the clipboard. I assume the absence of a function that does this is the reason it never gets an answer...
Christian
#include "std_disclaimer.h"
The careful application of terror is also a form of communication.
Eagles may soar, but weasels don't get sucked into jet engines.
|
|
|
|
|
check out MSDN on how to do this. what sort of application are you doing? assuming you are using MFC, you want to override CWnd::OnRButtonDown(UINT nFlags, CPoint point). the associated command message is ON_WM_RBUTTONDOWN.
|
|
|
|
|
check out MSDN on how to do this. what sort of application are you doing? assuming you are using MFC, you want to override CWnd::OnRButtonDown(UINT nFlags, CPoint point). the associated command message is ON_WM_RBUTTONDOWN.
|
|
|
|
|
How do I get horizontal scrolling to work in a CRichEditCtrl?
With a CEdit LineScroll(0,1) nicely scrolls one position to the right, with a CRichEditCtrl nothing.
/Per
|
|
|
|
|
Hi all,
My program is using thread and keep checking and inserting into database. I try to let my program running overnight and when tomorrow morning I found out that it gives me a runtime error. The memory usage increased slowly and
this given me the problem (out of memory). Can I know how can I resolve it??
For example, make the memory usage and cpu usage stable.
Please help me.
Thanks in advance.
FM
|
|
|
|
|
I use BoundsChecker, to verify that my code has NO memory leaks, this helps prevent this problem.
Perhaps you need to redesign your application so it doesn't keep checking or only check every 5-10mins.
Gerry.
|
|
|
|
|
What is BoundsChecker?? I seen it in other msg too but still don't know what is BoundsChecker.
Can you please explain what it is.
Thanks for your help.
FM
|
|
|
|
|
It is a software that help you to detect run-time error.
you can go to the following web page to check it out.
http://www.numega.com/devcenter/bc.shtml
|
|
|
|
|
Does anyone know how to convert the Jet 3.0 file into Jet 4.0 format? The CDaoDatabase::CompactDatabase() can only specify dbVersion30 option. Looking at the available options it appears that MFC and DAO hasn't a option for dbVersion40.
|
|
|
|
|
For opening the Access 2000 (Jet engine 4.0):
You must write:
AfxGetModuleState->m_Version = 0x601;
Then you can open Access 2000 files with:
m_db.Open("C:\\db1.mdb"); // ACCESS 2000 FILE
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
Yes you are correct, that is what is required to Open a Jet 4.0 file, but that doesn't convert the file from 3.0 format to 4.0.
|
|
|
|
|
dbdaoint.h contains the following enumeration...
typedef enum DatabaseTypeEnum {
dbVersion10 = 1,
dbEncrypt = 2,
dbDecrypt = 4,
dbVersion11 = 8,
dbVersion20 = 16,
dbVersion30 = 32
} DatabaseTypeEnum;
... so it seems that dbVersion40 equals 64. You can also use Object Viewer in Visual Basic to check the actual value from type library. Access 2000 should also have this defined. Anyway, let me know what happens with 0x40
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
That worked:
CDaoWorkspace::CompactDatabase( csOld, csNew, dbLangGeneral, 64 );
I was leaning that way but I thought I would just ask the experts here and save me some time. Thanks for your help.
|
|
|
|
|
I am trying to make the text bold in a CStatic. I wrote the following code, Can anyone see where i am going wrong.
CFont *M_titleFont is a member varible.
Code Snippet, from oninitdialog:
LOGFONT lf;
m_titleFont= GetDlgItem(IDC_TITLE)->GetFont();
m_titleFont->GetLogFont(&lf);
lf.lfWeight = 700; //Set Bold
m_titleFont->CreateFontIndirect(&lf);
Cheers
Rich
|
|
|
|
|
The problem is in the GetFont() call. MFC wrapps the HFONT in a temporary CFont object and when you call the CreateFontIndirect() a new HFONT is created in the temporary object and never gets back to the control. All you have to do is tell the control to use the new font, GetDlgItem( IDC_TITLE )->SetFont( m_titleFont );
|
|
|
|
|
Cheers! That was driving me up the wall!
|
|
|
|
|
How can I obtain the ip address of the machine using c++.
Currently I've been using gethostbyname & getcomputername but this returns the DNS, I want the IP.
Cheers
Gerry.
|
|
|
|
|
You've got the answer on the excellent Warren Young's Winsock Programmer's FAQ, section 6.5
Regards,
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Thank you, this did the job.
Gerry.
|
|
|
|
|
I want a wrap class for parse regular expression ,can u help me?
Thank in advance!
Please pardon my weak English!
|
|
|
|