home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / os / os2 / programm / 3702 < prev    next >
Encoding:
Internet Message Format  |  1992-07-21  |  1.7 KB

  1. Path: sparky!uunet!sun-barr!cs.utexas.edu!ut-emx!ccwf.cc.utexas.edu!fly
  2. From: fly@ccwf.cc.utexas.edu (Neil)
  3. Newsgroups: comp.os.os2.programmer
  4. Subject: listbox problem.
  5. Message-ID: <76293@ut-emx.uucp>
  6. Date: 21 Jul 92 13:02:35 GMT
  7. Sender: root@ut-emx.uucp
  8. Reply-To: fly@ccwf.cc.utexas.edu (Neil)
  9. Organization: The University of Texas at Austin, Austin TX
  10.  I am having trouble pulling all of the selected items from a multiple selection listbox.
  11. Lines: 50
  12. Originator: fly@thumper.cc.utexas.edu
  13.  
  14. the following code for some reason only pulls the first selected item from the listbox,and 
  15. I cannot figure out why it does not do all of them...
  16.  
  17. Any suggestions are appreciated.
  18.  Thank you.
  19.  
  20. Here is the code:
  21.  
  22. void Move()
  23. {    int selNum;
  24.     int index;
  25.     char text[256]; 
  26.     PSZ selection, 
  27.         newp,
  28.         oldp;
  29.     char newst[256];
  30.     char oldst[256];
  31.  
  32.     text[0]=NULL;
  33.     newst[0]=NULL;
  34.     oldst[0]=NULL;
  35.     selection = (PSZ) text;
  36.  
  37.     selNum = SHORT1FROMMR( WinSendMsg(hwndList,
  38.                 LM_QUERYSELECTION,
  39.                 MPFROMSHORT( LIT_FIRST ),
  40.                 NULL ));
  41.  
  42.     while  ( selNum != LIT_NONE)
  43.     {    WinSendMsg(hwndList,
  44.             LM_QUERYITEMTEXT,
  45.             MPFROM2SHORT( selNum,sizeof(text)),
  46.             MPFROMP( selection ));    
  47.          strcat( newst, p2);
  48.         if (newst[strlen(newst) -1] != '\\' )
  49.             strcat( newst, "\\" );
  50.         strcat( newst, selection);
  51.         strcpy( oldst,  p1);
  52.         if (oldst[strlen(oldst) -1] != '\\' )
  53.             strcat( oldst, "\\" );
  54.         strcat( oldst,  selection);
  55.         newp = (PSZ) newst;
  56.         oldp = (PSZ) oldst;
  57.         DosMove(oldp, newp, 0L);
  58.         selNum=SHORT1FROMMR(WinSendMsg(hwndList,
  59.                                             LM_QUERYSELECTION,
  60.                                             MPFROMSHORT(selNum),
  61.                                             0L));
  62.     };
  63. };
  64.