• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 680
  • Last Modified:

Progress Bar - access denied (Windows CE)

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
arachne8x
Asked:
arachne8x
1 Solution
 
jkrCommented:
Try calling 'SetLastError()' before that. The error code you are getting could be from any earlier problem.
0
 
arachne8xAuthor Commented:
The solution is that I set the range incorrectly.  I needed to use MAKELPARAM(0,100) for the set range message.
0
 
ee_ai_constructCommented:
Please read entire thread.  Asker solved or content important.
Closed, 500 points refunded.
ee_ai_construct (replacement part #xm34)
Community Support Admin
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now