• Create Account

## help this pitiful soul

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

19 replies to this topic

### #1Moe  Members

1255
Like
Likes
Like

Posted 10 February 2000 - 04:29 PM

i as a beginner programmer, i have just been getting into windows 98 programming. i am using borland C++ 5 (or so). i tried to write a simple program that displays a window (with no menus, or anything). i copied the code right out of the book, but i get 7 error messages. it seems to me that borland c++ won''t recognize the windows 98 functions. does bc++ only work with win 95? -Moe- (someone said that there should be more rhymes in posts so i will give it a try) complain, complain, thats all i get its a problem, i will bet, can borland do it? did i blew it? oh help this soul so it can rest from this problem the dang pest just let me do it cuz i know i can do it and if i cant there''ll be no show

### #2Eck  Members

7401
Like
Likes
Like

Posted 13 February 2000 - 06:14 AM

I would be glad to help you, but you have not told me what is wrong. When you post to a board and say, my code does not work, it is not very helpful. Post the error messages you got, also the book you are copying code from would be helpful.
Later,
Eck

### #3joeG  Members

172
Like
Likes
Like

Posted 14 February 2000 - 02:14 PM

I bet you it''s because you chose the wrong project from the New.. menu. It should be "Win 32 Console" .

JoeG

### #4Moe  Members

1255
Like
Likes
Like

Posted 14 February 2000 - 03:57 PM

Okay here is the problem (sorry for not posting it before)

I am trying to get a win98 skeleton program to work. When I try to compile i get the following errors:

Type name expected
Undefined symbol WindowFunc
wrong number of arguments in call of macro CreateAWindow
expression syntax
Undefined symbol nWinMode
type name expected

Now here is the code i copied from the book:

//a minimal win98 skeleton

#include

LRESULT CALLBACK WIndowFunc(HWND, UNIT, WPARAM, LPARAM);

char szWinName[] = "MyWin"; //name of windows class

int WINAPI WinMain(HINSTANCE hThisInst, HINSTANCE hPrevInst, LPSTR lpszArgs, int nWimMode)
{
HWND hwnd;
MSG msg;
WNDCLASSEX wcl;

//define a window class
wcl.hInstance = hThisInst; //handle to this instance
wcl.lpszClassName = szWinName; //window class name
wcl.lpfnWndProc = WindowFunc; //windows function
wcl.style = 0; //default style

wcl.hIcon = LoadIcon (NULL, IDI_APPLICATION); //standard icon
wcl.hIconSm = LoadIcon (NULL, IDI_WINLOGO); //small icon
wcl.hCursor = LoadCursor (NULL, IDC_ARROW); // cursor style

wcl.cbClsExtra = 0; //no extra info needed
wcl.cbWndExtra = 0; //no extra info needed

//make the background brush white
wcl.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH);

//register the window class
if (!RegisterClassEx(&wcl)) return 0;

//now that a window class has been registered, a window can be created.
hwnd = CreateWindow(
szWinName, //name of window class
"Windows 98 Skeleton", //title
WS_OVERLAPPEDWINDOW, //window style normal
CW_USERDEFAULT, //x coord - let windows decide
CW_USERDEFAULT, //y coord - let windows decide
CW_USERDEFAULT, //width - let windows decide
CW_USERDEFAULT, //hight - let windows decide
HWND_DESKTOP //no parent window
hThisInst, //handle of this instance of the program
);

//display the window

ShowWindow(hwnd, nWinMode);
UpdateWindow (hwnd);

//create the message loop
while (GetMessage(&msg, NULL, 0, 0))
{
TranslateMessage(&msg); //translate keyboard messages
DispatchMessage(&msg); //return control to windows 98
}
return msg.wParam;
}

//this function is called by windows 98 and is passed messages from the message queue
LRESULT CALLBACK WindowFunc(HWND hwnd, UNIT message, WPARAM wParam, LPARAM lParam)
{
switch (message) {
case WM_DESTROY: //terminate the program
PostQuitMessage(0);
break;
default:
//let windows 98 process any messages not specified in the proceeding
//switch statement
return DefWindowProc(hwnd, message, wParam, lParam);
}
return 0;
}

