|
yah, some times it's bring good results when i run my application at first time but after that it will bring error ie.
1) "The instruction at "0x7c93..." referenced memory at "0x000000..". The memory couldnot be read.
2) The exeception unknown software exception (0xc0...)occured in the application at location 0x7c....
|
|
|
|
|
Where? Where in your Code?
I am asking this for the third time now!
You really need do debug your application and post the results!
Somewhere, somehow, there is a NULL-Pointer dereferenced.
Failure is not an option - it's built right in.
|
|
|
|
|
Sorry, i have used other one so..... sorry
|
|
|
|
|
|
when you add functions via class wizard you end up with
afx_msg void OnCalc();
if you want to add a function that does the same thing for several different control items on the dialog, instead of repeating code in several of the class wizard defined functions, do you just add it before the protected section of the class definition and without the afx_msg prefix (will look into what this does, is it some way that MFC keeps track of its own stuff?)
ie
void DoSomething();
so that you can call DoSomething in several different control item updates/key presses etc..
|
|
|
|
|
|
Have a look at ON_CONTROL_RANGE[^], an event handler for multiple control IDs.
Regarding afx_msg : this is only a prefix, but should be kept for portability reasons.
MSDN says: ClassWizard requires that you use the afx_msg keyword in your message map handler declarations.
You won't get any errors if you should omit afx_msg .
"It's supposed to be hard, otherwise anybody could do it!" - selfquote
|
|
|
|
|
ldsdbomber wrote: ...is it some way that MFC keeps track of its own stuff?
Yes, its simply a marker that ClassWizard uses. The compiler doesn't even see it.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Hello !
I have a standard Win32 List View Control that uses two image lists, one for the item icons and one for the state image icons. Everything is working smooth and correct with all items.
My control does not need an item icon for the first column at all, only the state icons. However, I cannot seem to find a way to actually remove the item icons. If I set the item icon index to -1, then no icon is displayed, but the item is still indented inwards by the width of the icon. Setting the iIndent variable to a negative value does not solve the problem.
Any suggestions ? How can I tell the List View that the first column only uses state icons, and that each item in the first column should only be indented once to allow putting a state icon there, if necessary ?
- Antti Keskinen
------------------------------
Programming Windows is like
a box of assorted chocolates.
You never know what you're
going to get.
|
|
|
|
|
Hi
All
I am developing project in VC++ 6.0 and I want to use log file in my application, so this file to be create and how it use in project.
Thnaks
Atool
Atool
|
|
|
|
|
Hi
You can use the function below which opens a log.txt in your exe's local folder and writes whatever message you pass thro it . Its also threadsafe . If your application is single threaded then remove CSingleLock stuff ...
if flag is 0 then 'msg' is written to log only and not printed in console . If you want to do both - then pass flag =1...
int WriteMessage(CString msg,UINT flag){
int ret=0;
CSingleLock sLock(&sec);// remove this if your app is single threaded..
sLock.Lock();//remove this if your app is single threaded..
TRY
{
ret=logfile.Open("log.txt",CStdioFile::modeWrite );// try opening log.txt
if(ret==1)// if succeeded
{
logfile.SeekToEnd();//go to end of log file
CTime t = CTime::GetCurrentTime();// time stamp stuff
CString tim=t.Format("%m/%d/%Y %H:%M:%S : ");
tim=tim+msg+"\n";
logfile.WriteString(tim);//write to log with the message passed thro "msg"
logfile.Close();//close the file
if(flag)
{
cout<<tim.getbuffer(4098)<<endl;
tim.releasebuffer();
="" }
=""
="" catch(="" cfileexception,="" e="" )="" handle="" exceptions
="" {
="" #ifdef="" _debug="" cout="" <<="" "file="" could="" not="" be="" opened="" "="" e-="">m_cause << "\n";
#endif
}
END_CATCH
sLock.Unlock();//remove this if your app is single threaded..
return ret;
}
redindian
|
|
|
|
|
Hi
Dharani Thanks for help, but in your code you use logfile object to call WriteString and close(), so how this LogFile object, It belongs to which class?
Thanks
Atool
Atool
|
|
|
|
|
You can use std::basic_fstream for creating a log file. You can use open(), write() etc to write to the file. If multiple applications will use the log file, use some synchronization objects, for eg: Mutex.
|
|
|
|
|
|
|
Hello together,
this is very basic question. I am trying to write an MFC Application
that will take advantage of the automation features of Excel (NOT an add-in with vsto).
Now here is the poblem:
I have created a basic MFC application using the wizard. That worked fine.
Next step I added a MFC typelib class. I picked Microsoft Excel11 from registry.
Whenever I try to include the generated header files ( Worksheet, Workbook, ...)
and work with them the code will not compile. I get hundreds of errors from file
excel.tlh. And this one is automaticcaly generated.
I eliminated most of the warnings (by renaming, e. g. the "RGB" macro after the
#import statement). Though the 'excluding IFont' is still there.
I have also read a few tutorials and they almost all used the same approach
as I did. Am I missing something? Does anyone else have encountered similiar
problems?
Does anyone have a sample solution for VS2005? I found one
for VC6 but to get it to compile I had to 'hack' the afxmsg_.h file (yes, its a build in
system file for VS). I would prefer a 'clean' solution.
Please help.
Thanks in advance!
|
|
|
|
|
|
DFGM,N!
I've already exhausted that option.
|
|
|
|
|
Hai,
can anyone tell me what is the real problem in implementing malloc here
bmpsrc = (U8 *) malloc(bmpsize);
memset(bmpsrc, 0xff, 5);
Thanks
Harshadha
|
|
|
|
|
You should probably check that bmpsrc != NULL - your memory allocation could fail if there's not enough memory (or if there isn't a single chunk of memory big enough for the allocation)
|
|
|
|
|
void example()
{
U32 bmpsize; //this is an integer datatype
U8 *bmpsrc=0x00FC0; //this is the character datatype
//i want to use malloc only .....
bmpsrc =malloc(bmpsize);
memset(bmpsrc, 0x00FC0, 0);
..
..
..
}
this is my actual coding .....
i dont know how to change its memory allocation
Harshadha
|
|
|
|
|
I think you've got your initial variable setup the wrong way round. bmpsize doesn't seem to have a value, and you're setting the value of your pointer to 0x00fc0, which I guess is meant to be the actual size. If that's the case, you've also got the second and third arguments of memset the wrong way around.
I hope you'll remember to free that pointer when you're done with it.
|
|
|
|
|
What is the size of bmpsize ? If it is under 5, then you are writing outside the boundaries of your allocated area.
BTW, do you really want to code in C ? Why not use new instead of malloc ?
|
|
|
|
|
It's hard to know for sure without knowing what bmpsize is, but I would guess that bmpsize is less than 5. When you call memset, you are setting the five bytes starting at the address of bmpsrc to 0xff. If you have allocated less than five bytes, you will be writing to memory you do not own
|
|
|
|
|
harshadha wrote: bmpsrc = (U8 *) malloc(bmpsize);
memset(bmpsrc, 0xff, 5);
Did you check that bmpsrc was not NULL?
bmpsize is checked for being greater than 5?
maybe memset(bmpsrc, 0xff, max( 5, bmpsize)) would be better?
Other than that, the code snippet looks fine.
"We trained hard, but it seemed that every time we were beginning to form up into teams we would be reorganised. I was to learn later in life that we tend to meet any new situation by reorganising: and a wonderful method it can be for creating the illusion of progress, while producing confusion, inefficiency and demoralisation."
-- Caius Petronius, Roman Consul, 66 A.D.
|
|
|
|