|
Oh,Before I go and sleep I found good example for you.You can find exactly what you want here:
http://www.njnet.edu.cn/info/ebook/c++/vc524h/ch23/ch23.htm
Mazy
You can find a solution (even a foolish one) for all problems (even big ones)
|
|
|
|
|
Thank you
Marjorie
|
|
|
|
|
MDI-Multiple Document Interface
Paint Sho pro
Visual C++
SDI-Single Document Interface
Internet explorer
Notepad
Paint
I don't think this terminology is MFC specific, i'd think it would be more like WOSA(Windows operating system architecture).
cheers
"An expert is someone who has made all the mistakes in thier field" - Niels Bohr
|
|
|
|
|
I run a program with flex grid on my machine and it works great.
I run it on another machine and it tanks. I added the file
msflxgrd.ocx to c:\windows\system and then the program works
on the other computer.
I am alittle worried because this is the first time I have used
activeX in my program. Is there anything else I need to do
to make flex grid work on different machines or putting that
file in that directory is it? I am just worried.
Please, please, any response, any one can give me will
be greatly appreciated.
Sincerely,
Danielle (an overworked graduate student)
|
|
|
|
|
You have to register the ActiveX on the computer you want to use it.
do this:
on the start menu run the command line and run this:
regsvr32 xxx\xxx\xx.ocx --->path of your ocx
Mazy
You can find a solution (even a foolish one) for all problems (even big ones)
|
|
|
|
|
You can also use installshield and then distribute your project;)
Mazy
You can find a solution (even a foolish one) for all problems (even big ones)
|
|
|
|
|
Hi Guys,
i am using the following code to calculate the Calendar Week, using Month Calendar Control (m_cal1).
in the heade file...
COleDateTime ActualWeek1;
COleDateTimeSpan Weekdiff1;
in the function OnSelchangeMonthcalendar1....
SYSTEMTIME sysTime;
m_cal1.GetCurSel(&sysTime);
ActualWeek1.SetDate(sysTime.wYear, sysTime.wMonth, sysTime.wDay);
COleDateTime ActualTempWeek1( sysTime.wYear, sysTime.wMonth, 0, 0, 0, 0 );
Weekdiff1 = ActualWeek1 - ActualTempWeek1;
week1 = Weekdiff1.GetDays()/7+1;
CString week;
week.Format("%d",week1);
AfxmessageBox(week);
If i use this code in my function OnSelchangeMonthcalendar1 and select a date, it always starts the week from wednesday and according to this it displays the wrong week.
So how can i get the correct calendar week ??
Best Regards
Sonu
|
|
|
|
|
COleDateTime curDate = COleDateTime::GetCurrentTime();
int weekDay = curDate.GetDayOfWeek();
|
|
|
|
|
Hello:
I want to define a point that points to a member function of the class, like the following:
class a
{
void func();
}
int foo()
{
void (*pFunc)();
a ao;
pFunc = ao.func;
return 0;
}
But the complier told me that "error C2440: '=' : cannot convert from 'void (__thiscall a::*)(void)' to 'void (__cdecl *)(void)'
There is no context in which this conversion is possible"
Thank you for your help!
I'm amumu, and you?
|
|
|
|
|
class a { void func() {} };
int foo()
{
void (a::*pFunc)();
a ao;
pFunc = a::func;
ao.*pFunc();
}
--Mike--
"Everyone has figured out what 'service pack' really means, so they had to go and change the language. Perhaps this is what Bill was talking about in the 'security is top priority' letter."
-- Daniel Ferguson, 1/31/2002
My really out-of-date homepage
Sonork - 100.10414 AcidHelm
Big fan of Alyson Hannigan.
|
|
|
|
|
I have tried, but the VC++ report:
ao.*pFunc(); //error C2064: term does not evaluate to a function
Thank you for your help!
I'm amumu, and you?
|
|
|
|
|
Hi,
I have solved the problem, thanks for your help!
I'm amumu, and you?
|
|
|
|
|
hello..
i have a problem with my program... i don't know how to call C function from C++ coding..
i already try use extern C, but it make my program illegal operation... how??
any one can help me!!?!?!? i hope someone can help me..
tq
|
|
|
|
|
Just save your source file as .c instead of .cpp and it should work
'
-AJ
|
|
|
|
|
I know that most y'all here are MFC programmers, but I have a Win32 API problem that I can't find the solution to anywhere else and I was hoping I could find it here. I'm getting the most frustrating error when compiling my program on a certain line of code. The line of code is:
DialogBox(hInstance, ABOUTDIALOG, hwnd, (DLGPROC) DlgProc);
I've also tried MAKEINTRESOURCE for the second parameter with no success.
The error is.:
Warning: c:\graphx2\graphx.c: 140 assignment of pointer to const unsigned short to pointer to char
I'm stumped and I'd appreciate any help.
Thanks,
AJ
|
|
|
|
|
case IDM_ABOUT:
DialogBox(hInst, <code>(LPCTSTR)</code>IDD_ABOUTBOX, hWnd, (DLGPROC)About);
break;
Stole this from a generic Win32 App created by the wizard... if I leave out the string cast, I get the error you do.
Downright non-intuitive, I'd say...
|
|
|
|
|
didn't work, thanks though. Any more suggesstions?
|
|
|
|
|
Facinating...
Well, I changed the extensions on the wizard generic sample to .c, thinking we might be working with different languages. Still works. As expected, the parameter checking now becomes just a warning - do you have 'treat warnings as errors' checked?
This code:
case IDM_ABOUT:
DialogBox(hInst, (LPCTSTR)IDD_ABOUTBOX, hWnd, (DLGPROC)About);
break;
case IDM_EXIT:
DestroyWindow(hWnd);
break;
case ID_FILE_TEST:
DialogBox(hInst, IDD_ABOUTBOX, hWnd, (DLGPROC)About);
break;
Generates a warning for the line in the test menu item, but still compiles and works.
d:\work\nomfc\nomfc.c(158) : warning C4047: 'function' : 'const char *' differs in levels of indirection from 'const int '
d:\work\nomfc\nomfc.c(158) : warning C4024: 'DialogBoxParamA' : different types for formal and actual parameter 2
BTW, I guess I wasn't getting the same warnings / errors either here or in the previous test...
What strange configuration do you have? VC 2.0? Service pack -1?
|
|
|
|
|
Actually I'm not using VC, I'm using lcc-win32. I just post here cause I've used VC b4 and it looks pretty much the same and code that I wrote for VC worked in LCC so I figured I could post here without trouble. I guess there's a slight difference that's causing the error. I'm getting VC soon, though, so don't worry about it. Thanks though.
-AJ
|
|
|
|
|
Hi.
I posted a topic regarding GUI programming using C++ a week ago. I was wonder about the best tool to learn GUI programming using C++. Most members said MFC is the best tool to for GUI programming in Windows because of it is from Microsoft. However, many members said Qt is a much easier, and ultimately, more practically GUI tool in windows.
I bought a MFC book by Jess Prosise and I read the first chapter. I want to said MFC is challenging. First, I like the idea of having inherance and virtual functions and classes to control every specefic GUI feature. However, I am overwhelmed with the number of MFC classes and derived classes. There are too many classes to remember! There is not no way to really know the classes, their member functions, and the parameters for member functions.
I thought it over and decided to try Qt. From its interface, Qt look much easier than MFC because the GUI items are manageable via drag-drop. The negative side I Qt is *expensive*. It is too expensive (~$2k). Secondly, I do not think the free version Qt 2.3 is not Visual C++ .NET compatible.
Now I am basically left with MFC. Yes, it is intimidating me right now. I do not have problems with OOP. I am very comfortable with STL and enjoy using it to improve whatever I work on. MFC is different. Prosise present MFC as though I have to know everything about it as well as how Windows programs work. MFC is challenging to learn and implement at first.
Does it get easier and *faster*?
I am seriously considering using Borland C++ Builder. It has the RAD feature and I believe the GUI programming is similar to Qt. At least they look similar (drag-drop).
Kuphryn
|
|
|
|
|
Yes, it does get easier and faster.
There are many classes in MFC which you will use regularly, but far more you will not use often.
AppWizard and ClassWizard generate a lot of the code to get you started and ClassWizard is very useful when creating message maps and member variables bound to form controls. After a couple of weeks of playing with some sample code here and developing some simple apps, I think it will clear up for you.
I learned to use MFC before using STL and the win32 api. I had a crash course (develop an app or find other work) and was able to learn MFC and win32 api in 3 months. I did not learn it all, I just designed the app and then implemented it. At each step of the way I researched the proper way to implement it in MFC. Looking back on that first project (5+ years ago) it is not that pretty, but it is still in use by a well over 1000 users.
As far as RAD tools goes, there is a product from Capitol Solf (http://www.capitolsoft.com/) that can help here. I beleive it is not very expensive < $200 US. I do not use it, but some people I know do use it and like it very much.
Also, WndTabs (http://www.wndtabs.com) and Visual Assist can accelerate development (http://www.wholetomato.com/) also. WndTabs is free and Visual Assist is < $100 US.
Just my 2 cents.
Matt Gullett
|
|
|
|
|
kuphryn wrote:
Does it get easier and *faster*?
It's just like learning any difficult subject. Bury your nose in it until you understand it. After awhile, it will seem like second nature.
Jon Sagara
What about ?
|
|
|
|
|
It took me about 2 months to understand MFC well enough to use it effectively. By effectively I mean, it certianly helps having online reference and those popup tooltips. When you really get into a bind and you can't find anything like it, codeproject is just perfect.
If you know the WIN32 API, MFC is a snap!
"An expert is someone who has made all the mistakes in thier field" - Niels Bohr
|
|
|
|
|
Ask yourself, what do you hope to accomplish? If you are collaborating with others on a project, what you use will be restricted by what the others you work with can and do use. If you are working solo, you will have many more options. MFC is useful, in that it provides a (somewhat) consistant framework, and Visual Studio provides many wizards to help you... but this is most useful when the application you are writing falls into one of the categories Microsoft wrote MFC to be used for. If you need to throw something together in a hurry, C++ Builder, or even VB can be a better choice.
It does get easier, and somewhat faster. I've been using MFC for almost two years now, with no prior Windows programming experience, and still learning constantly. In hindsite, MFC would have been a lot easier to learn if i had been comfortable with the Win32 API prior to learning it; however, if i had been comfortable with the Win32 API, i prolly wouldn't have bothered. One of MFC's biggest advantages is that it often hides the ugly and inconsistent API; but this is also its biggest problem. Some of the hacks used to mask the differences between Windows and MFC are not exactly clear to beginners. The rest of MFC: database stuff, serialization, debugging, etc... can usually be done without. If you already use STL, you won't need to use the CMap, CArray, etc. classes for instance.
Wow, this is getting long... sorry . I guess my best advice would be, make sure you really need to use MFC before you jump in and start learning it. If you don't learn it now, but need to use it at some point in the future, it won't be hard to pick up. Just treat it like a geriatric family member: full of information, but much of it out-dated, incorrect, or forgotten. Respect it, but beware of senility.
farewell goodnight last one out turn out the lights Smashing Pumpkins, Tales of a Scorched Earth
|
|
|
|
|
Have you thought of learning WTL. It is fairly simple, very light-weight, and there are wrapper classes for just about every control in WIN32.
While it is not supported by Microsoft, it is free, and there is a very large development community that does support it.
|
|
|
|
|