Any ideas that could be causing those errors?
(i dont think it is from selecting console (i am sure that i hit GUI)

### #5Fnjord  Members

122
Like
Likes
Like

Posted 14 February 2000 - 04:04 PM

well I''m not sure if this is a large part of your problem but this bit:
LRESULT CALLBACK WIndowFunc(HWND, UNIT, WPARAM, LPARAM);
the I in WIndow is capitalized, and I don''t think you want it to be. (maybe that''s just a typo the the message board)

### #6DerekSaw  Members

243
Like
Likes
Like

Posted 14 February 2000 - 04:52 PM

I had this problem b4. Try
#define WIN32
or
#define _WIN32
or something like this before including windows.h

Happy trying.

### #7PetrFire  Members

122
Like
Likes
Like

Posted 14 February 2000 - 05:17 PM

Is it just me, or is there nothing following the #include statement... I might have missed something or looked at it wrong, no time now for reading posts...

--the Rabid_Stick

P.S. does anyone know the Magic Knight Rayearth theme song? if so, how did you get it out of your head?

### #8Gromit  Members

144
Like
Likes
Like

Posted 14 February 2000 - 05:48 PM

you have to use the code tag for displaying your, well, code.

### #9Colin Barry  Members

122
Like
Likes
Like

Posted 15 February 2000 - 12:19 AM

There should be a comma after HWND_DESKTOP and before the NULL in the CreateWindow function call.

### #10Gav  Members

124
Like
Likes
Like

Posted 15 February 2000 - 12:41 AM

You''ve also spelt nWinMode wrong in the declaration of WinMain

No sense being pessimistic. It wouldn''t work anyway.

### #11Moe  Members

1255
Like
Likes
Like

Posted 15 February 2000 - 03:28 AM

I found the place where i spelled nWinName wrong. Is it just me or is windows programming a big pain in the butt?

### #12fuzzyai  Members

122
Like
Likes
Like

Posted 18 February 2000 - 07:17 AM

no Moe, it isn''t just you.. windows programming is a pain in the.. uhh, butt...
i''m a bit new to it myself, though i''m starting to get a handle on it.. (i''ve found Tricks of the Windows Game Programming Gurus very useful) i use VC++ 6, though, and i''m not sure how much is compiler specific, so i don''t know if i can help..
as a suggestion, if you could include which line each error was referenced too, it''d make it alot easier to find the problem.
just know that you''re not alone. dos/unix programming is so nice and pure. windows is the spawn of satan. but DirectX is so sexy...

### #13fuzzyai  Members

122
Like
Likes
Like

Posted 18 February 2000 - 07:20 AM

by the way, Moe, the Game Design Corner probably wasn''t the best place to post this. you''d probably get more responses (and help) is you posted it somewhere in the technical/programming section, or the lounge.

### #14 joew   Members

4335
Like
Likes
Like

Posted 18 February 2000 - 10:03 AM

You need something after your #include :-)

### #15fuzzyai  Members

122
Like
Likes
Like

Posted 20 February 2000 - 06:36 AM

Saruman, i''m sure there was something after the #include.. i think the message board supports HTML tags, so anything contained in less than and greater than will be interpretted as a tag, and therefore ignored if the browser doesn''t recognize it.. someone previously mentions the code tag..
an example:
(without the code tag)
#include
(with the code tag
#include

### #16fuzzyai  Members

122
Like
Likes
Like

Posted 20 February 2000 - 06:37 AM

oh.. interesting..

### #17Moe  Members

1255
Like
Likes
Like

Posted 21 February 2000 - 09:45 AM

i suppose i should use code tag next time, and i will be sure to post it somewhere like graphics theory, or something.

there was a windows.h after the #include

- Moe -

### #18dog135  Members

122
Like
Likes
Like

Posted 22 February 2000 - 12:17 PM

I still couldn''t see what you included. I''m using IE5, maybe it''s just stupid that way.

How about the "pre" tag? I''ll try it...

#include

could you see that?

E:cb woof!

### #19dog135  Members

122
Like
Likes
Like

Posted 22 February 2000 - 12:18 PM

Ack! I still didn''t see it.

E:cb woof!

### #20Moe  Members

1255
Like
Likes
Like

Posted 22 February 2000 - 12:36 PM

it seems to work fine with IE4. maybe there is some glitch in IE5. who knows...

i thought this post would have been long dead by now...

- Moe -

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.