|
Helping someone doesn't necessarily include providing a piece of working code. Asking why someone wants to do something is irrelevant. If someone can't actually help, they should just STFU and let someone else step up. The post I responded too has already generated three needless replies and just makes noise that the OP has to wade through.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
John Simmons / outlaw programmer wrote: If you can help the man, do so. WHY he wants to do it is not important at all.
Sir, actually just want to know root cause of the problem.. numerous times people here at forums ask thing which they don't actually need! which create problem to them at later stage.. so to solve there problem.. some time people ask what actually they need.. Just like we do in URS/SRS phase.. You very well know that.
secondly, if you see.. that guy require double slashes which you see he don't need! hope i clear my point.. if any thing wrong... i am sorry!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and you
|
|
|
|
|
Hi All,
On what all events CWnd::OnKillFocus event is generated.
Actually, I have my grid and when I copy & paste a value in the cell, OnKillFocus event gets generated. I have actally confused with this behavior.
Is anyone have some idea about the same?
Thanks
Suraj Gupta
|
|
|
|
|
A kill focus notification should only be sent when a control actually looses focus. For example, if you have a button control focused, and you press <tab>, use a nmemonic to go to another control, or click on another control/window, that button should send a kill focus message.
Pasting into an edit control, or some other editor, should not be sending kill focus events, IMHO. You may get them as you moved from the copied cell to the target cell (because the source of the copy looses focus), and this may or may not be correct behavior depending on the behavior of the grid.
Peace!
-=- James Please rate this message - let me know if I helped or not!<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
|
|
|
|
|
hi all,
i am having Two DLL's and in one Dll i am having a Class, in that Class i am having a static member variable.
Now in another DLL's Class i want to acess the One's (First Dll's) static member variable.
//----------------------------------------------------------
First DLL,
Class One
{
static int onevar;
}
//----------------------------------------------------------
my question is in the second Dll
Class Two
{
// I want to dynamically link only the First Member Variable.
}
Please give any code such that i can access the First DLL static Member Variable in the Second DLL.
Any Import Techinique.
Uday kiran
|
|
|
|
|
example
#define TESTDLL_API __declspec(dllexport)
//Testdll.h
class TESTDLL_API CTestDLL {<br />
public:<br />
CTestDLL(void);<br />
static int m_i;<br />
};
//Testdll.cpp
TESTDLL_API int CTestDLL::m_i=0;
In DLL two, where you are going to use this header file and
define TESTDLL_API macro as __declspec(dllimport)....
Hope this helps..
Thanks...
Please let me know if you have some doubt....
Suraj Gupta
|
|
|
|
|
I have encountered annoying problem:
<br />
template <class Type, class Allocator>} class A : public B, public vector<Type,Allocator><br />
{<br />
}<br />
<br />
class sample1 : public mybase<br />
{<br />
}<br />
I have a need to cast this template:
<br />
A<sample1*> vec;<br />
vector<mybase*> *result = (vector<mybase*>*)&vec;
How to do it if it is actually possible?
(i need exactly that situation, from A template i need to get pointer to A but casted to vector)
Thank you for reading this and even more for the answer... although i am afraid it is not posssible
|
|
|
|
|
It is quite difficult to read your code because all the < and > are missing (and, for templates, that's quite annoying). Replace all occurences of these in your code by the '<' and '>' symbols (just above the emoticons). And by the way, what is sample1 and mybase ? What are they doing here ?
Anyway to answer your question: vec (instance of A) IS a vector (because A inherits from std::vector) so you can use all the methods of your vector, you don't need to cast it.
|
|
|
|
|
Naah, when i say i need it, i NEED it
I have a base class with dispatch table for pointers to derived class member variables and to leave it generic i need to downgrade any type to my base class or default supported types. I am supporting vector but unfortunally some people has """creative""" way of thinking, i could rewrite it but its a lot of code to change so i would like to avoid it by casting it to vector<*>* that i can handle. And as i am modifying values of member variables via dispatch table in base class i cant just move it to normal vector<> and then back, i need actual pointer to that vector so i can modify it (well, add new values inside, remove values,...)
Well anyway thx for responding.
-- modified at 4:27 Friday 12th January, 2007
|
|
|
|
|
Sorry, I misunderstood you, I thought you wanted to cast your class to the base class vector (but in fact you want to cast the contents of the vector).
But I still don't fully understand why you want to do that. Another point also: are you sure you want to inherit from std::vector ? Wouldn't it be better to create a class that wraps the vector and provide functionalities to 'manipulate' the vector (and in these methods, you'll then be able to retrieve a specific entry in the table and cast it to the appropriate base class if needed).
Maybe it is just a design issue.
You can also do something like this:
template <class T>
class A
{
std::vector<T> myVector;
};
|
|
|
|
|
Well its a long story, i'll try to make it short. You got a class structure (class has member variables that can be ints, strings, whatever, classes, ptrs). In every constructor, pointers (or pointers to pointers) to member variables (and some other stuff,...) are stored in dispatch table in my class that is base class of every class used. With this i can convert all the class structure to xml and recreate it from xml. It works like a charm , but now i have described problem.
I have thought about the walkaround you described, but unfortunally the dam* template is """legacy""" i got and it is used everywhere. Changing anything would mean a lot of modifying unless i recreate all the base operations. Sure it would work but cast would be more efficient solution.
|
|
|
|
|
ok. solved. thank you for your help.
|
|
|
|
|
Sorry, not possible. vec and result are of different types with no relations.
A<simple1*> has nothing to do with vector<mybase*>; the problem is not in A and/or vector, but in template parameters - simple1* and mybase* - they should be exectly the same type.
IOW, if template arguments are of defferent types (no matter their parent-child relationship), the resulting templatized classes are incompatible.
I think the best thing to do is change the design strategy.
--
======
Arman
|
|
|
|
|
Damn... yeah meanwhile i saw some problems coming...
Just to clearify for myself;
I am storing pointers in template, so the size of stored data should be the same, size of pointer.
Why this is a problem?
|
|
|
|
|
Hello,
I use a Dialog Box with I’s own class derived from CDialog . I Call it “ MyDialogClass”
My Dialog box contains a List Control.
I also have a class that I call “MyListClass” implemented to support several functions specific to the List Control, such as drag&drop items.
List Control messages are routed to “ MyDialogClass”. I think it is normal because the Dialog box is the parent window.
However I would like the List Control messages to be routed directly to “MyListClass” .
Could you, please, tell if it is doable and how to do it?
Many thanks for your help.
|
|
|
|
|
If you're using MFC, use message reflection to let the list ctrl handle messages that would normally go to its parent. Check out ON_NOTIFY_REFLECT in the docs.
|
|
|
|
|
It sounds great!! Many thanks.
By the way does it exist a similar approach to send messages from menu and toolbox messages to a specific class?
|
|
|
|
|
Hi,
I m working on a project wherein i need to parse c files to come up with some analysis.
Mainly, I need to identify global variable declarations and then their usage pattern in functions in c file i.e. whether that global variable is being read or written in a given statement.
e.g. if a g1 and g2 are 2 global vars say and l1 is a local variable say.
then for statement, g1 = localVar + g2 * 10;
g1 is being modified and g2 is being read here.
I want this read/write usage (R/W) to be reported.
I am using lex and yacc tools for identifying tokens and statements.
But within a given statement, I need to find out read/write pattern.
Any help in this regard would be really helpful.
Thank you in advance.
Abhijeet Jadhav
|
|
|
|
|
This is quite simple. Use a 'c' grammar -- this should be easy to find on the web -- for lex and yacc, and for each file, count how many times a variable is assigned (eg. on the left part of an '='). These are write accesses, and should be reported by your parsing. Then count the number of times the variables occurs in the file outside comments. The number of read accesses are the number of times the variable occurs in the file minus the number of write accesses.
|
|
|
|
|
Thanks Rage for replying.
But one major concern is, how to tackle read/write when variable is a pointer.
In that case, just looking at left or right of '=' may not help.
e.g. *ptr = 10; here ptr is on left but its not modified, instead value it points to is modified. And pointer can be accessed in number of ways, so how to come up with some generic solution?
Another concern I have is, about the macros ( i.e. #defines ), macro definition may contain variables. Is there any way to get the macros expanded for a given C code?
Please reply if you have any thoughts/ideas regarding this topic.
Thanks in advance,
Abhijeet Jadhav
|
|
|
|
|
abhi_code wrote: I am using lex and yacc tools for identifying tokens and statements.
But within a given statement, I need to find out read/write pattern.
If you are far enough along to be using yacc and lex, you should have enough of a parser and lexer to identify variable declarations, and thus can identify variables and add them to a kind of symbol table. With that info, you can identify references to them further down in the code.
If you do not have a complete grammer yet, Google for Roskind Grammars for some decent ones to use. The parser does not have to be that intelligent - in fact, you do not really have to do much parsing, if you are just looking for variable references.
Peace!
-=- James Please rate this message - let me know if I helped or not!<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
|
|
|
|
|
Thanks James!
I am able to find out the variable references...
but one concern is, there are a lot of ways in which a variable may get
modified in a C statement, especially the case of pointers.
e.g. we can have local pointer pointing to global variable and variable
may get modified through this pointer. So only appearance of a variable
on left side of '=' may not suffice to indicate Write usage of that variable.
If variable itself is pointer.
e.g. ptr is pointer, then consider a statement like *ptr = 10;
Here ptr appears to left of '=' but ptr is not getting modified, infact
variable it points to is modified. So here usage should be reported as
Read usage of the variable. There may be such scenarios for pointers.
Thats why i was looking if i can get some code which can look for
variable read/write access pattern. But now I think I need to work it
out myself.
If you can help me in sorting out pointer scenarios involved to check
read/write of variable, I would be really thankful to you.
One more question for you, will i need to store the data type
information of the variable in order to look for its read/write usage?
or just looking for variable name in statements can do the job.
Once again thanks for the prompt reply and expecting some help from you
in this topic.
Abhijeet Jadhav
|
|
|
|
|
Hi
All
I want my application should have japanese menu,dialogbox and error messages, so how can i type japanese font in Resource. Whhere i have to make settings for Japanese font in my project resources.
Thnaks and Regards
Atul Mahajan
Atul Mahajan
|
|
|
|
|
which version of visual studio are you using? as i recall in vc6 and vc7 the win32 resource editors do not support Unicode...
|
|
|
|
|
This[^] article will surely help you.
Nobody can give you wiser advice than yourself. - Cicero
ப்ரம்மா
|
|
|
|