|
Tomasz:
I'd like to say this was indeed the problem, but I am unsure. To trouble shoot, I created an entirely NEW SDI project using the MFC Wizard. I imported my 32bit color icon, deleted the original MFC generated IDR_MAINFRAME icon from my resource file and named my new imported icon ID to IDR_MAINFRAME.
Clean. Rebuild all.
If I just "run" (!) the program it works, but when running in debug (F5) I get user breakpoints. The stack show I'm in NTDLL when I get a "heapblock modified" error message.
I've not written a single line of code at this point, I've only replaced the default 16 color icon with a true color icon.
D.
|
|
|
|
|
Hi,
I would like to create a function to calculate a checksum for a arraydata.
But I don't understand what I want for this checksum :
" lower 8 bits of the sum from data1 to data10 equals to zero".
My english is not perfect but I understand the sum of the data1 to data10 but equals to zero, I don't understand.
Best regards
youssef
|
|
|
|
|
|
Perhaps,
BYTE checksum = 0;
for ( int i = 0; i < 10; i++ )
{
checksum += (BYTE)( data[ i ] );
}
if ( checksum == 0 )
{
good checksum
}
else
{
bad checksum
}
This means that one of your array values is a checksum value which makes the whole array add up to zero.
PS: No one's English is perfect!
|
|
|
|
|
Hi there
I'm a Visual C++ newbie and i want to read and write bytes from a file @ specified offsets. Simply how do I do this?
I currently use the following code to do this bit of the programme, but it doesn't let me choose the offset of where I write to, only the value and number of bytes I patch! Please help!!!
==============================================
ofstream path("c:\\windows\\desktop\\debug.dat");
;
char *value_of_patch = "ffff";
int number_of_bytes = 10;
int setmode(int mode = filebuf::binary);
path.setmode(filebuf::binary);
path.write(value_of_patch, number_of_bytes);
================================================
Sample code is appreciated
Best regards,
Richard Edwards
|
|
|
|
|
I wrote this for Read get the number of page in a tiff file.
typedef struct _TiffHeader
{
WORD Identifier;
WORD Version;
DWORD IFDOffest;
}TIFHEADER;
typedef struct _TiffTag
{
WORD TagId;
WORD DataType;
DWORD DataCount;
DWORD DataOffset;
}TIFTAG;
long CWebBrowApp::GetTiffPageCount(LPCTSTR lpFileName)
{
TIFHEADER* udtTifHdr = new TIFHEADER;
WORD NumDirEntries;
DWORD NextIFDOffset;
long nPages = 0;
CFile tFile;
if(tFile.Open(lpFileName, CFile::modeRead | CFile::typeBinary))
{
tFile.Read(udtTifHdr, sizeof(TIFHEADER));
DWORD lOff = udtTifHdr->IFDOffest;
do
{
nPages++;
tFile.Seek(lOff, CFile::begin);
tFile.Read(&NumDirEntries, sizeof(WORD));
tFile.Seek(NumDirEntries * sizeof(TIFTAG), CFile::current);
tFile.Read(&NextIFDOffset, sizeof(DWORD));
lOff = NextIFDOffset;
}
while(NextIFDOffset != 0);
tFile.Close();
}
delete udtTifHdr;
return nPages;
}
I hope to help you!!!;)
Good Luck!!!
Carlos Antollini.
|
|
|
|
|
path.seekp(pos);
-c
------------------------------
Smaller Animals Software, Inc.
http://www.smalleranimals.com
|
|
|
|
|
Thanks for your help!
Sorry to ask again but how do I read INTEGER or LONG length values in from a binary file?
At the moment I can only get single bytes.
Do I use GET or READ?
How to I modify the following code to read an integer length value from address 4110 in the DAT file?
==============================================
ofstream path("c:\\windows\\desktop\\debug.dat");
........................
int pos = 4110;
path.seekg(pos);
int bytevalue = path.get();
================================================
Sorry to be dumb, tried to work it out myself but failed (& no online helpfile)
cheers
Richard Edwards
|
|
|
|
|
Does anyone know how to force CListView to select an entire row when you click on an item... by this I mean i insert a certain number of items each with 3 subitems... i want the item AND its subitems to appear highlighted...
Any help would be appreciated.
Joseph Dempsey
jdempsey@cox.rr.com
Joseph.Dempsey@thermobio.com
"Software Engineering is a race between the programmers, trying to make bigger and better fool-proof software, and the universe trying to make bigger fools. So far the Universe in winning."
--anonymous
|
|
|
|
|
Call the SetExtendedStyle function with LVS_EX_FULLROWSELECT as the parameter.
|
|
|
|
|
I don't believe that will do the trick. I think the LVS_EX_FULLROWSELECT parameter only allows you to select a row by clicking anywhere on any column in that row, rather than on just the first column text. It won't actually highlight the row.
To achieve the highlighting, you'll have to custom draw the control yourself, and you can find many examples of that on this site and on codeguru in the listcontrol sections.
best of luck
|
|
|
|
|
I need to access function1 in class2 from class1. Everytime I try to do this i get an error about statically linking. "illegal call of non-static function........ it is Error C2352. Since this function takes values and updates controls based on these values I can't use static functions. Can anyone tell me what to do ?
-Matt Newman
|
|
|
|
|
you can only call non-static (ie. normal) methods on an object if you have an instance of the object.
so, either create an instance of class2 or find an already-exisiting instance of it.
-c
------------------------------
Smaller Animals Software, Inc.
http://www.smalleranimals.com
|
|
|
|
|
you can only call non-static (ie. normal) methods on an object if you have an instance of the object. so, either create an instance of class2 or find an already-exisiting instance of it.
I am a beginner and I am not sure what you mean by create an instance. Could you elucidate this for me?
-Matt Newman
|
|
|
|
|
This is really one of the basic principles (maybe the most basic principle) in all of Object Oriented programming: you have a set of functions and properties grouped together that comprise an "object". You can tell the object to do something (invoke methods on the object), to report its state, to change its state, etc..
CString myString;
After this statement executes, "myString" is an "instance" of CString. Or, you could say "myString is an object of type CString".
Now you can call CString methods on myString:
BOOL b = myString.IsEmpty();
myString.MakeUpper();
etc..
What you can't do is call (non static) CString methods without having a CString object to call them on:
CString::Reverse();
This statement makes no sense (at all).What are you trying to Reverse? There is no object there. It's a verb without a noun.
-c
------------------------------
Smaller Animals Software, Inc.
http://www.smalleranimals.com
|
|
|
|
|
Now I remember. Thanks for the help and the refresher course.;)
-Matt Newman
|
|
|
|
|
This code doing problems in run time, When it read from the file this gets incorrect values in the parameters of the struct. Please ! try find the problem !!!!!!!
class CPerson {
CPerson();
public:
virtual ~CPerson();
public:
dPerson per;
CPerson* pNext;
CPerson* pBack;
};
-------------------------------------------------------------
________________________________________________________________
//cpp file:
-----------------
void CDemo::OnButtonAdd()
{
CFile file;
// CFileException ex;
if(file.Open(strPath, file.modeWrite |file.modeNoTruncate|file.modeCreate ))
{
file.SeekToEnd();
file.Write( &(person.per) , sizeof(dPerson));
MessageBox("************ S A V E D ************** ");
}
}
/************************************************************/
// Read the one first CPerson from the file:
void CDemo::read_person(CFile* persons)
{
CPerson* q = new CPerson;
DWORD dwRead = sizeof(dPerson);
if((*persons).Read(&q->per, sizeof(dPerson)))
{
q->pNext = q->pBack = NULL;
p_head = p_tail = q; //p_head and p_tail are member variables of CDemo - type CPerson*
}
else delete q;
}
/************************************************************/
|
|
|
|
|
Have you tried to add the flag CFile::typeBinary when opening the files?
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Hi,,
I have a MDI application. I like to get a pointer to the view of a particular document, and them activate it,,
this is the way that I do it,, but it doesn't work
pDoc= GetDocument();
POSITION pos = pDoc->GetFirstViewPosition();
while (pos != NULL)
{
pView = pCurrDoc->GetNextView(pos);
pCurrView=(CTurboMechView*)pView;
CMDIFrameWnd *pFrame = (CMDIFrameWnd*)AfxGetApp()->m_pMainWnd;
pFrame->SetActiveView(pCurrView,TRUE);
}
Thanks
Ehsan Behboudi
|
|
|
|
|
I think that you should activate a frame, not a view - this is MDI app, right? Do you have multiple views in one MDI child frame?
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
i dont' have multiple views in one MDI child frame.
but i have several documents open...
so I like to be able to activate a particular View..
I can get a pointer to the document. and then i can get a pointer to the View of that documents. but i can't activate the view..
any ideas??
Ehsan Behboudi
|
|
|
|
|
Assuming you have the document pointer
POSITION ViewPos = pDoc->GetFirstViewPosition();
ASSERT(ViewPos);
CView* pView = pDoc->GetNextView(ViewPos);
ASSERT(pView);
pView->GetParentFrame()->BringWindowToTop();
|
|
|
|
|
thank you
it was helpful
Ehsan Behboudi
|
|
|
|
|
Hi,
I am modifying a DCOM sever, i have written some new functions and would like to package them into their own interface. How do i do this, a sample piece of IDL is shown for one of the interfaces that already exists on the object. Is there anything i need to watch out for? where do i get the uuid from
[
uuid(5E816CCA-628A-4959-B1FE-05465C3393EB),
helpstring("IDocumentVision Interface"),
pointer_default(unique)
]
interface IDocumentVision : IUnknown
{
}
Cheers
Rich
|
|
|
|
|
You can get the uuid from GUIDGen.exe, should be in the tools folder in your Visual Studio installation. I always add it to the tools menu for easy access.
|
|
|
|