Solved

Common Dialog Box in WinCE (evc++ API)

Posted on 2003-11-20
5
740 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
Comment Utility
120 means "This function is not supported on this system".
0
 
LVL 48

Accepted Solution

by:
AlexFM earned 125 total points
Comment Utility
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
Comment Utility
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
Comment Utility
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

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…
Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
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.

762 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now