Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Progress Bar - access denied  (Windows CE)

Posted on 2004-09-13
4
Medium Priority
?
673 Views
Last Modified: 2008-02-01
The application I am writing is specifically for Windows CE, but people with other knowledge may be able to help.

I am creating a progress bar.  For my app I cannot use MFC so I am using VC++ CE 3.0 API calls.  It creates fine, but each time I try to do something with it, like advance the status, nothing happens.  A GetLastError() call gives me a ERROR_ACCESS_DENIED error.  Using a PBM_STEPIT message later in the code gives me an ERROR_INVALID_PARAMETER.

Here is my code.  

LRESULT CALLBACK DialogWarnProc(
    HWND hDlg,
    UINT message,
    WPARAM wParam,
    LPARAM lParam
    )
{
    BOOL bRet = TRUE;
      SHINITDLGINFO shidi;
      
      int i;
      UINT timer;
      UINT idc;
      INITCOMMONCONTROLSEX iccInit;
      DWORD error = 0;
      UINT result;
      // Initialize the common controls.
iccInit.dwSize = sizeof(iccInit);
iccInit.dwICC = ICC_PROGRESS_CLASS;
InitCommonControlsEx(&iccInit);


    switch (message)
        {
        case WM_INITDIALOG:

                        shidi.dwMask = SHIDIM_FLAGS;
                  shidi.dwFlags = SHIDIF_DONEBUTTON | SHIDIF_SIPDOWN | SHIDIF_SIZEDLGFULLSCREEN;
                  shidi.hDlg = hDlg;
                  SHInitDialog(&shidi);

                         g_hWndProgress = CreateWindowEx(NULL,PROGRESS_CLASS, NULL,
                        WS_VISIBLE | WS_CHILD | WS_BORDER, 5, 100, 50, 20, hDlg,
                  //      NULL,
                        (HMENU) 4,
                        g_hInst, NULL);
                         if( !g_hWndProgress)
                        error=GetLastError();
                        error=0;
                        SendMessage(g_hWndProgress,PBM_SETRANGE,(LPARAM) 0,(WPARAM)30);
            
                        error=GetLastError();
                        error = 0;
                        SendMessage(g_hWndProgress,PBM_SETSTEP, 5,0L);
                        
                        error=GetLastError();
                        error=0;
                        result=SendMessage(g_hWndProgress,PBM_SETPOS, 15,0L);
                        error=GetLastError();
                        //      SendMessage(g_hWndProgress,PBM_STEPIT,0,0);
                        //                  error=GetLastError();
                  return TRUE;
                  

      
       case WM_COMMAND:
            {
       
           
            idc = LOWORD(wParam);
 
                  
                  switch(idc)
                {
             
                  
                  case IDOK:
                        SendMessage(hDlg,WM_DESTROY,0L,0L);
                        break;
            
                case IDCANCEL:
                              SendMessage(g_hWndProgress,PBM_STEPIT,(WPARAM)0,(LPARAM) 0);
                              error=GetLastError();
                              break;
               

                        
           
                }
            }
            break;

        case WM_DESTROY:
           
                  PostMessage(GetParent(GetParent(hDlg)), WM_CLOSE, 0, 0);
            break;

       

        default:
                  
      
            bRet = FALSE;
            break;
        }
      
    return bRet;
}




0
Comment
Question by:arachne8x
4 Comments
 
LVL 86

Expert Comment

by:jkr
ID: 12043748
Try calling 'SetLastError()' before that. The error code you are getting could be from any earlier problem.
0
 

Author Comment

by:arachne8x
ID: 12044025
The solution is that I set the range incorrectly.  I needed to use MAKELPARAM(0,100) for the set range message.
0
 

Accepted Solution

by:
ee_ai_construct earned 0 total points
ID: 12083838
Please read entire thread.  Asker solved or content important.
Closed, 500 points refunded.
ee_ai_construct (replacement part #xm34)
Community Support Admin
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Errors will happen. It is a fact of life for the programmer. How and when errors are detected have a great impact on quality and cost of a product. It is better to detect errors at compile time, when possible and practical. Errors that make their wa…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.
Suggested Courses

886 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question