|
chanduabcchandu wrote:
struct tagMystruct
{
char *name;
int nameLength;
char *disign;
int disgLength;
...}
Yes, you can do that since you mention that it is a "C" project, hence no C++ code. If you can build the project in C++, you can then use string objects (MFC's CString , STL's std::string ) that will handle the memory allocations for you as well as supply methods for assignment, concatenation/appending, etc.
If you have to stick with the manually-managed buffers, be sure that when calling the string-related functions, you take care to use the n versions of the functions, like strncpy(...) , so that you can help protect yourself from buffer overruns.
Peace!
-=- James Please rate this message - let me know if I helped or not!<hr></hr> If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! See DeleteFXPFiles
|
|
|
|
|
There's one thing you shouldn't forget. that's to delete the "new"ly allocated buffers.
But,std::strings. Just awesome.
OK,. what country just started work for the day ? The ASP.NET forum is flooded with retarded questions. -Christian Graus
Best wishes to Rexx[^]
|
|
|
|
|
I am working on a project, where i have to catch event on Update of the particular control , message is already defined for it.
Between BEGIN_MESSAGE_MAP and END_MESSAGE_MAP i am putting
ON_MESSAGE (Messagename,UpdateFunction) statement with message and function name as a parameter.
i have written definition of UpdateFunction in the same class.
Problem is while running and updating control UpdateFunction is not getting executed.
is there anything i am missing for handling this ?
|
|
|
|
|
Do you SendMessage or PostMessage to the class that you defined message in it or the framework should do that for you?
Did you define a custom message or just redirect the same message?
Which message is it? What type of control? Is it a custom control for example?
Would you please provide some of your codes or at least more details.
// "In the end it's a little boy expressing himself." Yanni
while (I'm_alive) { cout<<"I love programming."; }
|
|
|
|
|
yah its a custom control and message is also a custom one , redirecting to other message ... , i mean to say that its a custom table control when i update a cell value it should get to that method which i have specified in On_Message ...
I just wanted to ask that is there anything that we have to do while handling messages
1)Define entry in message map
2)provide declaration and definition of Method (which you want to execute on event of message)
Tahnx
|
|
|
|
|
paresh_joe wrote: anything that we have to do while handling messages
If it's a CUSTOM message, then we shall follow the instruction:
1. Event handler MUST return LRESULT
2. Message variable should be defined in a right way, easiest: #define MyTestMessage WM_USER+1
3. Function declaration in the header file should should be written before DECLARE_MESSAGE_MAP() (e.g LRESULT OnSomething(WPARAM wParam, LPARAM lParam); )
4. In .cpp it should be declared in a MESSAGE_MAP block: (e.g.ON_MESSAGE(MyTestMessage, OnSomthing))
5. ALWAYS return 0 in the message handler function.
6. Only a window can accept messages, unless you create a custom message mapping, sending, dispatching, ... mechanism. So a CWnd object or derived classes can handle a message.
...
LRESULT OnSomething(WPARAM wParam, LPARAM lParam);
DECLARE_MESSAGE_MAP()
...
BEGIN_MESSAGE_MAP(CMyClass, CDialog)
...
ON_MESSAGE(MyTestMessage, OnSomething)
END_MESSAGE_MAP()
.
.
.
LRESULT CMyClass::OnSometing(WPARAM wParam, LPARAM lParam)
{
return 0;
}
// "In the end it's a little boy expressing himself." Yanni
while (I'm_alive) { cout<<"I love programming."; }
modified on Friday, December 07, 2007 9:29:01 AM
|
|
|
|
|
|
Dear colleagues,
I have a big project-solution (MFC-based), compounded of many dlls (in their own dll-projects).
All dlls have resources in their resource-files (*.rc; resource.h). Now I now from experience that there can be a lot of problems with resource-ID conflicts and much more.
Can you give me any hint how to tackle this problem?
Thank you in advance for your hints
modified on Friday, December 07, 2007 6:25:24 AM
|
|
|
|
|
For conflicts in the same resource file you can use
Resource ID Organiser[^] by Anna jayne
// "In the end it's a little boy expressing himself." Yanni
while (I'm_alive) { cout<<"I love programming."; }
|
|
|
|
|
Thank you !
This guides to my next question: What is with conflicts in different resource-files.
|
|
|
|
|
Hi.... I have created a SDI Application. I want a Dialog to be appeared on the top of the Document. Can anybody help me out?
|
|
|
|
|
have you tried something yet ?
is CDialog::DoModal() of any help ?
|
|
|
|
|
Hi All,
I'm looking for an unmanaged memory profiler which *also* tracks pages (to the page file). Is there such a product?
Jeff
|
|
|
|
|
Perfmon? :P
Peace!
-=- James Please rate this message - let me know if I helped or not!<hr></hr> If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! See DeleteFXPFiles
|
|
|
|
|
Sorry Wrong Line
Bram van Kampen
|
|
|
|
|
What do you mean 'Unmanaged Memory'? Is that the stuff you forgot to free before you lost the pointer?
Bram van Kampen
|
|
|
|
|
Bram van Kampen wrote: Is that the stuff you forgot to free before you lost the pointer?
If I could have voted 6, I would have (there's no bug in the new site to exploit in votiong twice either
I want watch a particular chunk of memory. Specifically, I need to know if a block obtained from AWE extensions is being paged out. I also want to compare overall paging (without AWE extension acquired) with the page I am trying to lock into memory.
Jeff
|
|
|
|
|
Jeffrey Walton wrote: Specifically, I need to know if a block obtained from AWE extensions is being paged out.
That's easy to answer. It can't be. Memory gained from AWE extensions is mapped directly into your process address space and is no longer managed by the OS.
DoEvents : Generating unexpected recursion since 1991
|
|
|
|
|
Hi Mike,
Mike Dimmick wrote: That's easy to answer. It can't be.
I think I have to break down and use Windgb or cdb. I was trying to avoid it, sice I don't know any of the MM command. Yuk...
|
|
|
|
|
Hmm
Sounds as if you want to do some very very low level tracking, and monitoring at OS Level. Also sounds like heavy stuff, like intercepting at OS Level, and surrepticiously maintaining the Intercept link. Matt Pietreck and 'SoftIce' would be where I would start my research on this.
It also occurs to me that it is one of those things one is not supposed to do, meaning that:-
1: Your Compiler/OS combination has an alternative method to achieve your ultimate goal.
2: If you are successful, and rely on what you develop this way, Whatever resulting code you may arrive at, is NOT guaranteed to work at any configuration other than your own. So, if you ship your code, you have a built in time bomb, because the chances are that at some time in future, on some of your clients machine, things will work out ever so slightly different, and come to grief.
I Strongly suggest that you re-design your code in such a way so that the question you ask does not arrise. DOS ran away with all of us, because it was so easy to modify and extend. Everybody had a go at any aspect they did not like. Win32 is different. It has a larger mission, the OS provides documented services, which allow code to run on diverse platforms, often from Win95 to Vista.
In Short, Tinkering inside the OS Calls is not the way to develop code!
Regards
Bram van Kampen
|
|
|
|
|
Hi Bram,
Bram van Kampen wrote: re-design your code in such a way so that the question you ask does not arrise.
This is kind of tough. I'm working to extend Crypto++'s secure allocator. At this point, the Crypto++ allocator zeros memory. But the memory can be paged out. In my minds eye, the next step is a secure heap with no paging. The secure heap is easy enough through AWE extensions.
However, verifying correctness is more difficult. I've begun assembling tools. WinDbg or cdb (SoftICE is no longer around), a raw disk editor, etc.
Bram van Kampen wrote: ... tinkering inside the OS Calls is not the way to develop code!
Pietrek does it all the time to develop an understanding of undocumented behavior
Jeff
|
|
|
|
|
That's Fine, Yo go that way, that's your project! Just do not be surprised if it refuses to run on any other machine other than your own!
I now understand where you come from. You are trying to implement a security system and to match it with the WindowsOS security system. The Bottom Line is: No Chance. Known Criminals in Northern Ireland have escaped prosecution, because the assembled forces of MI5, and GCHQ had to give up after five years of trying to decript MS encripted disks.
Microsoft is unlikely to give up it's market advantage it got in the european market by employing their proprietary encription mechanism.
Microsoft in Europe uses a Swiss encription algoritm, Invented in Switzerland, and which is much stronger than the American version but not subject to American export controls. (It did not Orriginate in the USA).
You appear to be intend on designing some encription taking place at base level. (i.e. Page Saving) Unfortunately, you'll have to write your own Encription/Decription, and it appears that you will have to write your own Device Managers to Implement the code. This is a Very Hard One to do, even at just your own computer! Unless you proceed very very Carefully. e.g. After you install the Encription/Decription handler, Unless it is able to establish which file is stored encripted, you may loose your entire disk!!
Believe me, I've been there. After you make it work at your own computer, you now want to makle it run on your customers'computers. This typically comprises of a mottly crew ranging from ancient Win95 Machines, NT, Win2000, etc, each updated to their service packs,
This was my Long Answer.
My Short Answer is:
Merry XMas, I Wish you Luck.
Regards
Bram van Kampen
|
|
|
|
|
Hi ALL,
I am using property page in my project. In Property page class i used pagePAth object of CStringArray class. I store paths in pagePath object. Now I want to retreive paths by using pagePAth object in CMyView class which is derived from CView class. I am unable to acces pahePAth object in CMyView class. Please send me solution if u have.
Thanks in Advance
am
hi
|
|
|
|
|
You may:
(1) declare it public .
(2) make a public accessor method to it.
(3) change is scope (relocate it and make it available to both classes).
(4) ...
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
Does CMyView own (i.e., bring up) the property sheet? If so, make pagePAth a member of CMyView . Then when you construct the property sheet, pass it a pointer to pagePAth .
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|