|
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.
|
|
|
|
|
Thanks for the inspirational comments.
I will definitely stick with MFC. I find it challenging, but one can easily master MFC with a lot of intensive reading, GUI design and MFC implementation. I will approach it that way.
I like MFC because it is from Microsoft. If I am going to design programming for Microsoft windows using C++, I might as well master a tool that is designed by the developers behind the OS for the OS.
Kuphryn
|
|
|
|
|
Thanks everyone.
I hear two sides including MFC is bloated and MFC is powerful once the developer learns its working. Both sounds valid.
One thing I see is MFC developers like MFC, while developers that user other GUI tools and/or are in the process of learning MFC seem criticize it. Both situations are understandable.
As I this topic reads, I find MFC challenging mainly because there are many specific "tweaks," which are difficult for a beginner to learn, design around, and implement.
As I said before, I will definitely go through this process and learn MFC. I will give all I got into Prosise book. My goal is to first finish reading the book. My goal is to gain as much insight as I possibly can throughout the process. It will take some time, but very doable.
Are there some tips you have for gaining the most insights as possible during the process of learning MFC? I learning C++ quick. I can certainly apply the same technique I used throughout the process of learning C++.
Thanks,
Kuphryn
|
|
|
|
|
Hi all,
How can i create a SQL Query in Access Database (.mdb), by CDaoDatabase::Execute ????
Help me
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
Using CREATE PROCEDURE SQL command I guess. Look for description on it in your MS Access help
Philip Patrick
"Two beer or not two beer?" (Shakesbeer)
Web-site: www.saintopatrick.com
|
|
|
|
|
Hi again,
Thank you for introducing CREATE PROCEDURE statment to me ...
I read MS-ACCESS help, too.
But i have problem in using of this statment,
I wanna tell you my problem:
I have OPERATION table with below fields:
PID1(long) - PID2(long) - OP(boolean)
I wanna query in access database with below query:
SELECT PID1, OP, PID2 FROM OPERATION
UNION ALL
SELECT PID2, NOT OP, PID1 FROM OPERATION
I wrote below code but doesn't work:
MyDB.Execute( "CREATE PROCEDURE TempQuery [NUMBER1] LONG, [OP] LOGICAL, [NUMBER2] LONG AS SELECT PID1, OP, PID2 FROM OPERATION UNION ALL SELECT PID2, NOT OP, PID1 FROM OPERATION" );
I wrote it too but doesn't work:
MyDB.Execute( "CREATE PROCEDURE TempQuery AS SELECT PID1, OP, PID2 FROM OPERATION UNION ALL SELECT PID2, NOT OP, PID1 FROM OPERATION" );
What is my wrong ???
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
Bah... did you tried to run your query in Access? Not in code? I just tried and see that Access don't know what is that CREATE PROCEDURE, it want to get only CREATE TABLE statements
I used Access 2000 for test
Philip Patrick
"Two beer or not two beer?" (Shakesbeer)
Web-site: www.saintopatrick.com
|
|
|
|
|
Thanks for your helps !
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
Hi.
I would like to know how to concatenate characters into a string that is an element of a vector.
For example:
string dataTemp("today");
std::vector<string> vecTemp;
vecTemp.push_back(dataTemp);
// I want to add characters into the tring element of vecTemp
vecTemp[0] += " is Saturday." // Is that right?
I would like vecTemp[0] to be "today is Saturday."
Thanks,
Kuphryn
|
|
|
|
|
Hi.
Let say there are two vectors, vectorA and vectorB.
-----------------------------------------------------
string dataTemp;
std::vector<string> vectorA, vectorB;
for (int = 0; i < 10; ++i)
{
dataTemp += i;
vectorA.push_back(dataTemp);
}
/* The loop above should produce vectorA to look something like this:
0
1
12
123
1234
12345
123456
1234566
12345678
123456789
*/
Okay, vectorB is empty.
I want to copy *specific* elements from vectorA to vectorB.
For example:
vectorB.push_back(vectorA[4]); // Is that right?
vecotrB.push_back(vectorA[8]);
Thanks,
Kuphryn
|
|
|
|
|
I need to Check the first char of a string
to see if it is A, B, or C
are there any methods
to do that?
thank you
|
|
|
|
|
Let say you have this:
string temp("February");
if (toupper(&temp[0]) == "A")
...
Try that first because I have not tested it.
Kuphryn
|
|
|
|
|