Solved

Common Dialog Box in WinCE (evc++ API)

Posted on 2003-11-20
5
756 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
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 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.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

809 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