|
-
December 20th, 2004, 06:19 AM
#8
Re: Newbe question
Well, I’m officially a hopeless n00b. I read your text and it made sense, but I didn’t have time to actually test it. Now I got the time and I just cant get it to compile no matter what I try. Maybe its just cause of my stupid programming style…Anyway here’s the last compiling source (that consists only of GUI)
Code:
#include <windows.h>
#include <stdio.h>
#include "handles.h"
LPCTSTR lpszApplicationName = "Keyboard!";
LPCTSTR lpszTitle = "Keyboard!";
LRESULT CALLBACK fnMessageProcessor (HWND, UINT, WPARAM, LPARAM);
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPSTR lpCmdLine, int nCmdShow)
{
MSG msg;
HWND hWnd;
WNDCLASSEX wndclass;
wndclass.cbSize = sizeof(wndclass);
wndclass.style = CS_HREDRAW ;
wndclass.lpfnWndProc = fnMessageProcessor;
wndclass.cbClsExtra = 0;
wndclass.cbWndExtra = 0;
wndclass.hInstance =hInstance;
wndclass.hIcon = LoadIcon( NULL, IDI_APPLICATION );
wndclass.hCursor = LoadCursor( NULL, IDC_ARROW );
wndclass.hbrBackground = (HBRUSH)(COLOR_WINDOW);
wndclass.lpszMenuName = NULL;
wndclass.lpszClassName = lpszApplicationName;
wndclass.hIconSm = LoadIcon( NULL, IDI_APPLICATION );
if( RegisterClassEx( &wndclass ) == 0 ) {
exit(1);
}
hWnd = CreateWindow( lpszApplicationName, lpszTitle,
WS_OVERLAPPEDWINDOW,
100, 100, 400,
340, NULL,
NULL,
hInstance,
NULL );
hBU_Small_a= CreateWindow("edit","",
WS_CHILD | WS_VISIBLE | ES_AUTOHSCROLL |
ES_AUTOVSCROLL | ES_LEFT | ES_MULTILINE | ES_NOHIDESEL |
WS_VSCROLL | WS_HSCROLL | WS_BORDER | ES_WANTRETURN,
25,
80,
342,
200,
hWnd,
(HMENU)hBU_Small_a,
hInstance,
NULL);
hBU_Small_a= CreateWindow("button","a",
WS_CHILD | SS_CENTER | WS_VISIBLE,
10,
5,
25,
20,
hWnd,
(HMENU)hBU_Small_a,
hInstance,
NULL);
hBU_Big_A= CreateWindow("button","A",
WS_CHILD | SS_CENTER | WS_VISIBLE,
35,
5,
25,
20,
hWnd,
(HMENU)hBU_Big_A,
hInstance,
NULL);
hBU_Small_b= CreateWindow("button","b",
WS_CHILD | SS_CENTER | WS_VISIBLE,
63,
5,
25,
20,
hWnd,
(HMENU)hBU_Small_b,
hInstance,
NULL);
ShowWindow(hWnd, nCmdShow);
UpdateWindow(hWnd);
while ( TRUE ) {
if (PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE)) {
if(!GetMessage(&msg, NULL, 0, 0))
break;
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
return(msg.wParam);
}
LRESULT CALLBACK fnMessageProcessor ( HWND hWnd, UINT iMsg, WPARAM wParam,
LPARAM lParam )
{
switch(iMsg) {
case WM_COMMAND:
break;
case WM_CREATE:
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
return(DefWindowProc(hWnd, iMsg, wParam, lParam));
}
return (0L);
}
Well, that was the last place I saw message "0 errors, 0 warnings". When I tried to add the LRESULT WINAPI DlgProc function after fnMessageProcessotr (Well, that might have been the mistake, but I don’t know much more about that than I know about location of Bil Laden) I got error: "error C2601: 'DlgProc' : local function definitions are illegal"
I’m very thankful, that you took your time to help a beginner, but looks like beginner turned out to be just anther dumbuser…I would be as thankful, if anyone would explain me how to actually use it…
http://www.kylm.com Game development community, show your skill or learn programming, something for everyone!
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
|