|
DavidCrow wrote: Is _getmbcp() of any help, or is that still MS-specific?
Yes it is. Any function beginning with ‘_’ is MS-specific and others without the under-bar may also be vendor specific. Some times it is hard to tell.
As Markkuk pointed out, even code-pages are vendor specific; therefore I can not use them at all.
I have been investigating ‘isleadbyte’ and ‘mblen’ and find that even though MS marks them as ANSI, that they are not listed in the C standard.
The code must be as generic as possible. It is only this top level parsing template that is giving me trouble, when it comes to generating ranges of characters. The lower level templates have no knowledge, nor care, about such details.
See my answer to Markkuk for a link to original problem.
INTP
"Program testing can be used to show the presence of bugs, but never to show their absence."Edsger Dijkstra
|
|
|
|
|
What I am doing may be stupid. But if I want to do like this then what to do...
In the doubleclick of the tree view item I delete that item. In that case the application crashed. What to do if I want to delete the item in the doubleclick.
What is the reason that it is crashing.
Regards
Anil
|
|
|
|
|
Almost sounds like some still points to the item..
Gotta post some code..
|
|
|
|
|
For your reference I make the code like this...
<br />
void CBackupTreeBar::OnNMDblclkBckTree(NMHDR *pNMHDR, LRESULT *pResult)<br />
{<br />
if( IsSelectFile() == TRUE ){<br />
<br />
m_BackupTree.DeleteItem( m_BackupTree.GetRootItem() );<br />
<br />
}<br />
*pResult = 0;<br />
}<br />
This code will crash...
But If make *pResult = -1; it is working.
Of course the tree items won't be there.
Regards
Anil
|
|
|
|
|
You're deleting a tree item in an event handler that is processing an event fired by that very item. Chances are, the tree control is going to do some other work after your handler returns that will involve that tree item. You could see how deleting it would be a bad idea.
|
|
|
|
|
_anil_ wrote: m_BackupTree.DeleteItem( m_BackupTree.GetRootItem() );
You are deleting the whole tree item here, is this your intension?
_anil_ wrote: *pResult = 0;
}
This code will crash...
But If make *pResult = -1; it is working.
I'm not sure, but i think this is why your code get crashed.
If you set pResult is 0, then the frame work thinks that you didn't handle this notification,so it'll proceed with its task. But you already deleted the tree items, so its crashing.
If you set values other than zero then, the framework knows that you handled the notifaction and it does nothing.
Do your Duty and Don't expect the Result
|
|
|
|
|
In all applications; by double clicking the tree will be expanded. You can create a context menu with a button as delete. on righ clicking on the tree or item invoke the context menu and click the delete button to delete the item.
Regards,
Syam
|
|
|
|
|
I ran into this issue about a year ago and the issue is exactly what Michael Dunn stated.
And I fixed the problem the same way suggested by syampi.
|
|
|
|
|
Not able to access child dialog object, Assert Error..
//Pointers to dialogs
CDialog * pCMyApp;
CDialog * pCChildDialogs[5]; //array of dialogs
.
.
.
void CMyApp::function()
{
//trying to SetWindowText to one of the child dialogs objects.
pCChildDialog[0]->GetDialogItem(IDC_STATIC1)->SetWindowText(mystring); //MVS2005 intelliSense shows this path ok
}
Other functions "PCChildDialog[N]->???" seem to work fine within this CMyApp function.
But in this situation I get an Assert Error..
and it drops me off here
void CWnd::SetWindowsText(LPCTSTR lpszString)
{
......
ENSURE(::IsWindow(m_hWnd) || (m_pCtrlSite != NULL)); <------------
|
|
|
|
|
Hehe, go figure.. get stumped on something for hours and figure it out only seconds after writing a post..
pCChildDialog[0]->SetDlgItemTextW(IDC_STATIC1, mystring); //This fixed it
|
|
|
|
|
Hey fellas..
Need a lil help..
I am starting up with a application of cryptography and steganography. But i am lil confused like which language to use. I have option to do it in C++(borland), C++.NET OR C#.NET. Not VC++...
All depends in which language would i get more reference over the net and more help.
Can C#.NET perform all the tasks that C++ can. I want to know it now so that i dont end up in a mess. As in stego i want to use carriers like .mp3, .jpeg, .pdf etc. So would that be fine with C#.NET.
Any suggestions are welcome...
Thanks a lot
|
|
|
|
|
I recommend you to:
1) write a brief design-document for the application you wish to write;
2) while writing, decide what components you will require (cryptography, compression, etc.)
3) search google/yahoo/whatever for that component. The first programming language to have all components you need written - that is your choice.
But at first, look at your programming skills.
-------------------------
Don't worry, be happy )
|
|
|
|
|
Hello everybody, I'm writing a program to take the contents for several .txt files and make them into one single .txt file. The separate txt files have to go in the single file at a certain order.
The problem with the code (see below) is that when I call getline(file,bline), bline is left empty after the call I don't understand what could be the problem. The file opens properly according to file.is_open but getline doesn't read. Here is the code:
<br />
<br />
fstream file;<br />
<br />
string bline;<br />
int i,j;<br />
<br />
<br />
string month[]={"01","02","03","04","05","06","07","08","09","10","11","12"};
string year[]={"1999","2000","2001","2002","2003","2004","2005","2006"};
<br />
for(j=0;j<=7;j++)<br />
for(i=0;i<=11;i++)<br />
{<br />
string fname="E:\\Month\\"+month[i]+"_"+year[j]+".txt";<br />
<br />
file.open(fname.c_str());<br />
if(file.is_open()){<br />
<br />
while(!file.eof()){<br />
ofstream ofile;<br />
ofile.open("C://allfile.txt",ios::app);<br />
getline(file,bline);<br />
ofile<<year[j]<<'\t'<<month[i]<<'\t'<<bline<<endl;<br />
}<br />
<br />
cout<<"Finished month "<<i+1<<" year "<<j+1999<<endl;<br />
<br />
}<br />
else<br />
cout<<"Cant open file"<<endl;<br />
<br />
<br />
}<br />
|
|
|
|
|
if you need to concatenate all the files, why do you read line by line ?
just read the entier file...
|
|
|
|
|
The files are huge... approx 9mb
|
|
|
|
|
that's ok you know. now constructors provide 1GB RAM
but if you think reading 10MB in one run is two much, you could always read by packets of 1 or 2 MB, without caring too much of the file contents... (because at last, all the characters will be moved)
|
|
|
|
|
Try something like this:
========================
// Console.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <iostream> // For "cout" and "cerr".
#include <fstream> // For "ofstream" and "ifstream"
#include <string> // For "string"
#include <cstddef> // For "size_t"
int main()
{
using namespace std;
// Open the output file.
ofstream outFile("C://allfile.txt");
if (!outFile)
{
cerr << "Failed to open output file!" << endl;
return 1;
}
static const string months[] = {"01","02","03","04","05","06","07","08","09","10","11","12"}; // these are all the months in the files
static const string years[] = {"1999","2000","2001","2002","2003","2004","2005","2006"}; // and these are all the years
for (size_t m=0; m<sizeof(months)/sizeof(months[0]); ++m)
{
for (size_t y=0; y<sizeof(years)/sizeof(years[0]); ++y)
{
// Build the filename.
string fname = "E:\\Month\\" + months[m] + "_" + years[y] + ".txt";
// Attempt to open the input file.
ifstream inFile(fname.c_str());
if (inFile)
{
// We opened it so append it the the output file.
cout << "Appending '" << fname << "'..." << endl;
outFile << inFile.rdbuf();
}
else
{
// We failed to open it.
cout << "File '" << fname << "' not found!" << endl;
}
}
}
return 0;
}
Steve
|
|
|
|
|
stephen please, don't forget the <pre> tags
|
|
|
|
|
I used the "Ignore HTML tags in this message (good for code snippets)" option. There's no need for <pre> tags when this is selected. I can't see anything missing.
Steve
|
|
|
|
|
............
...........
else
cout<<"Cant open file"<
|
|
|
|
|
Is there a way to save and import components (.ogx files) in VS 2005 like there was in VC++6.0?
What I need is to transfer a dialog in VS2005 to a VC6.0 project.
Any help is appreciated.
Thanks
Dave
I'm pretty sure I would not like to live in a world in which I would never be offended.
I am absolutely certain I don't want to live in a world in which you would never be offended.
Dave
|
|
|
|
|
No component gallery om vc2005 (it was removed since vc2002).
To copy dialogs, copy the vc6 dialog part from resource file (.rc) into vc2005 resource file..
--
======
Arman
|
|
|
|
|
I need to access windows user account properties.
What I want to do is,
Whether a user account is part of,
a. local administrator
b. domain administrator
c. exchange administrator
d. local user
e. domain user
Apart from this I want to also display
a. local GPO(Group policy setting)
b. domain policy setting
c. security policy setting
d. domain controller policy setting
I want to get a windows user account name and display what properties and what GPO policy setting it has?
I tried using LDAP, ADSI, LSA, but could not get all these rights!
Please advise!
Ramesh
|
|
|
|
|
|
hello,
Suppose I am developing an application in VC++ which helps in modifying data in excel.
For doing so I use COM components to get connected to excel and add a sheet etc.
But Suppose I have written a program in VC++ which uses pointers and I want to use the program in VB then will I be able to run my methods written in VC++ from VB
Prithaa
|
|
|
|