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 / I need a bit of C++ help dealing with Windowing, anyone care to help?

Author
Message
Zero Blitzt
20
Years of Service
User Offline
Joined: 18th Jan 2004
Location: Different Stages
Posted: 26th Sep 2004 22:44
OK, i'm trying to make a test app. So far, I've been able to make a window, but it flashes on the screen for a second then disappears. I am using the command for Show Window, but it still flashes for a split second. Any help with that?

Also, I am trying to make a dialog box pop and get user input to add to a file. I guess I should make a new window, then have a child window to that as an EDIT window? (The site i'm looking on is http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/WinUI/WindowsUserInterface/Windowing/Windows.asp ) How would I get the text that user placed in the EDIT box?


Sorry if my post is confusing, I feel really sick now... Code has been attached. Some of this stuff is new to me so... im sort of lost. But I guess practice draws you closer to perfection.


Come to #coding. We promise we wont kick you!
DISCLAIMER: Promises may not actually be upheld.
Neofish
20
Years of Service
User Offline
Joined: 7th Apr 2004
Location: A swimming pool of coke
Posted: 26th Sep 2004 22:56
im not sure, but doesnt the program end, so it closes the windows after they run? i have no experience in this btw

:: Pulse Board Forums :: Want Gmail? Email me ::
Zero Blitzt
20
Years of Service
User Offline
Joined: 18th Jan 2004
Location: Different Stages
Posted: 26th Sep 2004 23:02
But I wonder, hmm...

My window has the default Minimize, Maximize, and Close buttons. Would I need to set something so when the "X" button is clicked the program terminates? Or does it do this automatically?


Come to #coding. We promise we wont kick you!
DISCLAIMER: Promises may not actually be upheld.
Neofish
20
Years of Service
User Offline
Joined: 7th Apr 2004
Location: A swimming pool of coke
Posted: 26th Sep 2004 23:20
i saw something like this a while back, or at least i think i did, running it in DOS worked or somethig like that, because windows close finished apps while DOS does not, try that....

:: Pulse Board Forums :: Want Gmail? Email me ::
OSX Using Happy Dude
21
Years of Service
User Offline
Joined: 21st Aug 2003
Location: At home
Posted: 26th Sep 2004 23:23
You dont have the main processing loop - no wonder the window only stays up for a split second.


Come to the UK Convention on the 23rd & 24th of October
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 26th Sep 2004 23:24
What do you expect to happen when the program ends?

Your example is exactly like having a program 'MAKE OBJECT CUBE 1, 1' and wondering why DBPro just flashes up and disappears.

Start with this : http://www.flipcode.com/tutorials/tut_windows01.shtmlp

*** Coming soon - Network Plug-in - Check my site for info ***
For free Plug-ins, source and the Interface library for Visual C++ 6, .NET and now for Dev-C++ http://www.matrix1.demon.co.uk
Three Score
20
Years of Service
User Offline
Joined: 18th Jun 2004
Location: behind you
Posted: 26th Sep 2004 23:25
i don't know enough about c++ to give code but you must make a main loop that redraws/makes the window or that willl happen

http://free-space.myftp.org for free ftp
website hosting and e-mail 60mb for ftp/webste 70mb for e-mail
Dave J
Retired Moderator
21
Years of Service
User Offline
Joined: 11th Feb 2003
Location: Secret Military Pub, Down Under
Posted: 26th Sep 2004 23:25
Lol, where's the WndProc?


"Computers are useless they can only give you answers."
Zero Blitzt
20
Years of Service
User Offline
Joined: 18th Jan 2004
Location: Different Stages
Posted: 26th Sep 2004 23:58
I feel extremely stupid

Thank you for your help, and thanks for the link IanM.

Quote: " Lol, where's the WndProc?"

Err... don't exactly know what you mean. I just used a source code example on MSDN, so anything it did, I did.


Come to #coding. We promise we wont kick you!
DISCLAIMER: Promises may not actually be upheld.
Dave J
Retired Moderator
21
Years of Service
User Offline
Joined: 11th Feb 2003
Location: Secret Military Pub, Down Under
Posted: 27th Sep 2004 00:05
Don't worry, I'm just pushing you ahead too far lol. Basically the WndProc() function is used to check messages and do things based on them, essentially your window won't react to input until you create that funciton. But like I said, don't worry about it until you get up to it.


"Computers are useless they can only give you answers."
Zero Blitzt
20
Years of Service
User Offline
Joined: 18th Jan 2004
Location: Different Stages
Posted: 27th Sep 2004 01:11
Can anyone see a problem with this Winsock code (I'm making a server). It says wsaData hasn't cannot be switched from and unsigned int to a signed int. I followed the instructions from MSDN, so I don't know whats wrong....

NOTE: This is only an excerpt from my entire Server CPP file. Theres a lot more to it than what I am showing here


Come to #coding. We promise we wont kick you!
DISCLAIMER: Promises may not actually be upheld.
OSX Using Happy Dude
21
Years of Service
User Offline
Joined: 21st Aug 2003
Location: At home
Posted: 27th Sep 2004 02:20 Edited at: 27th Sep 2004 02:22
Have you tried :

erpt = WSAStartup(sockversion, (WSADATA *) &wsaData);


Come to the UK Convention on the 23rd & 24th of October
Zero Blitzt
20
Years of Service
User Offline
Joined: 18th Jan 2004
Location: Different Stages
Posted: 27th Sep 2004 02:52 Edited at: 27th Sep 2004 02:54
Just did, here are the errors I'm getting when I try that code:




EDIT: OK, I toyed around with it, now my code is:
erpt = WSAStartup(sockversion, ( *WSADATA ) &wsaData);

and I'm only getting one error, which is:
server.cpp: In function `int WinMain(HINSTANCE__*, HINSTANCE__*, CHAR*, int)':
server.cpp:18: error: syntax error before `)' token


Come to #coding. We promise we wont kick you!
DISCLAIMER: Promises may not actually be upheld.

Login to post a reply

Server time is: 2024-09-22 16:23:06
Your offset time is: 2024-09-22 16:23:06