Solved

Progress Bar - access denied  (Windows CE)

Posted on 2004-09-13
4
665 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Often, when implementing a feature, you won't know how certain events should be handled at the point where they occur and you'd rather defer to the user of your function or class. For example, a XML parser will extract a tag from the source code, wh…
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

717 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