|
Passing by reference ensures that the stream objects aren't copied. When dealing with streams this is extremely important. You can think of the iostream library as very smart wrappers for handles.
The constructor initialises the handle, and the destructor frees it.
If you copy a stream you get a copy of the handle, but you will end up trying to free the handle twice, once at the end of the local block and once at program shutdown.
As a rule of thumb:
For input only paramters
1/ pass by const reference (objects or anything expensive to copy)
2/ pass by value (primitive types)
For output or input/output parameters
1/ pass by reference
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
|
|
|
|
|
In 6.0 "#using" is not a valid command. I want to do this:
#using <msimg32.lib> but it won't let me. How do you say that in 6.0?
LOSTTWARE.com
|
|
|
|
|
#pragma comment( lib, "msimg32.lib" )
This embeds a command to the linker in the object file generated by the compiler for this source file. MFC uses comment pragmas to force linking to the appropriate MFC runtime library files depending on your definitions.
The #using directive is for importing a managed library for use in managed C++ code.
|
|
|
|
|
Hi there,
I am using pattern brush to fill a rectangle. The Pattern is displayed perfectly but when I print it, the pattern becomes so small that any one could hardly figure it out. This is because higher the printer resolution, higher the density of pattern per inch. So I need a way to change or decrease the printer Resolution or the DPIs at run time. Can anyone help me out?
Regards,
Tejas
|
|
|
|
|
Hi,
has anyone an idea who to loop through all Outlook Folder (the default Folders and the folders who has someone created) and
save the data for example in a text file.
To save it in file is not the problem;
but how can I "automatically" loop through all outlook Folders ?
You know, I´m using C++ and the wrapper classes from the outlook typ libraries.
Thanks a lot !
|
|
|
|
|
Hi,
has anyone an idea who to loop through all Outlook Folder (the default Folders and the folders who has someone created) and
save the data for example in a text file.
To save it in file is not the problem;
but how can I "automatically" loop through all outlook Folders ?
You know, I´m using C++ and the wrapper classes from the outlook typ libraries.
Thanks a lot -1
|
|
|
|
|
In the Outlook object model folders and subfolders can be accessed through:
Outlook::MAPIFolder - represents a folder or a subfolder under which messages exist
Outlook::_Folders - represents a collection of such MAPIFolders.
You can get the toplevel collection of Folders from the Namespace object like:
<br />
<br />
CComPtr< Outlook::_NameSpace > spNamespace; <br />
spNamespace = spApp->GetNamespace(OLESTR("MAPI")); <br />
ATLASSERT(spNamespace!=NULL);<br />
<br />
<br />
CComPtr< Outlook::MAPIFolder > spFolder;<br />
CComPtr< Outlook::_Folders > spFolders;<br />
<br />
HRESULT hr = spNamespace->get_Folders(&spFolders);<br />
if(FAILED(hr))<br />
return hr;<br />
<br />
long nb_items = -1;<br />
spFolders->get_Count(&nb_items);<br />
<br />
<br />
for(int l=1;l<=nb_items;l++)<br />
{<br />
spFolder = spFolders->Item(CComVariant(l)); <br />
ATLASSERT(spFolder);<br />
<br />
CComBSTR bstrFolderName;<br />
hr = spFolder->get_Name(&bstrFolderName);<br />
if(FAILED(hr))<br />
break;<br />
<br />
ATLTRACE(bstrFolderName);<br />
_FoldersPtr subFolders;<br />
hr = spFolder->get_Folders(&subFolders);<br />
hr = EnumerateSubFolders(subFolders);<br />
<br />
}<br />
<br />
for instance to get to my Outlook Inbox, I have to drill down the object model such:
Personal Folders
|Inbox
|Outbox
|Calender
|Drafts
|other folders
Other .pst file
|Chapter1
|Chapter2
IMAP account
|Inbox
etc etc.
HTH,
amit.
Hush,hush...
thought I heard you call my name now.
Kula Shaker.
Amit Dey
Latest articles at CP - Writing Word addins
Office addin
|
|
|
|
|
Hi
I can create folders and delete them by using namespcae MAPI. But it not allows to create data files (Personal folders).
Do you know how Can I create Personal folders. Or if it is not supported do you know how data is written in .pst files ?
Thank You .
|
|
|
|
|
How can i user IAMAnalogVideoDecoder to Set Different Analog Video Standards
Such as PAL_B,PAL_D,PAL_H,PAL_I,PAL_M ,SECAM_B ,SECAM_D ,SECAM_K .
I have developed a video capture module , it successfully picks the Video From a USB cam
.But When i pick TV_TUNER card camera , It does give good quality video.
When i set Video Standards(PAL-B) through some other softwares , it starts working Fine.
plz help specially me with an example
Thanks
No Worries!
|
|
|
|
|
hi,
i using crystal report 6.0 for my project. i don't know what are the fiels needed to redistribute the crstal report with my application package. i take setup for the project using package & deployment of visual studioi .net. any one help to me. how to do this.
thanks in advance.
Murali.M
|
|
|
|
|
Well, You will have to distribute crystl32.ocx on the user's PC and need to register that OCX as well. You can see this file name while importing crystal reports control in your project. So Just check it out.
|
|
|
|
|
Thanks for ur help. i already added crystal report ocx control crystl32.ocx in package & deployment. what problem i facing is while installing my application in my client machine. this control registration is failed. database is mysql. database connection thru ODBC. i package & deployment project i add this activeX in system folder. there is any files needed for this. if you have any idea tell to me.
thanks in advance
|
|
|
|
|
Try Registering the component manually using 'regsvr32' command.
The Syntax:
'regsvr32 <full path="" of="" the="" ocx="">'
After issuing the command, check out the error message if any and do it accordingly.
|
|
|
|
|
The crystal components depend on MANY dlls. Depending on what features you are using in your reports, different dlls are used. I strongly suggest you read the programmers manual. There is a section on dependencies.
--
Ofra Haza: R.I.P
|
|
|
|
|
Or run your VC6.0 tools - depends to check your DLL dependencies.
Sonork 100.41263:Anthony_Yio
|
|
|
|
|
Hello, Sir:
Now i have a trouble with how to get CD-ROM(DVD-ROM) informations in windows platform. The informations including the cd-rom Model or Type Name, Firmware Version, Serial Number, or the Drive name, and so on. I have a little about that, I just hear that the informations can be get by ATA command, but i don't know how to get the informations on windows platform. Can you give me some advice? I need your help. Thanks
|
|
|
|
|
try GetVolumeInformation() function.
|
|
|
|
|
Thanks sir.
But i have a look about GetVolumeInformation() function in MSDN. I know this function maybe can get a cd media information, but i wish get the cd-rom hareware information, includeing the vendor, model name, firmware version, and so on. I am not means to get a media information in CD-ROM drive.
I know that this cd-rom hareware information can be get by ATA/ATAPI command. I want to know obtrusively, Are you know that? Thanks you reply.
|
|
|
|
|
|
Friends,
Consider the following template function inside a namespace CP:
namespace CP
{
template < class T >
T TemplateFunction(int value)
{
cout<< _T("I am in template function") << endl;
return value*2;
}
}
A function inside a namespace can be accessed in three different ways. So i like to access this function from the main program in three different ways:
1)
using namespace CP;
int main(int argc, char* argv[])
{
int m = TemplateFunction< int >(44);
return 0;
}
As such the program is working normal and not giving me any errors.
2)
int main(int argc, char* argv[])
{
int m = CP::TemplateFunction< int >(44);
return 0;
}
In this case the programs works normally as expected.
3) Here is a problem:
using CP::TemplateFunction;
int main(int argc, char* argv[])
{
int m = TemplateFunction< int >(44);
return 0;
}
In this third case the compiler is giving me the following error:
C:\test.cpp(32) : error C2062: type 'int' unexpected
Can anyone tell me about the problem in third case.
|
|
|
|
|
Compiles fine in VS.NET 2K3. What compiler are you using?
- Mike
|
|
|
|
|
Jahangir Jamshed wrote:
Can anyone tell me about the problem in third case.
Screwed up compiler. I'm assuming you're using VC6?
--
Ofra Haza: R.I.P
|
|
|
|
|
I've got a read-only Edit Box in my dialog which is used to display diagnostic information so it's constantly being written. As I add to the string in the box, I call UpdateData(FALSE) on the dialog to refresh the view.
The problem is that, when the dialog refreshes, the scrollbar of the Edit Box always jumps back to the beginning. I can follow the UpdateData() call with a call to the LineScroll() function of the Edit Box but I still get a momentary flicker as the scroll changes.
Is there a way to make the scrollbar of the Edit Box always go the bottom-most position when updating?
|
|
|
|
|
Instead of a CEdit use a CListBox::AddString for logging provided formatting is not that important for your app. It automatically scrolls to the last item without flickering
Bunburry
|
|
|
|
|
I considered that but I would prefer to use CEdit so that the user can highlight and copy text to the clipboard.
|
|
|
|