Solved

Progress Bar - access denied  (Windows CE)

Posted on 2004-09-13
4
645 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

Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
FMX enumerated colours 2 100
sorting efficency of sorting algorithm 30 113
Safe conversion? 4 68
object oriented programming comparison 5 72
In days of old, returning something by value from a function in C++ was necessarily avoided because it would, invariably, involve one or even two copies of the object being created and potentially costly calls to a copy-constructor and destructor. A…
Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.

777 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