|
how do you maximize a child window?? its probably on the oninitialupdate()...help
Actual Linux Penguins were harmed in the creation of this message.
|
|
|
|
|
Override PreCreateWindow() in your child frame class and make sure cs.style includes WS_MAXIMIZE .
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
That doesn't work.
Any other thoughts???
-B
|
|
|
|
|
stl list & iterators
I've got a list for XML objects. i'm using the std::list
i declare an iteraror, and set it to the beginning of the list
<br />
XML::iterator i = this->begin();<br />
then i want to go to the 'num' positon of the list, so i use this for bucle:
<br />
for(int ii=0; ii<num ;i++, ii++);<br />
that code is ok, i can see what's on the list.
The problem is that i don't know how to delete that position. the following code doesn't seem to work...
<br />
this->erase(i,i);<br />
do you have any ideas? this is my first project with stl.. i've read Eckels Thinking In C++ vol 2 and i can't find anything.. he speaks about a remove method, but i can't use it
thanks!!
|
|
|
|
|
Hi there,
In order to erase only one element, where the iterator is, use this sintax
iterator erase(iterator it);
Let me show you an example
list<int> myList;
list<int>::iterator it;
<br><br>
myList.push_back(1);
myList.push_back(2);
myList.push_back(3);
<br>
for(it = myList.begin(); it!=myList.end(); it++)
ATLTRACE(_T("%i\n"), *it);
<br>
it = myList.begin();
it++;
<br>
myList.erase(it);
<br>
for(it = myList.begin(); it!=myList.end(); it++)
ATLTRACE(_T("%i\n"), *it);
Try it, it should work.
Fabian
|
|
|
|
|
Hi,
Is there any way to change the location of source files for a project? I have all my sources in one directory and the project files in other directories. Now I would like VS to start looking in that source directory whenever I add a new or existing item.
Is that possible?
regards
Ludde
|
|
|
|
|
please help.... anyone? I have searched the docs in vain...
|
|
|
|
|
Hi!
Recently i downloaded an article from this page. This project was programmed in C++ with managed extensions and serves as a .NET Wrapper around a existing C++ implementation of random generators and distributions.
I added this project to my solution that consist of a C# windows application. Under VS.NET 2003 everything worked well and i could use the wrapped random generators and distributions.
Unfortunately, i had to move my solution back to VS.NET 2002. My C# windows application still works well, but the downloaded project doesn't get compiled. I receive the following errors, which i noted besides the lines that generate them:
<br />
template<class T><br />
struct ptr_helper<br />
{<br />
typedef T value_type;<br />
typedef T& reference_type;
typedef const T& rvalue_type;
static reference_type ref(T& r) { return r; }
static const T& ref(const T& r) { return r; }
};<br />
This struct is declared in a header-file of the existing C++ implementation that gets wrapped by the downloaded project.
Why can i compile this under VS.NET 2003 but not in VS.NET2002? What i can i do?
THX in advance
|
|
|
|
|
I believe it was VS.NET 2003 that finally fixed a lot of the bugs in Microsofts C++ compiler. If you're passing a reference to a reference, just change the code to not do that.
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
Does anyone know how to use ifstream to read binary files over 4 GB in size?
Environment: Microsoft Visual C++ 6.0.
We have a simulator that can generate huge amounts of time-series data. We store this data in binary files. We then read that data as needed for charts, map views, etc. To read a particular item, we use the known layout of the binary files to compute the offset from the beginning of the file:
m_iFstream.open(strFName, ios::in | ios::binary);
int totalOffset = timeStepOffset + ObjectOffset + attributeOffset;
char* buf = NULL;
buf = new char[nLength+1];
m_iFstream.seekg(totalOffset, ios::beg);
m_iFstream.read((char*)buf,(sizeof(char)) * nLength);
buf[nLength] = '\0';
We then copy the read buffer into float.
This works great until the offset exceeds the MAX_INT value. To overcome that, I tried a series of relative offsets as needed, using 64-bit integers to provide a little "head room":
m_iFstream.open(strFName, ios::in | ios::binary);
__int64 llTotalOffset = llTimeStepOffset + objectOffset + attributeOffset;
char* buf = NULL;
buf = new char[nLength+1];
int nRemainingOffset;
if (llTotalOffset < INT_MAX)
{
// Single, direct seek is possible.
//m_iFstream.seekg(0);//seek to begining of file
nRemainingOffset = llTotalOffset;
m_iFstream.seekg(nRemainingOffset,ios::beg);//seek from the beginning of the file
}
else
{
// The offset exceeds what an int can represent.
// Must iteratively seek to the location.
int nMaxSeek = INT_MAX;
m_iFstream.seekg(nMaxSeek, ios::beg); // first seek is from the beginning
llTotalOffset -= nMaxSeek;
while(llTotalOffset >= nMaxSeek)
{
m_iFstream.seekg(nMaxSeek, ios::cur);
llTotalOffset -= nMaxSeek;
}
nRemainingOffset = llTotalOffset;
if (nRemainingOffset > 0)
m_iFstream.seekg(nRemainingOffset, ios::cur);
}
m_iFstream.read((char*)buf,(sizeof(char)) * nLength);
buf[nLength] = '\0';
In theory, this should work. In practice, it doesn’t work consistently. I think the failure must be due to the ifstream class not itself being able to store current file offset (ie same issue we had with variable ‘totalOffset’).
Does anyone know how I might be able to use ifstream in this context?
Note that I did look into declaring a specialized char_traits for the stream. I’m no expert with STL file I/O, but it appears to me that the ‘off_type’ and ‘pos_type’ have to correspond to the ‘char_type’ – so I’m hesitant to try this since we are using the file with standard ‘char’ character type.
Thanks in advance for your advice
Ron Hinthorn
|
|
|
|
|
Hi,
I need to load a large text file into my MFC app and later save changes to disk. What is the best way to do this?
Many thanks
|
|
|
|
|
How about CFile and its Read() and Write() methods?
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
Will all of the magical and fantastic container classes MFC seems to have brought, I thought there might be a way to read it into some kind of buffer class or something?
Cheers
|
|
|
|
|
ummmmmmm not really
a file has to be read from the disk and put into memory
whether u do it in lil bits or one big a**ed lump
its all the same
"there is no spoon" biz stuff about me
|
|
|
|
|
|
Jamie Kenyon wrote:
I thought there might be a way to read it into some kind of buffer class or something?
The first parameter to CFile::Read() is the buffer.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
Hi.
Is is possible to set up another location for the suo and ncb file? I have a temp-directory in my project directory where all the obj files are put. Before I backup I delete the tmp directory. I want that the suo and ncb files are also put in the temp directory.
|
|
|
|
|
Or are there tools that only backup the files that are *really* required?
|
|
|
|
|
I have a batch file that runs nightly in all of my development folders. It looks like:
del /s /q *.pch
del /s /q *.sbr
del /s /q *.aps
del /s /q *.pdb
del /s /q *.ncb
del /s /q *.opt
del /s /q *.bsc
del /s /q *.ilk
del /s /q *.clw
This keeps the larger files from taking up space on the backup tape unnecessarily.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
Oh yeah. That rules!
Many thanks David
|
|
|
|
|
Hi, I'm new in Visual C++, and I have a problem with a thread and the diferents values of the variables.
My thread is constantly (while(1){.....}) working with a variables and y would like to print their values on the main windows, but I can't use UpdateData(FALSE), because me thread is a global rutine and UpdateData is undefined.
So my question is someone could help my amd explin my how can I refresh the main windows with the news values.
I don't know if I have been enough cleared, but I hope you could understand my problem.
Thanks
|
|
|
|
|
bryanbryan wrote:
My thread is constantly (while(1){.....}) working with a variables and y would like to print their values on the main windows, but I can't use UpdateData(FALSE)...
There's hardly, if ever, a need to use UpdateData() . In your worker thread, simply post a message back to the primary thread (the one that owns the UI) with the values that have been updated.
To get a better understanding of what threads can and cannot do, I suggest:
http://flounder.com/workerthreads.htm
http://flounder.com/uithreads.htm
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
Hi,
I would like to use the Panel component which is on the "Windows Forms" tab in the toolbox of Visual C++.NET
Unfortunately, the icon which representes this component looks like disabled.
How can i do to make it enabled ?
thanks.
Maileen
|
|
|
|
|
Im creating threads and I want to pass a pointer to the threads, Is is possible to cast a pointer to a class into a DWORD, if so, how is it done???
Here is the code Im working with, its taken straight from the MSDN
void main(void){<br />
<br />
DWORD loadPerThrdID;<br />
HANDLE loadPerThrd;<br />
TCHAR szMsg[80];<br />
<br />
DWORD dwThrdParam; <br />
<br />
static WmiWrapper Wmi(NULL, NULL, NULL);
<br />
loadPerThrd = CreateThread(<br />
NULL, 0, <br />
loadPerThrdFunc,<br />
&dwThrdParam,<br />
0, &loadPerThrdID);<br />
<br />
if(loadPerThrd == NULL){<br />
wsprintf(szMsg, (TEXT("Create Thread failed for LoadPercentage")));<br />
MessageBox(NULL, szMsg, NULL, MB_OK);<br />
}<br />
else{<br />
_getch();<br />
CloseHandle(loadPerThrd);<br />
}<br />
}<br />
<br />
DWORD WINAPI loadPerThrdFunc (WmiWrapper Wmi)<br />
{<br />
................<br />
}
What can I do to get this to work, or am I completly out??????
|
|
|
|
|
roadragedave wrote:
Is is possible to cast a pointer to a class into a DWORD, if so, how is it done???
Both a pointer and a DWORD are 32-bit values.
DWORD WINAPI loadPerThrdFunc( LPVOID param )
{
DWORD *p = (DWORD *) param;
TCHAR s[32];
wsprintf(s, "The thread value is %lu\n", *p)
MessageBox(s);
}
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|