473,397 Members | 2,099 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

I think there is someting wrong with this code!

I'm looking at a program I wrote long ago and I think there is much wrong -
even tho it works.
I know very little c and wish the learn.
Is BOOL correct with a dialog proc!
Are there returns that don't belong there?
Is it correct to sometimes return a BOOL and sometime an int?
int iReply;

iReply = DialogBox(hInstance, "DlgRetrieveSavedGame", hwndMain,
RetrieveSavedProc);

if ( iReply == IDYES )

....snip

BOOL CALLBACK RetrieveSavedProc( HWND hDlg, UINT uMessage, WPARAM wParam,
LPARAM lParam)

{

...snip

case WM_INITDIALOG:

....snip

return TRUE;

case IDCANCEL:

EndDialog( hDlg, IDCANCEL);

return TRUE;

default:

return FALSE;
Jan 27 '07 #1
1 975

" Frank" <fr***@a-znet.comwrote in message
news:eO**************@TK2MSFTNGP03.phx.gbl...
I'm looking at a program I wrote long ago and I think there is much
wrong - even tho it works.
I know very little c and wish the learn.
Is BOOL correct with a dialog proc!
Yes. I think the missing piece of your puzzle is DWL_MSGRESULT. See
http://msdn2.microsoft.com/en-us/library/ms645469.aspx
Are there returns that don't belong there?
No.
Is it correct to sometimes return a BOOL and sometime an int?
No.
>

int iReply;

iReply = DialogBox(hInstance, "DlgRetrieveSavedGame", hwndMain,
RetrieveSavedProc);
Ok, because DialogBox doesn't return the return value from the dialog
procedure, it returns the value passed to EndDialog.
>
if ( iReply == IDYES )

...snip

BOOL CALLBACK RetrieveSavedProc( HWND hDlg, UINT uMessage, WPARAM wParam,
LPARAM lParam)

{

..snip

case WM_INITDIALOG:

...snip

return TRUE;

case IDCANCEL:

EndDialog( hDlg, IDCANCEL);

return TRUE;

default:

return FALSE;


Feb 6 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Mette Kulmbach | last post by:
I'm a danish librarian who would like to get my new homesite validated. I have tried to get it validatet in the w3c but I get the same message all the time. This is the massage. " Below are...
40
by: Neo The One | last post by:
I think C# is forcing us to write more code by enforcing a rule that can be summarized as 'A local variable must be assgined *explicitly* before reading its value.' If you are interested in what...
0
by: raylopez99 | last post by:
I ran afoul of this Compiler error CS1612 recently, when trying to modify a Point, which I had made have a property. It's pointless to do this (initially it will compile, but you'll run into...
1
by: x9990860 | last post by:
Cross-thread operation not valid: Control 'Form1' accessed from a thread other than the thread it was created on. using System; using System.Collections.Generic; using System.ComponentModel;...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.