|
Hi all,
I am using EVC++ for developeing application on PocketPC.
I have make propertypage & initialize scroll bar in that.
But my OnInitDialog() method is not executed at all so my scrollbar is not initialize.
I have also take some reference project of this site.
regards,
Divyang Mithaiwala
|
|
|
|
|
I am trying to overload an assignment operator that that assigns an underlying type with the the assignment operator of the template's underlying class. It should be much simpler than creating the syntax of my opening sentence.
If anyone can tell me what the hell im doing wrong I would be much obliged.
template <typename T> T& operator=(T& t,const Object<T>& object);
template <typename T> class Object{
friend T& operator=(T& t,const Object<T>& object);
public:
Object();
//ommitted for brevity
protected:
Object<T>* m_daddy;
T m_data;
};
//----------------------------------FOLLOWING IS THE CPP FILE
#include "StdAfx.h"
#include ".\table.h"
template <typename T> T& operator=(T& t,const Object<T>& object){
t = object.m_data;
return t;
}
template <typename T> Object<T>::Object(){
//the constructor stuff goes here
}
I GET THE FOLLOWING ERROR
c:\Visual Studio Projects\Statistician Pro\Table.h(5): error C2801: 'operator =' must be a non-static member
|
|
|
|
|
Read your error message. operator= must be a member of the class, in this case Object .
|
|
|
|
|
Some applications use a control that combines a tree view with a list view. You can expand the nodes of the tree, and then underneath each node, you can have list items.
How is that implemented? Is there a commercial control that someone can recommend? Is it something I might be able to code myself?
Thanks,
Rich
--------------------------------
"All that is necessary for the forces of evil to win in the world is for enough good men to do nothing" -- Edmund Burke
|
|
|
|
|
I have never seen such a thing, I don't suppose you could give me an example exe name with a control like you describe. If you have the control in front of you, why not just use spy++ to see what type of control is being used.
|
|
|
|
|
waldermort wrote: If you have the control in front of you, why not just use spy++ to see what type of control is being used
Thank you, that is a good idea. An example of such a control can be found in the SysInternals Autoruns.exe utility. It seems to display headings as tree nodes, but details as list view items.
--------------------------------
"All that is necessary for the forces of evil to win in the world is for enough good men to do nothing" -- Edmund Burke
|
|
|
|
|
The treelist is not a built-in control, however there are several articles here at CP that have code for such a control
|
|
|
|
|
Thanks for letting me know the name of the control: TreeList
Now I know what to look for!!
Y.T.
Rich
--------------------------------
"All that is necessary for the forces of evil to win in the world is for enough good men to do nothing" -- Edmund Burke
|
|
|
|
|
I used the following code to get file date time stamp.
CFileFind ff;
CFileStatus status;
xxxxxx;
xxxxxx;
CString strFilePath = ff.GetFilePath();
CFile::GetStatus(strFilePath, status);
CTime Ftime = status.m_mtime;
Ftime is CTime object. But CTime has limit (Year <=2037 or so)
is there another ways to get file date time stamp except CFile::GetStatus?
Thanks
|
|
|
|
|
Have you checked out the Win32 API GetFileTime ?
--------------------------------
"All that is necessary for the forces of evil to win in the world is for enough good men to do nothing" -- Edmund Burke
|
|
|
|
|
Thanks. I used GetFileTime. But I got another problem.Following is my code:
TCHAR FilePath[MAX_PATH];
TCHAR NewPath[MAX_PATH];
WIN32_FIND_DATA fd;
FILETIME mtime, local;
SYSTEMTIME st;
sprintf(FilePath, "%s\\*.*", strpath);
HANDLE hFind = FindFirstFile(FilePath, &fd);
if (hFind == INVALID_HANDLE_VALUE)
return;
do
{
if (fd.cFileName[0] != '.')
{
if (fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
{
sprintf(NewPath, "%s\\%s", strpath, fd.cFileName);
Findfiles(NewPath);
}
else
{
GetFileTime(hFind, NULL, NULL, &mtime);
FileTimeToLocalFileTime( &mtime, &local );
FileTimeToSystemTime(&local, &st);
CString time;
time.Format("%02d/%02d/%04d", st.wMonth, st.wDay, st.wYear);
AfxMessageBox(time);
}
}
}
while (FindNextFile(hFind, &fd));
FindClose(hFind);
But my file last modofied time is 9/5/2006. The Time always dispalyed as 12/24/18186. what is wrong?
Thanks a lot.
|
|
|
|
|
The members of the SYSTEMTIME structure are of type WORD . You need to change your format to
time.Format("%02hd/%02hd/%04hd", st.wMonth, st.wDay, st.wYear);
Software Zen: delete this;
|
|
|
|
|
I am upgrading a VS 2003 project to VS2005 that contains managed and unmanaged code. According to MS documentation and testing I can no longer build a release that statically links to the Runtime libraries. I have to use dynamic linking instead. That is OK, Im flexible. But how do I find which libraires I need to include in my installation for deployment and where on the target system do I install them? If anyne can point me in the right direction, I would appreciate it.
Craig
|
|
|
|
|
|
Thanks Jun for the suggestion. I already have the 2.0 framework installed on my test system. Still, it doesn't work. When I try to run the application I get a message "This application failed to start because the application configuration is incorrect". It does look as if the needed dll's are in the Global Assembly Cache, so maybe something else is up. I'll keep trying. Thanks again.
Craig
|
|
|
|
|
Solved the problem. The answer is to install the VC redistributable files from following link:
http://www.microsoft.com/downloads/details.aspx?FamilyID=32BC1BEE-A3F9-4C13-9C99-220B62A191EE&displaylang=en
Craig
|
|
|
|
|
an alternative to using the MS installer for the VC runtime libs is to look in your VC install directory for the redist directory. Under there, you'll find the redistributable libraries. You can just include them all in your install dir.
the nice thing about this approach is that you can have an installer which just copies files over and which doesn't risk requiring admin privs which users don't always have.
Either way will work, but I've found the straight copying approach, using the stuff under redist works very well.
Granted, if you're using .NET you are stuck having to run that separate installer or just having that as a requirement, but this at least takes care of the MFC/runtime lib stuff.
|
|
|
|
|
I have a project that was a MFC ccmdtarget app in vs 6 we are moving it to vs 2005 but I get link errors.
utoEngine.obj : error LNK2019: unresolved external symbol "public: static struct CRuntimeClass const CCmdTarget::classCCmdTarget" (?classCCmdTarget@CCmdTarget@@2UCRuntimeClass@@B) referenced in function "protected: static struct CRuntimeClass * __stdcall AutoEngine::_GetBaseClass(void)" (?_GetBaseClass@AutoEngine@@KGPAUCRuntimeClass@@XZ)
AutoEngine.obj : error LNK2019: unresolved external symbol "public: static struct CRuntimeClass * __stdcall AutoEngine::GetThisClass(void)" (?GetThisClass@AutoEngine@@SGPAUCRuntimeClass@@XZ) referenced in function "void __cdecl `dynamic initializer for 'public: static class COleObjectFactory AutoEngine::factory''(void)" (??__E?factory@AutoEngine@@2VCOleObjectFactory@@A@@YAXXZ)
I know this has somthing to do with the way I am linking to MFC, but I have tried to ensure that I am only linking to the mfc 8.0 library only.
a programmer traped in a thugs body
|
|
|
|
|
Just a litlle more info AutoEngine is my class. Also I have both VS 6 and .net on my comp. I have assured that all projects that we are dependant with link to the right mfc library.
a programmer traped in a thugs body
|
|
|
|
|
originally i had:
UCHAR *buff1 = 0, *buff2 = 0,*buff3 = 0;
buff1 = new UCHAR[45000000];
and I used it:
ReadFile(...,...,buff1+offset,...,NULL);
and that was fine.
then I changed it so that it's more flexible:
UCHAR *buff[3];
buff[0] = new UCHAR[45000000];
buff[1] = new UCHAR[45000000];
buff[2] = new UCHAR[45000000];
when I do:
ReadFile(...,...,buff[num],...,NULL);
buff[num]+= 2028;//increment the pointer to the next chunk
I get the error code "998" which is "Invalid access to memory location."
could someone please explain to me what I'm doing wrong?
thanks!
Kitty5
|
|
|
|
|
kitty5 wrote: ReadFile(...,...,buff1+offset,...,NULL);
You are reading into an invalid memory location. You must allocate memory for buff1 , or assign it to a valid memory location, before it can be used in this fashion.
"Talent without discipline is like an octopus on roller skates. There's plenty of movement, but you never know if it's going to be forward, backwards, or sideways." - H. Jackson Brown, Jr.
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
DavidCrow wrote: You are reading into an invalid memory location. You must allocate memory for buff1, or assign it to a valid memory location, before it can be used in this fashion.
I do have: buff1 = new UCHAR[45000000];.
but that works....
it's when I try to use an array of pointers that i run into trouble with....
instead of buff1 i do, buff[0]....
Kitty5
|
|
|
|
|
kitty5 wrote: UCHAR *buff[3];
buff[0] = new UCHAR[45000000];
buff[1] = new UCHAR[45000000];
buff[2] = new UCHAR[45000000];
when I do:
ReadFile(...,...,buff[num],...,NULL);
buff is an array of 'size' 3 and each cell in the array contain a pointer (and each of these pointers point to an array of 45000000 UCHAR). When you do do buff[num] , if num is higher than the size of your array (3 in this case), you write to an invalid address.
By the way, allocating 3 times 45000000 is quite big. Are you sure you want to allocate so much memory ?
|
|
|
|
|
kitty5 wrote: buff[num]+= 2028;
that's a bad idea. since you haven't stored the pointer in buff[num] anywhere else, you won't be able to free buff[num] later. you should make a copy of buff[num] so you'll be able to delete it when you're done.
kitty5 wrote: //increment the pointer to the next chunk
how many 'chunks' do you get before the error happens ?
|
|
|
|
|
kitty5 wrote: buff[num]+= 2028;//increment the pointer to the next chunk
You can't do this and expect to be able to delete the memory. The statement buff[0] = new UCHAR[45000000] assigned a specific memory address to buff[0] . If you advance that address by 2048 bytes, the delete operator will fail. Try:
ReadFile(..., buff[num]+offset, ...);
offset += 2048;
"Talent without discipline is like an octopus on roller skates. There's plenty of movement, but you never know if it's going to be forward, backwards, or sideways." - H. Jackson Brown, Jr.
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|