|
At the top of your code you define this variable as datatype TCHAR with length of 50.
TCHAR temp[50];
Later in your code you do the following:
char ctemp[32 + 1];
...
...
sprintf(ctemp, "%S", temp);
1.) The variable 'temp' is datatype TCHAR which will be wchar_t in unicode builds.
2.) sizeof(char) == 1 byte while sizeof(wchar_t) will be 2 bytes in Windows.
In a unicode build it will be possible to write 100 bytes into a 33 byte buffer.
In a non-unicode build it will be possible to write 50 bytes into a 33 byte buffer.
Hope it helps.
-David Delaune
|
|
|
|
|
Randor wrote: In a unicode build it will be possible to write 100 bytes into a 33 byte buffer.
In a non-unicode build it will be possible to write 50 bytes into a 33 byte buffer.
I do not think it is ever possible to write 50/100 bytes into a 33-byte buffer.
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
I wish that were the case. Unfortunately buffer overflow exploitation [^]is the main source of vunerabilities on all modern operating systems. With technologies such as DEP[^] and safe string functions[^] it is becoming less of a problem. But ultimately your security is determined by the software engineering team who authors the software.
Best Wishes,
-David Delaune
|
|
|
|
|
I understand all of that. I was commenting, tongue-in-cheek, about your "It will be possible to write..." statement. Maybe you meant to phrase it that way.
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
Hi i am new to mfc concepts.
In my mfc based appllication i want to change the color of the menubar
can anyone suggest me the approach for doing that...
Thanks in advance
modified on Monday, August 11, 2008 8:21 AM
|
|
|
|
|
|
i want to write a win32 console in c++ and would like to connect to mysql database. can anyone show or guide me with the code for connecting to the server.
phokojoe
|
|
|
|
|
|
See here.
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
I am using SDI application with doc/view architecture support.I dont have any idea how to implement open file function.i read lots of article but not find any solution.
Thanks in advance.
Yes U Can ...If U Can ,Dream it , U can do it ...ICAN
|
|
|
|
|
Which type of file r u want to open?
Try CFile class to open and perform other operation on that file.
IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH
|
|
|
|
|
Hi Shanky,
Thanks For reply.
I want to open the unicode txt file in CEditView.I know internally onOpenDocument is called but dont know how to implement it. so that the code is open in View Window just like notepad.
If you have any code than pls share with me or if any idea how to implement it.
Again thanks
Yes U Can ...If U Can ,Dream it , U can do it ...ICAN
|
|
|
|
|
Shilpi Boosar wrote: ...but dont know how to implement it. so that the code is open in View Window just like notepad.
Your document class will contain some sort of buffer to hold the contents of the file. Your view class will render that buffer on the screen/printer.
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
Hi David thanks for reply.
I am able to open the file in view window but when i close the application and open the txt file than that file is blank. i dont know why.
If you have any article that explain the doc view architecture and splitter window than please send it to me.
Thanks
Yes U Can ...If U Can ,Dream it , U can do it ...ICAN
|
|
|
|
|
Is the document class overwriting the file?
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
Hi all
I am new in vc++ and i want to change win32 code to MFC code.I found artical from codeproject.com link is [code] http://www.codeproject.com/KB/winsdk/usbdisks.aspx[^][/code]
I want to change it output style.I want to print out in MFC Dialog application in list box. Plz help me..
Thx's in advance..
|
|
|
|
|
Get a book. For your needs, I would recommend "Programming Windows with MFC" from Jeff Prosise.
|
|
|
|
|
Create a new dialog-based project. Copy the relevant code to this new project.
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
what type of problem are you facing!
|
|
|
|
|
when i declara [code] BOOL GetDisksProperty(HANDLE hDevice, PSTORAGE_DEVICE_DESCRIPTOR pDevDesc)[/code] then i am geting error [code]
error C2061: syntax error : identifier 'PSTORAGE_DEVICE_DESCRIPTOR[/code]. Plz help me
modified on Tuesday, August 12, 2008 1:42 AM
|
|
|
|
|
Hello evrybody.
I have developed an MFC application, but now I would like to enable people to develop sort of addins to that application.
I do not want to give the source code of my application, rather do the same way as Visual Studio : ie provide developers with an SDK with which they can create addins that can enhence VS.
Is there any detailed way how to do that ? Like an existing application that features the best practises for me how to organize my application internal code, and how to expose its programmable interfaces.. etc
Thank you in advance.
Our Philosophy, Mohammed Baqir Al Sadr
|
|
|
|
|
Perhaps you should take a look at Code Project's most popular aricle here[^] as it seems to include extensibilty support. Otherwise I recall an MSDN Magazine article/series from 6+ years ago that dealt with this. You could search up their back catalogue. Most people who do this sort of thing probably end up using COM either directly or in the form of hosting ActiveX controls. I belive there's a standard way to integrate property sheets with COM based plugins but I've never seen an example.
I hope you find what you're looking for.
"The secret of happiness is freedom, and the secret of freedom, courage."
Thucydides (B.C. 460-400)
|
|
|
|
|
Good Morning,
I got a small problem...
I use 2 Picture Control boxes. the first box play a stream from my webcam, the second should be overlap the first, and show a grabbed edited frame.
I just use m_webcam.ShowWindow(0) and m_pic.ShowWindow(1).
The Problem is, after i called this, the Picturebox is empty. But when i minimize and maximize the window, the Picture is shown like i expected.
Is there a way to redraw the picturebox??
|
|
|
|
|
CWnd::Invalidate is used to force the redrawing ofa certain window or control. If that helps !
Our Philosophy, Mohammed Baqir Al Sadr
|
|
|
|
|
Thank you for your awnser. I tried it, but the problem is still the same
|
|
|
|