Thread: new error when compiling, deprecated use of cast expressions....

  1. #1
    Shibby willc0de4food's Avatar
    Join Date
    Mar 2005
    Location
    MI
    Posts
    378

    new error when compiling, deprecated use of cast expressions....

    hey, i've gotten my program to compile before but now i'm getting an error. the part of the code that has the error, is when the user double clicks and item in the listbox, it opens up the location in explorer. heres the code..
    Code:
    WORD wID,wNotify;
                HWND hCntrl;
                int selected = 0, len = 0;
                char path[MAX_PATH] = {0}, cmd[22] = "Explorer.exe /select,";
                char *command;
                
                if (SendMessage(GetDlgItem(hwnd, ID_INPUTDIR), WM_MOUSEHOVER, 0, (LPARAM)
    
                wID=LOWORD(wParam);
                wNotify=HIWORD(wParam);
                hCntrl=(HWND)lParam;
                
                if (lParam)
                {
                /*notification is from a control*/
                  if (wID==ID_LISTOUT)
                  {
                     /*notification is from a listbox control with id of 'ID_OF_LISTBOX'*/
                     if (wNotify==LBN_DBLCLK)
                     {
                         /*an item has been double clicked and we'll open it in an explorer window*/
                         selected = SendMessage(hCntrl, LB_GETCURSEL, 0, 0);
                         SendMessage(hCntrl, LB_GETTEXT, (WPARAM)selected, (LPARAM)path);
                         
                         len = strlen(cmd) + strlen(path) + 1;
                         command = malloc(len * sizeof(char));
                         strcpy(command, cmd);
                         strcat(command, path);
                         
                         STARTUPINFO         si = { sizeof(STARTUPINFO) };
    	                 PROCESS_INFORMATION pi = { 0 };
    
    	                 CreateProcess(NULL, command, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi);
    
                         CloseHandle(pi.hThread);
    	                 CloseHandle(pi.hProcess);
                     }
                  }
                }
    and here's the error i'm getting..
    main.c: In function `WindowProcedure':
    main.c:635: warning: use of cast expressions as lvalues is deprecated
    main.c:635: error: syntax error before ';' token

    make.exe: *** [main.o] Error 1
    program: Dev-C++
    OS: WinXP Pro

    any help is appreciated :] thanks.
    Registered Linux User #380033. Be counted: http://counter.li.org

  2. #2
    Just Lurking Dave_Sinkula's Avatar
    Join Date
    Oct 2002
    Posts
    5,005
    Count parens:
    Code:
    if (SendMessage(GetDlgItem(hwnd, ID_INPUTDIR), WM_MOUSEHOVER, 0, (LPARAM)
    7. It is easier to write an incorrect program than understand a correct one.
    40. There are two ways to write error-free programs; only the third one works.*

  3. #3
    Registered User Queatrix's Avatar
    Join Date
    Apr 2005
    Posts
    1,342
    Ha, that happens to me all to often, it's good to see that others make the same mistake.

  4. #4
    Shibby willc0de4food's Avatar
    Join Date
    Mar 2005
    Location
    MI
    Posts
    378
    oooooooohh yeeeaaaa.............
    :sigh: lol

    thanks :-D

    so uh...any good tutorials on tooltips ^_^
    Registered Linux User #380033. Be counted: http://counter.li.org

  5. #5
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    > Ha, that happens to me all to often, it's good to see that others make the same mistake.
    If you type in () followed by pressing the left cursor key, you'll never have mis-matched parens

    Same goes for {} /**/ "" or anything else which needs to be balanced.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Screwy Linker Error - VC2005
    By Tonto in forum C++ Programming
    Replies: 5
    Last Post: 06-19-2007, 02:39 PM
  2. Including The Right DLLs
    By bumfluff in forum Game Programming
    Replies: 8
    Last Post: 12-28-2006, 03:32 AM
  3. Replies: 28
    Last Post: 07-16-2006, 11:35 PM
  4. errors in class(urgent )
    By ayesha in forum C++ Programming
    Replies: 1
    Last Post: 11-10-2001, 10:14 PM
  5. errors in class(urgent)
    By ayesha in forum C++ Programming
    Replies: 2
    Last Post: 11-10-2001, 06:51 PM