|
The BoundsChecker suite includes a program that does exactly that - you run the program, use all the features and it lists the stuff that was not called.
Christian
I've learned that you cannot make someone love you. All you can do is stalk them and hope they panic and give in.
The early bird may get the worm, but it's the second mouse that gets the cheese.
|
|
|
|
|
You can profile your program in typical runtime scenarios.
Link you project with profile enabled and then,
profile it with the 'function coverage' statistics report.
This will tell you how often a function is used, and eventually
tell you which functions are never used at all.
Cheers.
Maxime.
--
Maxime Labelle
maxime.labelle@freesurf.fr
|
|
|
|
|
You can get some insight by compiling in release mode with .map file output turned on. Examining the .map file will reveal which functions were linked into the final executable. In release mode (with optimizations turned on), linker rejects functions that can't be called b/c there are no calls made.
However, the inline functions will be always missing from .map. Optimizing compiler can also decide to use inlining on functions without 'inline' modifier.
Tomasz Sowinski -- http://www.shooltz.com.pl
|
|
|
|
|
Hello,
I have a little problem, i don't know how to create a Array that contains different data type.Is it possible to do this without using "struct".
Thanks for help.
R.G
|
|
|
|
|
Hi
The compiler expects all elements of an array to be of the same type.
But there are several ways to work around, but somehow there's no way around a struct or similar type.
If you work with objects, you should use a common base class for all your different types of objects in your array, then you create an array using this base class.
If you use standard c types, the most conveniant way is probably to work with unions. they are used within structures, and allow you to group members within a structure to be part of a union. per structure you can have several unions. the size of structure is the size of the biggest union.
in other terms, the union is kind of a mask which defines how you look at the bytes that belong to your structure... once your structure is an array of chars, once its a couple of intergers, ... it all depends on the unions you define.
to have some type safety, it is recommended for your case to still have a member in the structure that defines which type of union was used, otherwise you can run in quite some ugly problems.
check out your documentation for further reference.
Regards
Daniel
|
|
|
|
|
If you're speaking of classes, that would be easy to accomplish. Create a base class with either an identifier function like "CMyClass::GetObjectType" that returns an integer ID, or by using the MFC "RUNTIME_CLASS" macro.
If you're speaking of structs, you'll have to store pointers cast to void and in each struct, place an identifier field of some sort.
For basic data types like integers and strings, you can build a _variant_t array and wrap the array with a class with accessor functions that allow the programmer to use regular data types (int, double, CString) to populate the array, while hiding the details of the array (the fact that it's an array of variants).
If you really wanted to get fancy (and make the code more compartmentalized and maintainable), no matter which method you uise, you could wrap the array with an accessor class. That way, all the programmer has to do is request an item of the desired type, and the class could return NULL or a pointer...
Piece of cake.
|
|
|
|
|
Hi,
I am writing a image capturing app which support user select any region on screen, so I
used system mouse hook to track mouse movement (WH_MOUSE). Everything seemed right,
until I found that my hook don't reiceive WM_MOUSEMOVE when mouse cursor go out of
current window while left button keep down.
It is very strange, I've debugged but don't find any thing wrong
In all message handle I return 1 for preventing any window process them.
Thanks a lot for your assistance.
Do Quyet Tien
|
|
|
|
|
Hi,
do you have this line "#define _WIN32_WINNT 0x0400" before including Afxwin.h ?
I found that without it that doesn't work right.
Alex
|
|
|
|
|
|
hi all,
i need a *good* tutorial regarding use of MFC's, especially in the graphics drawing context. I'm TOTALLY lost between UpdateAllViews, OnUpdate, OnDraw, OnPaint, etc etc etc, coz' i can't grasp the concepts behind it all. i mean, what's the link up between all this stuff? please tell me if there's a tutorial on the web that clarifies all these concepts. yhanks.
imran.
help me today, and may be i'll help you out tomorrow... (yeah, it doesn't seem too likely right now, i guess!)
|
|
|
|
|
I don't know of one on the web, but I have a book called Beginning Visual C++ by Ivor Horton (I think --
it's not here with me; I believe it is published by SAMS press) that helped me a lot.
It does a really good job of explaining the basics of MFC
and then gets into some really good examples to illustrate what's going on.
The main example in the book is a basic drawing program that I think would do a good job of
explaining the stuff you say you are having trouble with.
It's a few years old, so I don't know if you can still find it. I hope you can because it's a really
good book.
|
|
|
|
|
"Beginning Visual C++ 6" by Ivor Horton.
Wrox Press Inc; ISBN: 186100088X (it's not SAMS like I thought).
I found it just now on Amazon, so I know it's still available ($40).
|
|
|
|
|
This one is really good.....try it.....
http://devcentral.iftech.com/learning/tutorials/submfc.asp
|
|
|
|
|
my code goes like this:
struct myStruct
{
CString m_string;
int m_integer;
char* m_pchar;
}
void func()
{
myStruct* s;
s->m_string = "a string";
s->m_integer = 1;
s->m_pchar = "a string too";
}
apparently the pointer s is uninitialised. how can I make this code work?
|
|
|
|
|
struct myStruct
{
CString m_string;
int m_integer;
char* m_pchar;
};
void func()
{
myStruct *s;
s=malloc(sizeof(myStruct)); //this is the key line..
s->m_integer=1; //.. blah blah
remember to free(s); at the end!
You need to initialise a memory space for the 'struct'. Another way to do this would be to NOT declare it as a pointer.
Hope this helps. I also hop i havent made any silly mistakes.. I am away froma compiler!
|
|
|
|
|
Unless you are using C, please do not use malloc - use new/delete instead. Among other things, it means you get a destructor which is called on delete. This, in turn, means your class can clean up after itself. Replace malloc with
myStruct* s = new myStruct;
at the end
delete s;
Christian
I've learned that you cannot make someone love you. All you can do is stalk them and hope they panic and give in.
The early bird may get the worm, but it's the second mouse that gets the cheese.
|
|
|
|
|
Oops, yes... sorry about that.
Saw a 'struct', assumed C...
My Fault.;)
|
|
|
|
|
Hi,
We use several custom file formats for storing video data in various formats. I want to write a source filter that will allow me to read in the file and output yuv (for example). I have no problem reading in the data or changing the format. I do however need some help on how to write a source filter. Can anyone give me some pointers
Cheers,
Nick
|
|
|
|
|
I writing an app which should bring itself to top upon a particular internal event. I managed to make it the toplevelwindow, but I found no way to make it have the input focus, neither the button in the taskbar to get selected.
This is my final code:
if (RNEWMESS)
{
if (pMain->IsIconic())
pMain->ShowWindow(SW_RESTORE);
pMain->SetWindowPos(&CWnd::wndTop,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE);
pMain->SetWindowPos(&CWnd::wndTopMost,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE);
pMain->SendMessage(WM_ACTIVATEAPP,(WPARAM)TRUE,(LPARAM)this->m_nThreadID);
pMain->SendMessage(WM_ACTIVATE,WA_ACTIVE);
pMain->ActivateFrame();
pChild = (CPMCFrm*) pMain->GetActiveFrame();
if (pChild)
{
pChild->ActivateFrame();
pChild->SetFocus();
pChild->SetActiveWindow();
CView* pView = pChild->GetActiveView();
if (pView)
{
pView->SetActiveWindow();
pView->SetFocus();
}
}
}
Anybody has some suggestions?
|
|
|
|
|
Call CWnd::SetForegroundWindow, which is a wrapper over API SetForegroundWindow. There are several restrictions on setting the foreground window, especially on Win2000 - you can find the details in MSDN docs on SetForegroundWindow (Platform SDK: Windows User Interface).
Tomasz Sowinski -- http://www.shooltz.com.pl
|
|
|
|
|
Thanks!
It works fine for Win95 and NT4, but on Win2000 I had no success. Although I have applications running (on Win2000) that manage to switch themselves to the foreground. I wonder how they do that...
Daniel Schmid
|
|
|
|
|
Dan I do not have an answer for you. But I have been working on the same problem for two days. SetForeground() does not always work, especially if some other app has a system modal message displayed.
If I find the answer, I will email you. And if you find the answer, would you please email me.
Phil
at
LynnPhil@Qwest.net
|
|
|
|
|
Hello,
Im sure this has been asked before but i couldnt find it in any of the recent post.
I am looking for a good online tutorial over MFC network Programing. Either with CSocket or
CAsyncSocket.
It appears this tutorial needs to be written for a dummy cuase I've gone through Several Sample Apps and MSDN and Cant get seem to get it down.
If it was a simple chat server/client like the one included in MSDN, but with the CSocket stuff explained a little it would be perfect.
If you know of a tut like that please respond.
Thanks for any help,
HAM
|
|
|
|
|
I want to bring on top a browse item dialog box when login to my app is successful while my main frame window is hide but I can't.
Thanks for your assistance.
Do Quyet Tien
|
|
|
|
|
The main window not being visible stops SetWindowPos from working ? If you've not tried that, in your dialog it's
SetWindowPos (&wndTopMost, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOZORDER);
Christian
I've learned that you cannot make someone love you. All you can do is stalk them and hope they panic and give in.
The early bird may get the worm, but it's the second mouse that gets the cheese.
|
|
|
|