|
What function can I call to display the coordinates of the point?
|
|
|
|
|
what point ? the mouse position ?
have a look at GetCursorPos
Maximilien Lincourt
"Never underestimate the bandwidth of a station wagon filled with backup tapes." ("Computer Networks" by Andrew S Tannenbaum )
|
|
|
|
|
hi,,,,,,
Is there any tool available which will read the .h file and give me the class
information such as a listing of all the member functions, etc ?
Any help is appreciated.
Thanks in advance.
saleem
|
|
|
|
|
|
Hello, how do I access the element which resides in a vector of set. The codes are show below.
vector< set<int> > objSetVt;
set<int> objSet1;
objSet1.insert(2);
objSet1.insert(4);
objSet1.insert(2);
objSet1.insert(7);
set<int> objSet2(objSet1);
set<int> objSet3(objSet1);
objSetVt.push_back(objSet1);
objSetVt.push_back(objSet2);
objSetVt.push_back(objSet3);
vector< set<int> >::iterator objVtItr;
for(objVtItr = objSetVt.begin(); objVtItr < objSetVt.end(); objVtItr++)
{
//??? How to access the element now
//objVtItr[0][0] <-- this give compile error
}
Sonork 100.41263:Anthony_Yio
|
|
|
|
|
In the example, objVtItr is an iterator, but inside the loop you are access the actual containers via [] operator.
One solution is to access the container directly.
std::set<<...>>::const_iterator iData = objSetVt[x].begin();
Kuphryn
|
|
|
|
|
Hai,
I think the problem is simple. That for a vector class, "[]" operator is overloaded. But for set the "[]" operator is not overloaded.
So access the member of vector by using [] operator and then use iterators to traverse throught the set.
|
|
|
|
|
guys..
As i wrote earlier..my control doesnot show up when i host the control in the test container...now this is only happening in the UIDeactivated mode..
how can i set my control to draw itself and show in the UIDeactivated mode inside the test container..?
thanks again
|
|
|
|
|
hi there..
guys i wanted to know if u have a control and u place it in a container, but the control doesnt show rather just a boundary rectangle is visible..but when i execute the container with the control..the container is visible..
is it something to do with designmode or something or something else??
thanks
|
|
|
|
|
In the OnPaint of ur ActiveX Control you have to draw seperatly for Design mode as well
Live as if your were to die tomorrow. Learn as if you were to live forever.
-Mahatma Gandhi
|
|
|
|
|
class c{
public:
a();
b();
};
main()
{
class c *pc = 0;
pc->a() //works
}
class c{
int i;
public:
c(0):i=0;
a();
b();
};
main()
{
class c *pc = 0;
pc->a(); //doesn't work fires exception
}
why?
|
|
|
|
|
Because you are invoking a function (a() ) on a pointer that was specifically made invalid (set to 0 ).
Who is 'General Failure'? And why is he reading my harddisk?!?
|
|
|
|
|
What's the definition of function a()?
Contrary to popular belief, while you can call a member function through a null pointer, it only works if you don't need to access any member variables or virtual functions (essentially, you don't need to dereference this ).
If a() uses the i integer in the second example, then you are trying to access a variable through a dereferenced null pointer, which obviously will fall over.
--
Ian Darling
"The moral of the story is that with a contrived example, you can prove anything." - Joel Spolsky
|
|
|
|
|
Bravo
Live as if your were to die tomorrow. Learn as if you were to live forever.
-Mahatma Gandhi
|
|
|
|
|
Can U clarify on the matter of this. Please, I know what U told is correct but not able to understand 'you don't need to dereference this'.
|
|
|
|
|
SiddharthAtw wrote:
Please, I know what U told is correct but not able to understand 'you don't need to dereference this'.
When you call a member function, that function has access to an intrinsic pointer called "this", which is a pointer the object you called the method on.
So in a hypothetical example:
int main()
{
c myObject;
myObject.a();
c *myPointer = new c;
myPointer->a();
c *myNullPointer = 0;
myNullPointer->a();
}
void c::a()
{
this->i = 1;
i = 1;
}
--
Ian Darling
"The moral of the story is that with a contrived example, you can prove anything." - Joel Spolsky
|
|
|
|
|
Thanx for making it Crystal Clear.
|
|
|
|
|
Not tricky, it is just basic. Second case will not work... how can you initalize the member variable 'i' while declaring it in the class c,u have to use constructor to initialize it. There is nothing to do with null class pointer. In both cases u have to define the functions a() and b() before calling them.
when going gets tough the tough gets going
|
|
|
|
|
I agree with U. But my intention was about null pointer thing. If U have any please tell me
|
|
|
|
|
As far as VC++ 6.0 is concerned it is working i.e. null pointer can be used to call the member function but it is not advisable. it may work in few compilers but it is not standard, u shud always initialize the pointer to some valid memory location of this class C type that is what we call initialization of pointer. it could be any pointer for that matter u shud make it point to a valid memory location of its type. when u go for big programs, in the sense, if u use lot of pointers with huge data and dereference it, u may get into Access violation errors and some ugly errors. Please feed the pointers with valid memory location(food) and ask it to work.
when going gets tough the tough gets going...
|
|
|
|
|
You are using undefined behavior, that is why it doesn't work.
Calling a member function through a null pointer is invalid,
so the fact that two different invalid behaviors are different
is a minor matter of compiler specific details.
To put it another way, both pieces of code are not valid C++,
and consequently the discussion of different behaviors is irrelevant,
Visual Studio 8.0 could give you completely different results (in
fact a good C++ lint program would detect this error and report it
to you.)
If it is your goal to call a class defined function without a
specific instance of the object you need to use a static member
function, viz:
class c { public: static void a(); };
main()
{
c::a();
}
|
|
|
|
|
hello,
here is a prob.
suppose i will print a document. the printer spoller collects all the datas & my program in WIN32 can trap all the datas in the spoller.
here i m getting total no of pages in one document for a particular print job.but i want the following...
1. suppose i will give 2 copies (more than 2 copies) in the
print dialog and put sufficient paper in tray than it is not giving the total no of pages to be printed. WHY /???
2. if any one knows how to calculate the total no of pages printed for a job (with single copy as well as multiple copies) than please help in this regards....
here i m taking ENUMPRINTERS & ENUMJOBS APIs for all the information .
i m getting all the spoller information in ENUMJOBS.except the no of pages ....i m testing in samsung ML-4600 PCL 6 printer.
is the page count is printer specific ? i dont think so ...
otherwise no apis should have a data like pagecount...or so..
if any one knows please try to solve this prob 7 quickly inform me ...
if any information is required from my side ,,,i will help...
regards
skpanda
|
|
|
|
|
Hi all,
i've added an item to the 'File' meun of outlook.
i can set the property 'ShortcutText' to be something like "Ctrl+Shift+M".
if i do that, i see this string near the menu item, when i open the file menu.
problem is when i press 'Ctrl+Shift+M' combination nothing happens?
what should i do?
thanks
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
Hai guts.,
I had an problem while indexing an mdb file with dao connection
int CTruckRecord::OpenFiles()
{
try
{
//open the database
Dccdb.Open("\\ibp-naga\\naga\\dbs\\dccclient.mdb");
//open the individual table
TruckTbl.Open("TruckRecord");
//to retrive records from the database table, you should open it
CDaoRecordset::Open(&TruckTbl);
//to set current index for table type record sets,
SetCurrentIndex("TRK_NDX");
}
catch( CDaoException* e )
{
//an exception object for DAO classes which will report error occured
//and delete it afterwards immediately. These are member functions of
//the CException class, the parent class for CDaoException
e->ReportError();
e->Delete();
return FALSE;
}
return TRUE;
}
While executing the above code. The exception handling catch an error at the line
SetCurrentIndex("TRK_NDX");
Display the error as below:
"TRK_NDX@ isn't an index in this table. look in the indexes collection of the tabledef to determine the valid index names"
Any one could say wat this line mention.
Thanx in advance.
bye.,
Shanmuga Sundar.V
|
|
|
|
|
i am student at graduate level and i have a need of projects ideas in clips (A.I).
|
|
|
|