June 25, 2024, 06:50:52 PM

News:

IonicWind Snippit Manager 2.xx Released!  Install it on a memory stick and take it with you!  With or without IWBasic!


Compiler warnings

Started by Jim Scott, September 11, 2013, 02:02:48 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Jim Scott

In compiling my program I get a bunch of warnings having to do with creating and opening dialogs and windows.  The code compiles and runs fine though.

Begin pasted compiler warnings:

File: E:\Check-In Package iwb\Check-In Package Program.iwb (1678) Warning: Argument 9 (dAbout_handler) does not match the declaration of IWBDLGPROC
Different return type: none, should be int
File: C:\Program Files (x86)\iwbdev\bin\iwbstd.incc (9) Warning: See previous declaration of IWBDLGPROC

End pasted compiler warnings:

Line 1678 is the following;
CREATEDIALOG dAbout,0,0,wDialog,hDialog,Options,win,"About Jim's Check-In Package Program",&dAbout_handler

The compiler is saying &dAbout_handler should be type Integer.  Isn't it an address created at run time?  Do I just ignore these messages?


Jim Scott

billhsln

&dAbout_handler should be a subroutine that is used to handle the messages from the Dialog.

Sub dAbout_handler(),int
SELECT @MESSAGE
   CASE @IDCHAR
      MESSAGEBOX d1,CHR$(@CODE) + " Key Pressed","Info"
   CASE @IDINITDIALOG
      CENTERWINDOW d1
   CASE @IDCLOSEWINDOW
   CASE& @IDDESTROY
      SetWindowLongA(hLV,GWL_WNDPROC,origfp)
      CLOSEDIALOG d1,@IDOK
      run1 = 0
ENDSELECT
RETURN 0
ENDSUB
When all else fails, get a bigger hammer.

LarryMc

Bill is correct
prior to ver 2.0 of IWbasic you could write a message handler like this
Sub dAbout_handler()
message handlers were treated as a special case in the compiler and the missing ",INT" was handled internally by the compiler.
When the compiler code was optimized in version 2.0 the compiler treats message handlers like any other subroutine.
So the proper way to to define the handler is
Sub dAbout_handler(),intbut to keep from totally breaking all old code it generates a warning instead of an error.
The compiler is still adding the ",int" internally but it is letting you know the code isn't optimized with the warning.
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

Jim Scott

September 11, 2013, 05:26:45 PM #3 Last Edit: September 11, 2013, 07:44:01 PM by Jim Scott
Went through and changed all to include both the (), Int and the Return 0 to all handler subroutines and the warnings went away.

Thanks

PS:  Reminds me of the procedure vs. function arguments of days gone by...  Donde esta mi amigo Pascal?
Jim Scott