From: simon@wotangate.sc.ti.com (Jean-Yves Simon)
Subject: Problem when running with windows 3.1
Organization: Texas Instruments
Date: Fri, 20 Nov 1992 01:49:08 GMT

Hi netters !

I own tpw 1.5 and I have a problem when i run a program I wrote with
tpw 1.5 . I want the user to be able to modify the attributes of a file, 
for that I have a list box where I show the files in the current 
directory , plus 4 checks boxes for the files attributes 
(hidden, archive..). The list box shows the files and the directories,
and when I double click,I change for the selected directoty and show 
the files, otherwise, if I select a file, I am showing its attributes, 

Here is my procedure.


(*** proc to handle list box ***)
procedure TFileWindow.HandlelistBox(var Msg : Tmessage);
var path,curdir ,t1: array [0..164] of char;
    Is_a_dir : Boolean;
begin
 if ((Msg.LParamHi = lbn_SelChange) or (Msg.LparamHi = lbn_Dblclk)) then begin
     Is_a_dir := DlgDirSelect(Hwindow,path,id_listb);
     if (Is_a_dir = FALSE) then begin
                   EnableWindow(GetDlgItem(Hwindow,id_modbut),TRUE);
                   EnableWindow(GetDlgItem(Hwindow,id_info),TRUE);
                   TFileWindow.EnableAttributes;
                   ListB^.GetSelString(t1,14);
                   StaticLin^.SetText(t1);
                   getcurdir(curdir,0);
                   if ( (strlen(curdir)=3) and (StrScan(curdir,':')<>nil)) then strcat(curdir,'') else strcat(curdir,'\');
                   strcat(curdir,path);
                   strcopy(File_to,curdir);
                   TFileWindow.ShowAttributes;
                                 end
     else begin
          StaticLin^.SetText('');
          EnableWindow(GetDlgItem(Hwindow,id_modbut),FALSE);
          EnableWindow(GetDlgItem(Hwindow,id_info),FALSE);
          TFileWindow.DisableAttributes;
          end;

 if ( (Msg.LparamHi = lbn_Dblclk)) then begin
      if (Is_a_dir = TRUE) then begin
           if ( (strlen(path)=2) and (StrScan(path,':')<>nil)) then begin
                                              Strcopy(curdir,'');
                                              strcat(curdir,path);
                                              strcat(curdir,Mask);
                                              end
           else begin
                         getcurdir(curdir,0);
                         if ((strlen(curdir)=3)and(StrScan(curdir,':')<>nil)) then StrCat(curdir,'') else StrCat(curdir,'\');
                         StrCat(curdir,path);
                         strcat(curdir,Mask);
                end;
           DlgDirlist(Hwindow,curdir,id_listb,id_dir, $6037);
           SetFocus(GetDlgItem(Hwindow,id_listb));
   end ;
 end;
end;
end;


(*** end of proc ***)

This is working fine with win 3.00, However, when I use this program 
with win3.1, I can't have the list box to display files. When I start 
the program, I can see the files, but after moving back and forth 
throught directories, the files are not displayed, I can see only 
the directories.

I looked at my code with winsight , here is what I get:
This is an extract of the log with WINDOWS 3.0

 27DC {ListBox}  LB_GETTEXT  Sent from 2618 Index 43 at 0C05:26B4
 27DC {ListBox}  LB_GETTEXT  Returns "[..]"
 27DC {ListBox}  LB_GETCURSEL  Sent from 2618
 27DC {ListBox}  LB_GETCURSEL  Returns 43 0000:002B
 27DC {ListBox}  LB_GETTEXT  Sent from 2618 Index 43 at 0C05:2684
 27DC {ListBox}  LB_GETTEXT  Returns "[..]"
 27DC {ListBox}  LB_GETCURSEL  Sent from 2618
 27DC {ListBox}  LB_GETCURSEL  Returns 43 0000:002B
 27DC {ListBox}  LB_GETTEXT  Sent from 2618 Index 43 at 0C05:2684
 27DC {ListBox}  LB_GETTEXT  Returns "[..]"
27DC {ListBox}  LB_RESETCONTENT  Dispatched
27DC {ListBox}  LB_DIR  Dispatched Attrib 0027 "*.*"
27DC {ListBox}  WM_PAINT  Sent  (0,0)-(128,128)
 27DC {ListBox}  WM_ERASEBKGND  Sent from self  hdc 0836
 27DC {ListBox}  WM_ERASEBKGND  Returns Erased
27DC {ListBox}  WM_PAINT  Returns 1
27DC {ListBox}  LB_DIR  Dispatched Attrib C010 "*.*"
27DC {ListBox}  WM_PAINT  Sent  (0,0)-(128,128)
 27DC {ListBox}  WM_ERASEBKGND  Sent from self  hdc 084E
 27DC {ListBox}  WM_ERASEBKGND  Returns Erased
27DC {ListBox}  LB_RESETCONTENT  Dispatched

.... some lines deleted ...

27DC {ListBox}  LB_DIR  Dispatched Attrib 0027 "*.*"
27DC {ListBox}  WM_PAINT  Sent  (0,0)-(128,128)
 27DC {ListBox}  WM_ERASEBKGND  Sent from self  hdc 0836
 27DC {ListBox}  WM_ERASEBKGND  Returns Erased
27DC {ListBox}  WM_PAINT  Returns 1
27DC {ListBox}  LB_DIR  Dispatched Attrib C010 "*.*"
27DC {ListBox}  WM_PAINT  Sent  (0,0)-(128,128)
 27DC {ListBox}  WM_ERASEBKGND  Sent from self  hdc 084E
 27DC {ListBox}  WM_ERASEBKGND  Returns Erased


In windows 3.1. I have the following
-------------------------------------
 
 1BA8 {ListBox}  LB_GETTEXT  Sent from 1A54 Index 43 at 10A7:269C
 1BA8 {ListBox}  LB_GETTEXT  Returns "[..]"
1BA8 {ListBox}  WM_NCHITTEST  Sent  (158,195)
1BA8 {ListBox}  WM_NCHITTEST  Returns in Client
 1BA8 {ListBox}  LB_GETCURSEL  Sent from 1A54
 1BA8 {ListBox}  LB_GETCURSEL  Returns 43 0000:002B
 1BA8 {ListBox}  LB_GETTEXT  Sent from 1A54 Index 43 at 10A7:267A
 1BA8 {ListBox}  LB_GETTEXT  Returns "[..]"
 1BA8 {ListBox}  LB_GETCURSEL  Sent from 1A54
 1BA8 {ListBox}  LB_GETCURSEL  Returns 43 0000:002B
 1BA8 {ListBox}  LB_GETTEXT  Sent from 1A54 Index 43 at 10A7:267A
 1BA8 {ListBox}  LB_GETTEXT  Returns "[..]"
1BA8 {ListBox}  LB_RESETCONTENT  Dispatched
1BA8 {ListBox}  WM_NCCALCSIZE  Sent  wp=0001!  (39,41)-(185,171)
1BA8 {ListBox}  WM_NCCALCSIZE  Returns 0
1BA8 {ListBox}  LB_DIR  Dispatched Attrib 0027 "@"     
1BA8 {ListBox}  LB_DIR  Dispatched Attrib C010 "*.*"     
 
 ... some lines deleted...
 
 1BA8 {ListBox}  LB_GETTEXT  Sent from 1A54 Index 1 at 10A7:269C
 1BA8 {ListBox}  LB_GETTEXT  Returns "[applicat]"
1BA8 {ListBox}  WM_NCHITTEST  Sent  (186,144)
1BA8 {ListBox}  WM_NCHITTEST  Returns in Client
 1BA8 {ListBox}  LB_GETCURSEL  Sent from 1A54
 1BA8 {ListBox}  LB_GETCURSEL  Returns 1
 1BA8 {ListBox}  LB_GETTEXT  Sent from 1A54 Index 1 at 10A7:267A
 1BA8 {ListBox}  LB_GETTEXT  Returns "[applicat]"
 1BA8 {ListBox}  LB_GETCURSEL  Sent from 1A54
 1BA8 {ListBox}  LB_GETCURSEL  Returns 1
 1BA8 {ListBox}  LB_GETTEXT  Sent from 1A54 Index 1 at 10A7:267A
 1BA8 {ListBox}  LB_GETTEXT  Returns "[applicat]"
1BA8 {ListBox}  LB_RESETCONTENT  Dispatched
1BA8 {ListBox}  WM_NCCALCSIZE  Sent  wp=0001!  (39,41)-(185,171)
1BA8 {ListBox}  WM_NCCALCSIZE  Returns 0
1BA8 {ListBox}  LB_DIR  Dispatched Attrib 0027 "@"   
1BA8 {ListBox}  LB_DIR  Dispatched Attrib C010 "*.*"
1BA8 {ListBox}  WM_NCHITTEST  Sent  (186,144)

As you can see, The message LB_DIR for the files in not anymore "*.*",
and I don't understand why. (Actually,the character inside the quotes looks like a
black triangle,I edited an @ for the purpose of this message).
The code is exactly the same. I try to compile my code with TPW v1.0, 
I get the same result. Works fine with 3.00 but shows the same behaviour with 3.1.

Sorry for the lenght of my message, but if anybody can help to figure 
out this problem, I'll appreciate that.

Thank you very much.

PS: I have the same behaviour on friend'pc .It is not only mine which fails.

Xref: sparky comp.os.ms-windows.programmer.misc:3624 comp.os.ms-windows.programmer.tools:1491