Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Geek Culture / Help with Windows programming

Author
Message
Shady 2005 Simpson
21
Years of Service
User Offline
Joined: 26th Aug 2003
Location: Newcastle, England
Posted: 7th Oct 2003 00:23
Hi,
I'm learning Windows Programming with C++ and in the book I've got, one of the examples doesn't work. I was wondering if any experienced Windows/C++ programmer could tell me why not?

Thanx.

P.S. I e-mailed the publishers but no reply.
Kentaree
22
Years of Service
User Offline
Joined: 5th Oct 2002
Location: Clonmel, Ireland
Posted: 7th Oct 2003 01:01
First of all, did you include <windows.h> at the top of your program? If so, check if your compiler needs any special parameters, like Borland command line tools needs -W (I think)

I would be unstoppable if I could just get started...
Shadow Robert
22
Years of Service
User Offline
Joined: 22nd Sep 2002
Location: Hertfordshire, England
Posted: 7th Oct 2003 02:17
well there are far simpler interfaces that the WinAPI and the MFC interfaces ... GTK and WxWindows are very good examples
if you could show the example it might help to determine why it doesn't work.

Mattman
21
Years of Service
User Offline
Joined: 5th Jun 2003
Location: East Lansing
Posted: 7th Oct 2003 05:22
I see you got the book I got

Is it the first one? (Hello World)

Got a knack for finding secrets??? Jingot Racing --- A new brand of Racing --- Only from Nightwatch Studios
"hey, it's tomorrow" --- Hamish
Preston C
21
Years of Service
User Offline
Joined: 16th May 2003
Location: Penn State University Park
Posted: 7th Oct 2003 14:26
Maybe you should have gotten Ivor Horton's Beginning Visual C++ 6 book. It shows quite a bit actually, comes with a demo for Microsoft Visual C++ (anything it compiles can only be run inside of itself, not from Windows Explorer or anything, which means no sharing your programs )


Dark Basic Pro has arived! I can feel the power!
Shady 2005 Simpson
21
Years of Service
User Offline
Joined: 26th Aug 2003
Location: Newcastle, England
Posted: 8th Oct 2003 21:05
DOH!!!

I meant to post the code on my first post, anywayz the code's below.

Quote: "I see you got the book I got

Is it the first one? (Hello World)"


no, I got Nitty Gritty Windows Programming with C++.

Thanx for your help.
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 8th Oct 2003 22:06
Not a lot wrong there - just some casts missing (lines 65 and 66) and an extra argument provided to the LineTo function (line 68).

The fixed and working WndProc function is in the code button
Shady 2005 Simpson
21
Years of Service
User Offline
Joined: 26th Aug 2003
Location: Newcastle, England
Posted: 8th Oct 2003 22:16
uh-oh,

I tried replacing my old source with your code and I get a load of new errors:



I'm using Dev-C++ btw
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 8th Oct 2003 22:26
You also need to link with the 'gdi32' library ... hold on and I'll be back to tell you how to do it.
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 8th Oct 2003 22:30
Hmmm. It works Ok for me ...

Did you create a new 'Windows Application' project for the code? If not then that's what you need to do
Shady 2005 Simpson
21
Years of Service
User Offline
Joined: 26th Aug 2003
Location: Newcastle, England
Posted: 8th Oct 2003 23:09
woohoo

Thanks Ian, finally it works!

Login to post a reply

Server time is: 2024-11-24 00:59:10
Your offset time is: 2024-11-24 00:59:10