[comp.lang.pascal] Timer in TPW

yogurt@mimsy.umd.edu (Rob Crittenden) (04/15/91)

I'm having problems getting my app to recieve wm_timer callbacks.
I do a SetTimer(HWindow, 1, 1000, nil) in my Init (that's my 
TObject.Init, not TApplication.Init) and have in my object:
  Test.Timer(var Msg: TMessage) virtual wm_First + wm_Timer;

and the method of Timer only brings up a messagebox to say it got the
callback.  The problem is, I seem to be missing all of the wm_timer
messages.

Also, I'm trying to get a window to start out iconified and I can't
figure that one out either.  Right now, the best I can do is to get
it to come up and then iconify it (by using ShowWindow(HWindow, sw_ShowMinimized) or something similar).

Any ideas?


-- 
+------------------------------------------------------------------------+
|  yogurt@cs.umd.edu         Robert              Comp Sci Dept, U of Md  |
|  uunet!cs!yogurt             Crittenden        College Park, MD 20742  |
+------------------- so much beer, so little time -----------------------+

oivindt@bio.uio.no (Oivind Toien) (04/18/91)

In article <32937@mimsy.umd.edu> yogurt@mimsy.umd.edu (Rob Crittenden) writes:

> I'm having problems getting my app to recieve wm_timer callbacks.
> I do a SetTimer(HWindow, 1, 1000, nil) in my Init (that's my 
> TObject.Init, not TApplication.Init) and have in my object:
>   Test.Timer(var Msg: TMessage) virtual wm_First + wm_Timer;

> and the method of Timer only brings up a messagebox to say it got the
> callback.  The problem is, I seem to be missing all of the wm_timer
> messages.


1.Well, I do not see an immediate solution (I am quite fresh 
windows programming).
But I have the oppsosite problem: When trying to add an about
window in the gdidemo.pas example, the timertick obviously checks
the OK-button in the About dialog window, so that the dialog
disappears after a very short time.
The about procedure was added to the TGDIDemoWindow object in
the following way:
 ....
 TGDIDemoWindow = object(TMDIWindow)
    procedure SetupWindow; virtual;
    procedure About(var Message: TMessage);
      virtual cm_First + idm_About;
 .......


procedure TGDIDemoWindow.About(var Message: TMessage);
var
  Dialog: TDialog;
begin
  Dialog.Init(@Self, 'About');
  Dialog.Execute;
  Dialog.Done;
end;
.................

Does anyone have an idea what is happening, and a solution
to this problem?

2. What is the resolution of this millisecond timer?
Is it actually based on the DOS-timer-tick (Int $1C)?
A test procedure indicated that timer-ticks could not
be released more often than every 55ms although the
interval was set to 1 ms.

I am interested in a timer-tick with a real resolution
of 1 ms to drive an A/D-convertion routine. In DOS I have
reprogrammed the timer-chip and used Int $1C.
Will this work under Windows, or does windows (TPW) provide
a better (way of using the) timer-function?

Any help will be appreciated.