|
-
Jan 31st, 2002, 10:36 AM
#1
Thread Starter
Lively Member
Which is better to start with?
Which is bettor to start with? MFC or everything with API?
VisualPenguin
-
Jan 31st, 2002, 12:13 PM
#2
Fanatic Member
Digital-X-Treme
Contact me on MSN Messenger: [email protected]
[VBCODE]Debug.Print Round(((1097) - ((55 ^ 5 + 311 ^ 3 - 11 ^ 3) _
/ (68 ^ 5))) ^ (1 / 7), 13)[/VBCODE]
-
Feb 1st, 2002, 07:54 AM
#3
Definitely API, and everyone here will agree (well, almost everyone). You can later learn MFC too, if you really understand what's going on. You can make apps far quicker, but if you don't know it well you might get really lost. MFC is an advantage at a prize. (z or c?)
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Feb 1st, 2002, 12:22 PM
#4
Black Cat
I got flamed once on a non-programming forum for suggesting to someone who wanted to learn Windows programming that the API is better than MFC...
Josh
Get these: Mozilla Opera OpenBSD
I have books for sale: "MCSD in a Nutshell" and "VB Distributed Exam Cram" - PM me for details. Will also trade for a decent ATX Pentium 2 MB/CPU/RAM combo.
-
Feb 1st, 2002, 12:47 PM
#5
Monday Morning Lunatic
CB - price 
Josh - ack, everyone knows API is better *smirk* Silly fools
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Feb 1st, 2002, 06:36 PM
#6
transcendental analytic
API is functional and quite lowlevel, me and parksie decided to make an object oriented layer to it, but I'm too busy writing my own language right now the classes for the layer will then be compiled in BORK to a set of generic C++ classes that will be upwards compatible with BORK modules. By then you can choose to write your win32 application in C++ or BORK using the generated layer, and it will highly efficient compared to MFC
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Feb 2nd, 2002, 05:44 AM
#7
-
Feb 2nd, 2002, 10:01 AM
#8
Thread Starter
Lively Member
can anybody then give me a realy simple program? with just the basic needs like one dialog, so I can find out how to make it myself?
VisualPenguin
-
Feb 2nd, 2002, 10:41 AM
#9
Hyperactive Member
Visual C++
Code:
#include <windows.h>
LRESULT CALLBACK WindowFunc(HWND, UINT, WPARAM, LPARAM);
char szWinNamw[] = "MyWin";
int WINAPI WinMain(HINSTANCE hThisInst, HINSTANCE hPrevInst, LPSTR kposzArgs, int nWinMode)
{
HWND hwnd;
MSG msg;
WNDCLASSEX wcl;
wcl.cbSize = sizeof(WNDCLASSEX);
wcl.hInstance = hThisInst;
wcl.lpszClassName = "My Window";
wcl.lpfnWndProc = WindowFunc;
wcl.style = 0;
wcl.hIcon = LoadIcon(NULL, IDI_APPLICATION);
wcl.hIconSm = LoadIcon(NULL, IDI_WINLOGO);
wcl.hCursor = LoadCursor(NULL, IDC_ARROW);
wcl.lpszMenuName = NULL;
wcl.cbClsExtra = 0;
wcl.cbWndExtra = 0;
wcl.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH);
if(!RegisterClassEx(&wcl)) return 0;
hwnd = CreateWindow( "My Window",
"Skeleton Window",
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT,
CW_USEDEFAULT,
CW_USEDEFAULT,
CW_USEDEFAULT,
HWND_DESKTOP,
NULL,
hThisInst,
NULL );
ShowWindow(hwnd, nWinMode);
UpdateWindow(hwnd);
int i;
while(i = GetMessage(&msg, NULL, 0, 0))
{ if (i == -1) break;
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return msg.wParam; }
LRESULT CALLBACK WindowFunc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch(message)
{
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
return DefWindowProc(hwnd, message, wParam, lParam);
}
return 0;
}
-
Feb 2nd, 2002, 11:59 AM
#10
Why did you double space that? It makes it look twice as long =).
You should also be handling WM_PAINT:
Code:
LRESULT CALLBACK WindowFunc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch(message)
{
case WM_DESTROY:
PostQuitMessage(0);
break;
case WM_PAINT:
ValidateRect(hwnd, NULL);
break;
default:
return DefWindowProc(hwnd, message, wParam, lParam);
}
return 0;
}
Otherwise, the window will continue to get WM_PAINT messages.
Z.
-
Feb 3rd, 2002, 07:15 AM
#11
Monday Morning Lunatic
I thought DefWindowProc would handle that.
Glad to see that it's got the check for -1 in there
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Feb 3rd, 2002, 03:47 PM
#12
You dont have to ValidateRect, but you do have to return 0. GetMessage will leave WM_PAINT in the queue until there arent any more messages (i think that's what the docs said). I found this info under the GetMessage() docs, the WM_PAINT message docs and the "Designing a Window Procedure" topic, in the MSDN.
Z.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|