|
That's because the scope resolution operator - :: - is not used to dereference into an instance type. You can either use a namespace or (more appropriately) define the enum as static.
Cheers,
Tom Archer
Inside C#, Extending MFC Applications with the .NET Framework
It's better to listen to others than to speak, because I already know what I'm going to say anyway. - friend of Jörgen Sigvardsson
|
|
|
|
|
Cool thanks... Always good to be corrected and informed.
Thanks,
Nathan
---------------------------
Hmmm... what's a signature?
|
|
|
|
|
|
make the enum static
static enum LineStyle { ... }
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
hello ppl
ok this question is going to be a pretty long one what i want to do this time is display a BMP image which is in 24 bit format the normal operation like creating a compatible device content and using BitBlt is not the solution so what do i have to do also i want to display a GIF image which is actually in 89a format that supports animation so how do i display an animated GIF any code or anything would be appreciated
regards
Ahmed Ajmal
|
|
|
|
|
|
|
I'm using VC6, and created an MFC app through the app wizard selecting the Internet Explorer ReBars option. This puts a CDialogBar in the CMainFrame class.
Using the resource editor I added an Edit control and a button to the dialogbar, named IDC_EDIT and IDC_BTN.
I added a command message through the class wizard that maps the button to an OnBtn method in CMainFrame. I put a breakpoint in the method, and when I press the button, the app stops at the breakpoint.
So, how do I call CMyView::OnViewBtn() in my view class from the CMainFrame::OnBtn() method?
Thanks.
David Hisel -- http://www.hisel.com/
|
|
|
|
|
CMyView* pView = (CMyView*)GetActiveView();
if(pView)
pView->OnViewBtn();
That should work..
Rob
Whoever said nothing's impossible never tried slamming a revolving door!
|
|
|
|
|
Nope, it doesn't seem to work. Here is what I have:
void CMainFrame::OnBtn() <br />
{<br />
CMyView* pView = (CMyView*)GetActiveView();<br />
if (pView)<br />
pView->OnViewBtn();<br />
}<br />
pView is NULL every time I press the button, hence, no call to OnViewBtn().
Is there a way to send a message to the view class? Would that work?
David Hisel -- http://www.hisel.com/
|
|
|
|
|
Hi,
I've SDI application I start with SW_MAXIMIZE parameter passed to CFrameWnd::ShowWindow(). But I absolutely don't like that while the window is appearing on the screen, user can see its repainting progress (two ListViews changing their size, toolbar changing its size etc..). And it looks very ugly.
Is there any way how to get rid of this? For example Visual C++ has very nice repainting when changing size/maximizing - there are no "intermediate stages" of repainting progress that could be seen by user.
I think there must be some way how to do it - let all parts of application window (toolbars, views, ....) to find out their dimensions and placement BUT don't show main window untill this all is done!
Hope someone will understand my problem...
Thank you for any suggestion.
|
|
|
|
|
There are 3 things to look at wrt window repainting/flickering :
1. WM_ERASEBKGND - if you are drawing the control and repaint the entire area in your WM_PAINT handler then don't do anything in WM_ERASEBKGND (and return 1). This avoids flicker caused by WM_ERASEBKGND filling control with background color then WM_PAINT painting actual control detail.
2. Again, if you are painting the control, then think about rendering the control to a bitmap then bliting the bitmap to the screen.
3. If you need to reposition a number of windows at once try using BeginDeferWindowPos(), DeferWindowPos(), and EndDeferWindowPos(). This is usefull for splitter windows.
4. (ok, 4 things to look at) For initial display you could create all windows hidden, position them, then make them all visible. Another way is to create main window offscreen then when children have adjusted their sizes, move main window onscreen.
...cmk
Save the whales - collect the whole set
|
|
|
|
|
The window class is handling that for you. If you are using MFC, window classes are generally hidden from you. The flags you want to change are CS_HREDRAW and CS_VREDRAW. These flags tell windows to repaint the window when it changes size.
At least I think that is the case.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
|
Hi
I've been programming for about 4 years in C++ for fun, and I never really cared about that question. But now I'd like to know: What is "C" exactly, and what's the difference to "C++"? Is there any border? If I use functions like strlen, strcpy, strcat , fopen, fread, fwrite and use char s instead of std::string , do I program in "C" or "C++"? And what, if my program uses the Windows API?
Could someone explain to me, or give me some links that cover this question in detail?
thanks in advance
modified 12-Sep-18 21:01pm.
|
|
|
|
|
That's a tough question to answer in a short amount of space.
Here goes:
The main difference between C and C++ is that C++ has support for classes whereas C only supports structs. Because of this, a vast number of libraries/extensions are not available for use in C. This includes STL and MFC amongst others.
strlen, strcpy, strcat, fread, fwrite and char were all available in C. Obviously, the standard namespace was not. There are some language differences too, depending on the compiler, you can only declare variables in C at the beginning of you function. You can probably search Google for a complete list of syntactic differences.
Most of the Windows API should work in C as far as I know.
Personally, I prefer C - mainly for its purity, although I have been known to be a bit strange.
|
|
|
|
|
|
Greg S. wrote:
What is "C" exactly, and what's the difference to "C++"?
In addition to the others, here are some useful links:
http://www.research.att.com/~bs/bs_faq.html
http://www.research.att.com/~bs/bs_faq2.html
Greg S. wrote:
If I use functions like strlen, strcpy, strcat, fopen, fread, fwrite and use chars instead of std::string, do I program in "C" or "C++"?
You've not provided enough info for a sufficient answer. A C program can only use C code, but a C++ program can use both C++ and C. Consider the following .CPP file:
#include < iostream >
#include < stdio.h >
void main( void )
{
printf("Hello World\n");
}
Is it C or C++? Some folks would call it a C++ program because of the file's extension. Others would say not since it uses no C++ constructs. What if printf("Hello World\n"); were changed to std::cout << "Hello World\n"; ? Does that make a difference?
In some instances, I think it can be a difficult question to answer.
|
|
|
|
|
Ok, seems like I'm programming with a mixture of C and C++, I use class es and sometimes std::vector , which don't exist in C, but I also use strlen, fwrite etc, C-functions.
Seems to be hard to tell whether a piece of code is pure C or already C++.
Thank you all, you helped me understanding this topic
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Ok, seems like I'm programming with a mixture of C and C++, I use classes and sometimes std::vector, which don't exist in C, but I also use strlen, fwrite etc, C-functions.
If you look at the implementation some of those functions you'll be amazed that some are written in assembler! So would that make you an assembler programmer?
What I think is: C++ is has OOP (Object Oriented Programming) support. If you would use it, you would be programming in C++. Then again, within those classes and member functions you use C code
So what you shouldn't do is see C and C++ as 2 different languases, but see C++ as an extension to C !
In the end it all comes to 0's and 1's
A student knows little about a lot.
A professor knows a lot about little.
I know everything about nothing.
|
|
|
|
|
Hi,
I have a VB library file which has many functions/constants.
How can I use that in a VC++ program?
Should I make a VB dll file, and include all of the functions in it?
Ehsan Behboudi
|
|
|
|
|
You have to covert it to COM library.
|
|
|
|
|
how can I do that?
Ehsan Behboudi
|
|
|
|
|
ok i just checked,,
the library is written according to COM.
what should i do next?
Ehsan Behboudi
|
|
|
|
|
use
#import "myvbcode.dll"
during c++ compilation it would generate
myvbcode.tlh
myvbcode.tli
which are automatically included
then just select the functionality you need. If you need more help, publish generated .tli file here and example of how you would use it in VB.
|
|
|
|