Menu

Integer from pointer without a cast

2002-12-08
2012-09-26
  • Nobody/Anonymous

    Consider the following function: It is called every second by a winapi timer to update a edit control showing for how long a specific procedure is runing. When the user kills the procedure, the timer is killed too.
    HH, MM, SS are ints declared at main.c and initialized as 0 before the function starts.

    int createTime() {
    char ActiveTime[10];
    SS++;
    if (SS==60) {
        SS=0;
        MM++;
        }
    if (MM==60) {
        MM=0;
        HH++;
        }
    sprintf(ActiveTime, "%dh:%dm:%ds", HH, MM, SS);
    SendMessage(hwndActiveTime, WM_SETTEXT, 0, ActiveTime);
    return 0;
    }

    No matter how i change this function i always get an error:
    [Warning] passing arg 4 of `SendMessageA' makes integer from pointer without a cast
    Can anyne give me some help?

     
    • Nobody/Anonymous

      Here is a C tutorial that was given here:

        http://pweb.netcom.com/~tjensen/ptr/pointers.htm

        j@ck_

       
    • Nobody/Anonymous

      Consider the following function: It is called every second by a winapi timer to update a edit control showing for how long a specific procedure is runing. When the user kills the procedure, the timer is killed too.
      HH, MM, SS are ints declared at main.c and initialized as 0 before the function starts.

      int createTime() {
      char ActiveTime[10];
      SS++;
      if (SS==60) {
      SS=0;
      MM++;
      }
      if (MM==60) {
      MM=0;
      HH++;
      }
      sprintf(ActiveTime, "%dh:%dm:%ds", HH, MM, SS);
      SendMessage(hwndActiveTime, WM_SETTEXT, 0, ActiveTime);
      return 0;
      }

      No matter how i change this function i always get an error:
      [Warning] passing arg 4 of `SendMessageA' makes integer from pointer without a cast
      Can anyne give me some help?

       
      • Nobody/Anonymous

        Cast (LPARAM) before ActiveTime, lparam supposed to be kind of integer type. Otherwise it supposed to convert array to pointer.

        tkorrovi

         
        • Nobody/Anonymous

          Thanks tikorrovi, that solved my problem.

           

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.