|
Hi
I have one quick question here: is it possible to insert a class with private copy constructor and assignment operator into a Visual C++ vector STL? How about other STL implementations? I have tried it on VC++ 6.0, and it does not seem to be possible. Or maybe there's another not-so-straightforward way to do it?
Thanks!
|
|
|
|
|
You can't use such objects with any standard-conforming implementation of the STL. STL containers require that the elements stored in them are copyable by a copy constructor and assignable by the assignment operator.
|
|
|
|
|
No, not by value. In fact, by making the copy constructor and assignment operator private, you are declaring that you cannot copy objects of this type, hence there is no container which can store them by value. You need to store pointers to them.
--
Booohoo!
|
|
|
|
|
Hi , this is my problem if anybody knows that plz give me a use full tips,
Probs:- I have a DLL it contain only resource , I would like to replace one particular string, that is in side resource DLL. But I don’t want to recompile it.
~ Rahuraman.K
|
|
|
|
|
Hope this[^] helps
C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do, it blows away your whole leg
|
|
|
|
|
|
To edit resource-containing exe/dll-files, you just need a tool called "Res[ource]Hacker"...
|
|
|
|
|
|
Thanks for u'r immediate response with plenty of information
~Rahuraman.K
|
|
|
|
|
How can i display my own tooltips using VC. I am talking about the ones such as function declarations that VC displays in the IDE.
Any help will be appreciated
Vikash Parida
|
|
|
|
|
Sorry, I haven't my source code on this computer at the moment
But you can create Tooltips with the "CreateWindowEx" function, then you
need to specify something like WC_TOOLTIP or perhaps "TOOLTIP32" as window class -- take a look at the Win32.hlp - it is being described there
|
|
|
|
|
Hi,
It would be great if somebody can help me with this doubt.
My main target is :In order to list the patches and their dependancies on the target machine(for ex:my machine):
Should I have to go through the path -
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall
or
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Updates\
When I went through this path.
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall
I am able to get a list of hot fixes .
What are hot fixes and are these patched?
When I went through this path.
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Updates\
I am able to see 3 entries-
Data Access
Windows 2000
Windows MEDIA pLAYER
And under Windows 2000 -I am seeing 2 entries SP4 and SP5.
Is SP4 is the list of service packs?
Is SP5 is the list of updates?
SP5 has a folder called FileList.
This folder when I click shows some dlls on the right pane.
Are these dependancies?I mean dependancies which these patches depend?
Pls guide.
|
|
|
|
|
Hi,
It would be great if somebody can help me with this doubt.
My main target is :In order to list the patches and their dependancies on the target machine(for ex:my machine):
Should I have to go through the path -
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall
or
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Updates\
When I went through this path.
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall
I am able to get a list of hot fixes .
What are hot fixes and are these patched?
When I went through this path.
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Updates\
I am able to see 3 entries-
Data Access
Windows 2000
Windows MEDIA pLAYER
And under Windows 2000 -I am seeing 2 entries SP4 and SP5.
Is SP4 is the list of service packs?
Is SP5 is the list of updates?
SP5 has a folder called FileList.
This folder when I click shows some dlls on the right pane.
Are these dependancies?I mean dependancies which these patches depend?
Pls guide.
|
|
|
|
|
they are created by the same way
pDocTemplate = new CMultiDocTemplate(
IDR_CREATETYPE,
RUNTIME_CLASS(CCreateViewWithPrintDoc),
RUNTIME_CLASS(CChildFrame), // custom MDI child frame
RUNTIME_CLASS(CCreateViewWithPrintView));
AddDocTemplate(pDocTemplate);
pTxtTemplate = new CMultiDocTemplate(
IDR_CREATETYPE,
RUNTIME_CLASS(CCreateViewWithPrintDoc),
RUNTIME_CLASS(CChildFrame), // custom MDI child frame
RUNTIME_CLASS(CTxtView));
AddDocTemplate(pTxtTemplate);
please see my code!
http://mail.sina.com.cn/cgi-bin/attachment.cgi/oookkkk/application/x-msdownload/1085976835.13075.mail.sina.com.cn:2,S.a00.dat/createviewwithprint.rar
if you can correct it.please mail me:oookkkk@sina.com
bary thank you!
|
|
|
|
|
Hello every body
After i read an article about "A Technique to Customize the Title Bar of Windows" By Junlei Li
on code project (WTL).
I decide to write in to MFC DLL, a set of classes: Button, Edit..., and Customize the title bar.
But i have got a problem with title bar: Firt i remove the title bar of the parent, and then I
create a window to replace it (WS_VISIBLE | WS_POPUP | WS_CLIPSIBLINGS | WS_CLIPCHILDREN).
It works Ok on Frame (the window is mainframe or child frame), but on Dialog, the Substitute title
is not correct, it doesn't appear the same place as the Original title that i had removed.
I'm sure that the x,y position is absolutely right ( because it work ok on Frame). I consider that the WS_POPUP is the main resaon cause the problem (is it true)
Any one could help me ?, After i finish this dll, i will post on codeproject (I promise)
Thanks alot
TrungHuynh.
|
|
|
|
|
Hi
I have created a template function as follows:
template <typename T> perform(int iTotal)
{
vector<T> vec;
for(int i = 0; i < iTotal; i++)
{
vec.push_back(T());
}
}
and I call the function in main() using the following:
perform<double>(1000);
The program compiles and links without any error, but when I run it, I always get the message: Instruction at "0x...." referenced memory at "0x...". The memory could not be written!
Could someone tell me what I did wrong, and how I can rectify it?
BTW, if I changed the function definition to
template <typename T> perform(int iTotal, T NoUse);
where NoUse is not used at all in the function, the program runs perfectly. My only gripe is that the solution does not seem elegant.
Thanks!
|
|
|
|
|
Not sure if this will help, however try supplying a return value to prevent the compiler from defaulting it to int. This behaviour was only supported in older compilers (I'm assuming you're using VC6)
template <typename T>
void perform(int iTotal)
{
vector<T> vec;
for(int i = 0; i < iTotal; i++)
{
vec.push_back(T());
}
} Make sure the constructor for T isn't doing anything it shouldn't - this won't be a problem if you're using double's however.
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
|
|
|
|
|
Hi
Thanks for the reply. I've tried supplying the void return value, but I still get the same error.
|
|
|
|
|
Do you have a complete compilable example to post?
Your function as it exists is obviously pointless, and even if it weren't is equivalent to calling resize on the vector , which seems rather more direct.
Paul
|
|
|
|
|
Hi
My intention was to analyze the performance of STL vector insertion, how long does it take to insert e.g. 10 million doubles, ints, strings, etc., hence the code.
|
|
|
|
|
I think your GPF is a consequence of the compiler rather than the code.
But I don't think you're going to learn anything interesting about vector per se from this type of test. The dominant factor will be allocation and reallocation. Any real usage where you know how big you want the vector would call reserve first. And if you want to get to very large arrays of ordinary types then reverting to new/delete and manual management of length is probably going to be notably more efficient.
Paul
|
|
|
|
|
Is it possible to handle the javascript resizeTo() and moveTo() events in a custom CWebBrowser2 control? I can not seem to catch this event. Any ideas?
|
|
|
|
|
Try this, but this is not CWebBrowser2 control. It is a custom view.
http://www.codeproject.com/dotnet/dhtmlview.asp
Sonork 100.41263:Anthony_Yio
|
|
|
|
|
Hey all.
I'm using CFile to access some files across a network share. It works great when the servers are all online, however if one of the servers goes offline, the CFile::Open will try to open the file across it for 30-60 seconds (which is too long for this app that I'm building).
I am wondering if there is a way to set a default open timeout .... so it will try for say, 5 seconds, and if it can't get it, it fails and returns false?
TIA!!
|
|
|
|
|
How about to use
_taccess(const char *path, int mode );
in io.h?
Sonork 100.41263:Anthony_Yio
|
|
|
|