?
Solved

Common Dialog Box in WinCE (evc++ API)

Posted on 2003-11-20
5
Medium Priority
?
781 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
[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
  • 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 500 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 500 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

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…
This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
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 additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
Suggested Courses

801 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