TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: Rusty Plant
from: Michael Douglass
date: 1994-06-16 13:35:08
subject: Guidelines 2.1A, freewar

RP>How do you handle your semaphores, parameters to threads,
  >object windows, and queues? I know I can use the Os/2 api
  >within Guidelines, but it then a windows version wouldn't
  >be possible. So far I have been intermixing C and JOT
  >together, but their should be another way in order to keep
  >the code common.

This is an easy one:  You CAN do ANYTHING under Guidelines that you can
do under C++.  If your main concern is compilability with both OS2 and
WINDOWS, there is an easy way to do this too.  While writing your
program, only use standard ANSI C functions to keep compiler specific
stuff out.  (Unless you use Borland C++ for Windows and Borland C++ for
OS2, then you can use any of the functions listed in the Borland C++ for
OS2 as an OS2 and a Windows function {The little boxes in the library
reference gives you this information})

Now, that is one way to keep yourself aligned with compiler/OS specific
stuff.  Another way is to sit down and write your own library of
functions under both compilers.  Include the same functions in both
libraries and insure that they perform the same things.  Then, compile
the code for your "library" to an .OBJ form.  Write a .H file.  Move the
.H file into a "header" directory, and move the .OBJ file into the
GUIDE\SYS directory.  Then, under external files add the WINLIB.OBJ,
WINLIB.H, OS2LIB.OBJ, OS2LIB.H into your program.  Be sure to set the
WIN stuff as Windows 3.1 only, and the OS2 stuff as OS/2 2.1 only so it
will use the correct one for each compilation. (You could also do the
same thing with .DLLs.)

Another thing:  You will sometimes need program information like the hab
for the program.  Guidelines, as far as I know, does not give a direct
way to do this.  Here's a quick way to get the hab for your program:

VOID myPushButton.Click ()
C: PAPPINFO pApp=GuiAppInfo()
blah..
blah..
C: thisMessageCall(pApp->hab)
end

See, there's always a way to do something.  In fact, if you need a hwnd
of a dialog/frame, all you need do is add a 'w' to the front of the
dialog box name, and add a .hwnd to it.  Instant handle to a window.

ie. dMyDialogBox
C: hwnd=wdMyDialogBox.hwnd

There are many other things you can get if you need it for some of the
API calls.  These are the two that I've run into.  You can get just
about any information you need.  Look at the .HPP files and the .CPP
files Guidelines creates, it will tell you how to do different tricks
like this.

Michael Douglass
___
 .Mike's Mail Internet:   MICHAEL.DOUGLASS{at}LCHANCE.SAT.TX.US

--- Maximus/2 2.01wb

* Origin: The Rock BBS--410Meg, i486/33, ZyXEL v32bis. (1:387/31)
SEEN-BY: 54/54 620/243 632/348 640/820 690/660 711/409 413 430 807 808 809
SEEN-BY: 711/934 712/353 623 713/888 800/1 2442/0
@PATH: 387/31 1102 3615/50 229/2 2442/0 711/409 54/54 711/808 809 934

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.