Solved

Common Dialog Box in WinCE (evc++ API)

Posted on 2003-11-20
5
753 Views
Last Modified: 2010-08-05
Hi People,

I'm trying to load a common dialog box on a Pocket PC, but my Common Dailog fails to load. when i call the GetLastError function it display 120 what does this mean???

I have list my code below so that you can get a better understand

      int rnet;
      OPENFILENAME ofn;
      TCHAR szFile[MAX_PATH+1] = {0};
      memset(&ofn, 0, sizeof(ofn));
      // Fill out data structure
      ofn.hInstance         = GetModuleHandle(NULL);
      ofn.lpstrCustomFilter = 0;
      ofn.lpstrInitialDir   = 0;
      ofn.lStructSize = sizeof(ofn);
      ofn.lpstrFilter = TEXT("Image Files (*.Log)\0*.log\0All Files (*.*)\0*.*\0");
      ofn.lpstrFile = szFile;
      ofn.nMaxFile = MAX_PATH;
      ofn.lpstrTitle = TEXT("Open Squeak image ...");
      ofn.Flags = OFN_EXPLORER | OFN_FILEMUSTEXIST | OFN_HIDEREADONLY;
      ofn.lpstrDefExt = TEXT("image");
      ofn.hwndOwner = hDlg;

      // Show dialog
      if (!GetSaveFileName(&ofn))
      {
                   rnet = GetLastError();
            Printf(L"Failed to Display Dialog BOX");
            Printf(L"GetLastError = %d",rnet);
            return FILE_ERROR;
      }

      return FILE_OK;



I developing in eVC++ 3.0 using API calls not MFC.

0
Comment
Question by:LPlate
  • 2
5 Comments
 
LVL 48

Expert Comment

by:AlexFM
ID: 9787031
120 means "This function is not supported on this system".
0
 
LVL 48

Accepted Solution

by:
AlexFM earned 125 total points
ID: 9787069
From Windows CE API Reference:

This API is part of the complete Windows CE OS package as provided by Microsoft. The functionality of a particular platform is determined by the original equipment manufacturer (OEM) and some devices may not support this API.
0
 
LVL 3

Assisted Solution

by:RJSoft
RJSoft earned 125 total points
ID: 9808261
Here is an old example of how to use Formatmessage. Notice it uses GetLastError(); This may help you in determining other errors you run into.

Although with CE I do not know if it will work because of the limmitted API.

RJ

LPVOID lpMsgBuf;
FormatMessage(
FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS,
NULL,
GetLastError(),
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
(LPTSTR) &lpMsgBuf,
0,
NULL
);

// Process any inserts in lpMsgBuf.
// ...
// Display the string.
::MessageBox( NULL, (LPCTSTR)lpMsgBuf, "Message is...", MB_OK | MB_ICONINFORMATION );
// Free the buffer.
LocalFree( lpMsgBuf );


0
 
LVL 9

Expert Comment

by:tinchos
ID: 10249324
No comment has been added lately, so it's time to clean up this TA.
I will leave the following recommendation for this question in the Cleanup topic area:

Split: AlexFM {http:#9787069} & RJSoft {http:#9808261}

Please leave any comments here within the next seven days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

Tinchos
EE Cleanup Volunteer
0

Featured Post

ScreenConnect 6.0 Free Trial

Explore all the enhancements in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI, app configurations and chat acknowledgement to improve customer engagement!

Question has a verified solution.

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

Suggested Solutions

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…
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…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
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.

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