]> git.saurik.com Git - wxWidgets.git/blame_incremental - src/os2/utils.cpp
cosmetic fixes to font encoding names
[wxWidgets.git] / src / os2 / utils.cpp
... / ...
CommitLineData
1/////////////////////////////////////////////////////////////////////////////
2// Name: utils.cpp
3// Purpose: Various utilities
4// Author: David Webster
5// Modified by:
6// Created: 09/17/99
7// RCS-ID: $Id$
8// Copyright: (c) David Webster
9// Licence: wxWindows license
10/////////////////////////////////////////////////////////////////////////////
11
12// For compilers that support precompilation, includes "wx.h".
13#include "wx/wxprec.h"
14
15#ifndef WX_PRECOMP
16 #include "wx/setup.h"
17 #include "wx/utils.h"
18 #include "wx/app.h"
19 #include "wx/cursor.h"
20#endif //WX_PRECOMP
21
22#include "wx/os2/private.h"
23#include "wx/timer.h"
24#include "wx/intl.h"
25
26#include <ctype.h>
27#ifdef __EMX__
28#include <dirent.h>
29#endif
30
31#include "wx/log.h"
32
33#include <io.h>
34
35#include <stdio.h>
36#include <stdlib.h>
37#include <string.h>
38#include <errno.h>
39#include <stdarg.h>
40
41#define PURE_32
42
43#ifndef __EMX__
44#include <upm.h>
45#include <netcons.h>
46#include <netbios.h>
47#endif
48
49static const wxChar WX_SECTION[] = _T("wxWindows");
50static const wxChar eHOSTNAME[] = _T("HostName");
51static const wxChar eUSERID[] = _T("UserId");
52static const wxChar eUSERNAME[] = _T("UserName");
53
54// For the following functions we SHOULD fill in support
55// for Windows-NT (which I don't know) as I assume it begin
56// a POSIX Unix (so claims MS) that it has some special
57// functions beyond those provided by WinSock
58
59// Get full hostname (eg. DoDo.BSn-Germany.crg.de)
60bool wxGetHostName(
61 wxChar* zBuf
62, int nMaxSize
63)
64{
65#if wxUSE_NET_API
66 char zServer[256];
67 char zComputer[256];
68 unsigned long ulLevel = 0;
69 unsigned char* zBuffer = NULL;
70 unsigned long ulBuffer = 256;
71 unsigned long* pulTotalAvail = NULL;
72
73 NetBios32GetInfo( (const unsigned char*)zServer
74 ,(const unsigned char*)zComputer
75 ,ulLevel
76 ,zBuffer
77 ,ulBuffer
78 ,pulTotalAvail
79 );
80 strcpy(zBuf, zServer);
81#else
82 wxChar* zSysname;
83 const wxChar* zDefaultHost = _T("noname");
84
85 if ((zSysname = wxGetenv(_T("SYSTEM_NAME"))) == NULL)
86 {
87 ULONG n = ::PrfQueryProfileString( HINI_PROFILE
88 ,(PSZ)WX_SECTION
89 ,(PSZ)eHOSTNAME
90 ,(PSZ)zDefaultHost
91 ,(void*)zBuf
92 ,(ULONG)nMaxSize - 1
93 );
94 }
95 else
96 wxStrncpy(zBuf, zSysname, nMaxSize - 1);
97 zBuf[nMaxSize] = _T('\0');
98#endif
99 return *zBuf ? TRUE : FALSE;
100}
101
102// Get user ID e.g. jacs
103bool wxGetUserId(
104 wxChar* zBuf
105, int nType
106)
107{
108#ifndef __EMX__
109 long lrc;
110 // UPM procs return 0 on success
111 lrc = U32ELOCU((unsigned char*)zBuf, (unsigned long *)&nType);
112 if (lrc == 0) return TRUE;
113#endif
114 return FALSE;
115}
116
117bool wxGetUserName(
118 wxChar* zBuf
119, int nMaxSize
120)
121{
122#ifdef USE_NET_API
123 wxGetUserId( zBuf
124 ,nMaxSize
125 );
126#else
127 wxStrncpy(zBuf, _T("Unknown User"), nMaxSize);
128#endif
129 return TRUE;
130}
131
132int wxKill(
133 long lPid
134, int nSig
135)
136{
137 return((int)::DosKillProcess(0, (PID)lPid));
138}
139
140//
141// Execute a program in an Interactive Shell
142//
143bool wxShell(
144 const wxString& rCommand
145)
146{
147 wxChar* zShell = _T("CMD.EXE");
148 wxString sInputs;
149 wxChar zTmp[255];
150 STARTDATA SData = {0};
151 PSZ PgmTitle = "Command Shell";
152 APIRET rc;
153 PID vPid = 0;
154 ULONG ulSessID = 0;
155 UCHAR achObjBuf[256] = {0}; //error data if DosStart fails
156 RESULTCODES vResult;
157
158 SData.Length = sizeof(STARTDATA);
159 SData.Related = SSF_RELATED_INDEPENDENT;
160 SData.FgBg = SSF_FGBG_FORE;
161 SData.TraceOpt = SSF_TRACEOPT_NONE;
162 SData.PgmTitle = PgmTitle;
163 SData.PgmName = zShell;
164
165 sInputs = "/C " + rCommand;
166 SData.PgmInputs = (BYTE*)sInputs.c_str();
167 SData.TermQ = 0;
168 SData.Environment = 0;
169 SData.InheritOpt = SSF_INHERTOPT_SHELL;
170 SData.SessionType = SSF_TYPE_WINDOWABLEVIO;
171 SData.IconFile = 0;
172 SData.PgmHandle = 0;
173 SData.PgmControl = SSF_CONTROL_VISIBLE | SSF_CONTROL_MAXIMIZE;
174 SData.InitXPos = 30;
175 SData.InitYPos = 40;
176 SData.InitXSize = 200;
177 SData.InitYSize = 140;
178 SData.Reserved = 0;
179 SData.ObjectBuffer = (char*)achObjBuf;
180 SData.ObjectBuffLen = (ULONG)sizeof(achObjBuf);
181
182 rc = ::DosStartSession(&SData, &ulSessID, &vPid);
183 if (rc == 0 || rc == 457) // NO_ERROR or SMG_START_IN_BACKGROUND
184 {
185 PTIB ptib;
186 PPIB ppib;
187
188 ::DosGetInfoBlocks(&ptib, &ppib);
189
190 ::DosWaitChild( DCWA_PROCESS
191 ,DCWW_WAIT
192 ,&vResult
193 ,&ppib->pib_ulpid
194 ,vPid
195 );
196 }
197 return (rc != 0);
198}
199
200// Get free memory in bytes, or -1 if cannot determine amount (e.g. on UNIX)
201long wxGetFreeMemory()
202{
203 void* pMemptr = NULL;
204 ULONG lSize;
205 ULONG lMemFlags;
206 APIRET rc;
207
208 lMemFlags = PAG_FREE;
209 rc = ::DosQueryMem(pMemptr, &lSize, &lMemFlags);
210 if (rc != 0)
211 return -1L;
212 return (long)lSize;
213}
214
215// Sleep for nSecs seconds. Attempt a Windows implementation using timers.
216static bool inTimer = FALSE;
217
218class wxSleepTimer: public wxTimer
219{
220public:
221 inline void Notify()
222 {
223 inTimer = FALSE;
224 Stop();
225 }
226};
227
228static wxTimer* wxTheSleepTimer = NULL;
229
230void wxUsleep(
231 unsigned long ulMilliseconds
232)
233{
234 ::DosSleep(ulMilliseconds/1000l);
235}
236
237void wxSleep(
238 int nSecs
239)
240{
241 ::DosSleep(1000 * nSecs);
242}
243
244// Consume all events until no more left
245void wxFlushEvents()
246{
247// wxYield();
248}
249
250// Output a debug mess., in a system dependent fashion.
251void wxDebugMsg(
252 const wxChar* zFmt ...
253)
254{
255 va_list vAp;
256 static wxChar zBuffer[512];
257
258 if (!wxTheApp->GetWantDebugOutput())
259 return ;
260 va_start(vAp, zFmt);
261 sprintf(zBuffer, zFmt, vAp) ;
262 va_end(vAp);
263}
264
265// Non-fatal error: pop up message box and (possibly) continue
266void wxError(
267 const wxString& rMsg
268, const wxString& rTitle
269)
270{
271 wxBuffer = new wxChar[256];
272 wxSprintf(wxBuffer, "%s\nContinue?", WXSTRINGCAST rMsg);
273 if (::WinMessageBox( HWND_DESKTOP
274 ,NULL
275 ,(PSZ)wxBuffer
276 ,(PSZ)WXSTRINGCAST rTitle
277 ,0
278 ,MB_ICONEXCLAMATION | MB_YESNO
279 ) == MBID_YES)
280 delete[] wxBuffer;
281 wxExit();
282}
283
284// Fatal error: pop up message box and abort
285void wxFatalError(
286 const wxString& rMsg
287, const wxString& rTitle
288)
289{
290 unsigned long ulRc;
291
292 ulRc = ::WinMessageBox( HWND_DESKTOP
293 ,NULL
294 ,WXSTRINGCAST rMsg
295 ,WXSTRINGCAST rTitle
296 ,0
297 ,MB_NOICON | MB_OK
298 );
299 DosExit(EXIT_PROCESS, ulRc);
300}
301
302// Emit a beeeeeep
303void wxBell()
304{
305 DosBeep(1000,1000); // 1kHz during 1 sec.
306}
307
308// Chris Breeze 27/5/98: revised WIN32 code to
309// detect WindowsNT correctly
310int wxGetOsVersion(
311 int* pMajorVsn
312, int* pMinorVsn
313)
314{
315 ULONG ulSysInfo[QSV_MAX] = {0};
316 APIRET ulrc;
317
318 ulrc = ::DosQuerySysInfo( 1L
319 ,QSV_MAX
320 ,(PVOID)ulSysInfo
321 ,sizeof(ULONG) * QSV_MAX
322 );
323 if (ulrc == 0L)
324 {
325 *pMajorVsn = ulSysInfo[QSV_VERSION_MAJOR];
326 *pMajorVsn = *pMajorVsn/10;
327 *pMinorVsn = ulSysInfo[QSV_VERSION_MINOR];
328 return wxWINDOWS_OS2;
329 }
330 return wxWINDOWS; // error if we get here, return generic value
331}
332
333// Reading and writing resources (eg WIN.INI, .Xdefaults)
334#if wxUSE_RESOURCES
335bool wxWriteResource(
336 const wxString& rSection
337, const wxString& rEntry
338, const wxString& rValue
339, const wxString& rFile
340)
341{
342 HAB hab = 0;
343 HINI hIni = 0;
344
345 if (rFile != "")
346 {
347 hIni = ::PrfOpenProfile(hab, (PSZ)WXSTRINGCAST rFile);
348 if (hIni != 0L)
349 {
350 return (::PrfWriteProfileString( hIni
351 ,(PSZ)WXSTRINGCAST rSection
352 ,(PSZ)WXSTRINGCAST rEntry
353 ,(PSZ)WXSTRINGCAST rValue
354 ));
355 }
356 }
357 else
358 return (::PrfWriteProfileString( HINI_PROFILE
359 ,(PSZ)WXSTRINGCAST rSection
360 ,(PSZ)WXSTRINGCAST rEntry
361 ,(PSZ)WXSTRINGCAST rValue
362 ));
363 return FALSE;
364}
365
366bool wxWriteResource(
367 const wxString& rSection
368, const wxString& rEntry
369, float fValue
370, const wxString& rFile
371)
372{
373 wxChar zBuf[50];
374
375 wxSprintf(zBuf, "%.4f", fValue);
376 return wxWriteResource( rSection
377 ,rEntry
378 ,zBuf
379 ,rFile
380 );
381}
382
383bool wxWriteResource(
384 const wxString& rSection
385, const wxString& rEntry
386, long lValue
387, const wxString& rFile
388)
389{
390 wxChar zBuf[50];
391
392 wxSprintf(zBuf, "%ld", lValue);
393 return wxWriteResource( rSection
394 ,rEntry
395 ,zBuf
396 ,rFile
397 );
398}
399
400bool wxWriteResource(
401 const wxString& rSection
402, const wxString& rEntry
403, int lValue
404, const wxString& rFile
405)
406{
407 wxChar zBuf[50];
408
409 wxSprintf(zBuf, "%d", lValue);
410 return wxWriteResource( rSection
411 ,rEntry
412 ,zBuf
413 ,rFile
414 );
415}
416
417bool wxGetResource(
418 const wxString& rSection
419, const wxString& rEntry
420, wxChar** ppValue
421, const wxString& rFile
422)
423{
424 HAB hab = 0;
425 HINI hIni = 0;
426 wxChar zDefunkt[] = _T("$$default");
427 char zBuf[1000];
428
429 if (rFile != "")
430 {
431 hIni = ::PrfOpenProfile(hab, (PSZ)WXSTRINGCAST rFile);
432 if (hIni != 0L)
433 {
434 ULONG n = ::PrfQueryProfileString( hIni
435 ,(PSZ)WXSTRINGCAST rSection
436 ,(PSZ)WXSTRINGCAST rEntry
437 ,(PSZ)zDefunkt
438 ,(PVOID)zBuf
439 ,1000
440 );
441 if (zBuf == NULL)
442 return FALSE;
443 if (n == 0L || wxStrcmp(zBuf, zDefunkt) == 0)
444 return FALSE;
445 zBuf[n-1] = '\0';
446 }
447 else
448 return FALSE;
449 }
450 else
451 {
452 ULONG n = ::PrfQueryProfileString( HINI_PROFILE
453 ,(PSZ)WXSTRINGCAST rSection
454 ,(PSZ)WXSTRINGCAST rEntry
455 ,(PSZ)zDefunkt
456 ,(PVOID)zBuf
457 ,1000
458 );
459 if (zBuf == NULL)
460 return FALSE;
461 if (n == 0L || wxStrcmp(zBuf, zDefunkt) == 0)
462 return FALSE;
463 zBuf[n-1] = '\0';
464 }
465 strcpy((char*)*ppValue, zBuf);
466 return TRUE;
467}
468
469bool wxGetResource(
470 const wxString& rSection
471, const wxString& rEntry
472, float* pValue
473, const wxString& rFile
474)
475{
476 wxChar* zStr = NULL;
477
478 zStr = new wxChar[1000];
479 bool bSucc = wxGetResource( rSection
480 ,rEntry
481 ,(wxChar **)&zStr
482 ,rFile
483 );
484
485 if (bSucc)
486 {
487 *pValue = (float)wxStrtod(zStr, NULL);
488 delete[] zStr;
489 return TRUE;
490 }
491 else
492 {
493 delete[] zStr;
494 return FALSE;
495 }
496}
497
498bool wxGetResource(
499 const wxString& rSection
500, const wxString& rEntry
501, long* pValue
502, const wxString& rFile
503)
504{
505 wxChar* zStr = NULL;
506
507 zStr = new wxChar[1000];
508 bool bSucc = wxGetResource( rSection
509 ,rEntry
510 ,(wxChar **)&zStr
511 ,rFile
512 );
513
514 if (bSucc)
515 {
516 *pValue = wxStrtol(zStr, NULL, 10);
517 delete[] zStr;
518 return TRUE;
519 }
520 else
521 {
522 delete[] zStr;
523 return FALSE;
524 }
525}
526
527bool wxGetResource(
528 const wxString& rSection
529, const wxString& rEntry
530, int* pValue
531, const wxString& rFile
532)
533{
534 wxChar* zStr = NULL;
535
536 zStr = new wxChar[1000];
537 bool bSucc = wxGetResource( rSection
538 ,rEntry
539 ,(wxChar **)&zStr
540 ,rFile
541 );
542
543 if (bSucc)
544 {
545 *pValue = (int)wxStrtol(zStr, NULL, 10);
546 delete[] zStr;
547 return TRUE;
548 }
549 else
550 {
551 delete[] zStr;
552 return FALSE;
553 }
554}
555#endif // wxUSE_RESOURCES
556
557// ---------------------------------------------------------------------------
558// helper functions for showing a "busy" cursor
559// ---------------------------------------------------------------------------
560
561HCURSOR gs_wxBusyCursor = 0; // new, busy cursor
562HCURSOR gs_wxBusyCursorOld = 0; // old cursor
563static int gs_wxBusyCursorCount = 0;
564
565// Set the cursor to the busy cursor for all windows
566void wxBeginBusyCursor(
567 wxCursor* pCursor
568)
569{
570 if ( gs_wxBusyCursorCount++ == 0 )
571 {
572 gs_wxBusyCursor = (HCURSOR)pCursor->GetHCURSOR();
573 ::WinSetPointer(HWND_DESKTOP, (HPOINTER)gs_wxBusyCursor);
574 }
575 //else: nothing to do, already set
576}
577
578// Restore cursor to normal
579void wxEndBusyCursor()
580{
581 wxCHECK_RET( gs_wxBusyCursorCount > 0
582 ,_T("no matching wxBeginBusyCursor() for wxEndBusyCursor()")
583 );
584
585 if (--gs_wxBusyCursorCount == 0)
586 {
587 ::WinSetPointer(HWND_DESKTOP, (HPOINTER)gs_wxBusyCursorOld);
588 gs_wxBusyCursorOld = 0;
589 }
590}
591
592// TRUE if we're between the above two calls
593bool wxIsBusy()
594{
595 return (gs_wxBusyCursorCount > 0);
596}
597
598// ---------------------------------------------------------------------------
599const wxChar* wxGetHomeDir(
600 wxString* pStr
601)
602{
603 wxString& rStrDir = *pStr;
604
605 // OS/2 has no idea about home,
606 // so use the working directory instead?
607
608 // 256 was taken from os2def.h
609#ifndef MAX_PATH
610# define MAX_PATH 256
611#endif
612
613 char zDirName[256];
614 ULONG ulDirLen;
615
616 ::DosQueryCurrentDir(0, zDirName, &ulDirLen);
617 rStrDir = zDirName;
618 return rStrDir.c_str();
619}
620
621// Hack for OS/2
622wxChar* wxGetUserHome (
623 const wxString& rUser
624)
625{
626 wxChar* zHome;
627 wxString sUser1(rUser);
628
629 wxBuffer = new wxChar[256];
630#ifndef __EMX__
631 if (sUser1 != _T(""))
632 {
633 wxChar zTmp[64];
634
635 if (wxGetUserId( zTmp
636 ,sizeof(zTmp)/sizeof(char)
637 ))
638 {
639 // Guests belong in the temp dir
640 if (wxStricmp(zTmp, _T("annonymous")) == 0)
641 {
642 if ((zHome = wxGetenv(_T("TMP"))) != NULL ||
643 (zHome = wxGetenv(_T("TMPDIR"))) != NULL ||
644 (zHome = wxGetenv(_T("TEMP"))) != NULL)
645 delete[] wxBuffer;
646 return *zHome ? zHome : (wxChar*)_T("\\");
647 }
648 if (wxStricmp(zTmp, WXSTRINGCAST sUser1) == 0)
649 sUser1 = _T("");
650 }
651 }
652#endif
653 if (sUser1 == _T(""))
654 {
655 if ((zHome = wxGetenv(_T("HOME"))) != NULL)
656 {
657 wxStrcpy(wxBuffer, zHome);
658 Unix2DosFilename(wxBuffer);
659 wxStrcpy(zHome, wxBuffer);
660 delete[] wxBuffer;
661 return zHome;
662 }
663 }
664 delete[] wxBuffer;
665 return NULL; // No home known!
666}
667
668// Check whether this window wants to process messages, e.g. Stop button
669// in long calculations.
670bool wxCheckForInterrupt(
671 wxWindow* pWnd
672)
673{
674 if(pWnd)
675 {
676 QMSG vMsg;
677 HAB hab = 0;
678 HWND hwndFilter = NULLHANDLE;
679 HWND hwndWin= (HWND) pWnd->GetHWND();
680
681 while(::WinPeekMsg(hab, &vMsg, hwndFilter, 0, 0, PM_REMOVE))
682 {
683 ::WinDispatchMsg(hab, &vMsg);
684 }
685 return TRUE;//*** temporary?
686 }
687 else
688 {
689 wxFAIL_MSG(_T("pWnd==NULL !!!"));
690 return FALSE;//*** temporary?
691 }
692}
693
694void wxGetMousePosition(
695 int* pX
696, int* pY
697)
698{
699 POINTL vPt;
700
701 ::WinQueryPointerPos(HWND_DESKTOP, &vPt);
702 *pX = vPt.x;
703 *pY = vPt.y;
704};
705
706// Return TRUE if we have a colour display
707bool wxColourDisplay()
708{
709 HPS hpsScreen;
710 HDC hdcScreen;
711 LONG lColors;
712
713 hpsScreen = ::WinGetScreenPS(HWND_DESKTOP);
714 hdcScreen = ::GpiQueryDevice(hpsScreen);
715 ::DevQueryCaps(hdcScreen, CAPS_COLORS, 1L, &lColors);
716 return(lColors > 1L);
717}
718
719// Returns depth of screen
720int wxDisplayDepth()
721{
722 HPS hpsScreen;
723 HDC hdcScreen;
724 LONG lPlanes;
725 LONG lBitsPerPixel;
726 LONG nDepth;
727
728 hpsScreen = ::WinGetScreenPS(HWND_DESKTOP);
729 hdcScreen = ::GpiQueryDevice(hpsScreen);
730 ::DevQueryCaps(hdcScreen, CAPS_COLOR_PLANES, 1L, &lPlanes);
731 ::DevQueryCaps(hdcScreen, CAPS_COLOR_BITCOUNT, 1L, &lBitsPerPixel);
732
733 nDepth = (int)(lPlanes * lBitsPerPixel);
734 DevCloseDC(hdcScreen);
735 return (nDepth);
736}
737
738// Get size of display
739void wxDisplaySize(
740 int* pWidth
741, int* pHeight
742)
743{
744 HPS hpsScreen;
745 HDC hdcScreen;
746 LONG lWidth;
747 LONG lHeight;
748
749 hpsScreen = ::WinGetScreenPS(HWND_DESKTOP);
750 hdcScreen = ::GpiQueryDevice(hpsScreen);
751 ::DevQueryCaps(hdcScreen, CAPS_WIDTH, 1L, &lWidth);
752 ::DevQueryCaps(hdcScreen, CAPS_HEIGHT, 1L, &lHeight);
753 DevCloseDC(hdcScreen);
754 *pWidth = (int)lWidth;
755 *pHeight = (int)lHeight;
756}
757
758void wxDisplaySizeMM(
759 int* pWidth
760, int* pHeight
761)
762{
763 HPS hpsScreen;
764 HDC hdcScreen;
765
766 hpsScreen = ::WinGetScreenPS(HWND_DESKTOP);
767 hdcScreen = ::GpiQueryDevice(hpsScreen);
768
769 if (pWidth)
770 ::DevQueryCaps( hdcScreen
771 ,CAPS_HORIZONTAL_RESOLUTION
772 ,1L
773 ,(PLONG)pWidth
774 );
775 if (pHeight)
776 ::DevQueryCaps( hdcScreen
777 ,CAPS_VERTICAL_RESOLUTION
778 ,1L
779 ,(PLONG)pHeight
780 );
781}
782
783bool wxDirExists(
784 const wxString& rDir
785)
786{
787 return (::DosSetCurrentDir(WXSTRINGCAST rDir));
788}
789
790// ---------------------------------------------------------------------------
791// window information functions
792// ---------------------------------------------------------------------------
793
794wxString WXDLLEXPORT wxGetWindowText(
795 WXHWND hWnd
796)
797{
798 wxString vStr;
799 long lLen = ::WinQueryWindowTextLength((HWND)hWnd) + 1;
800
801 ::WinQueryWindowText((HWND)hWnd, lLen, vStr.GetWriteBuf((int)lLen));
802 vStr.UngetWriteBuf();
803
804 return vStr;
805}
806
807wxString WXDLLEXPORT wxGetWindowClass(
808 WXHWND hWnd
809)
810{
811 wxString vStr;
812 int nLen = 256; // some starting value
813
814 for ( ;; )
815 {
816 int nCount = ::WinQueryClassName((HWND)hWnd, nLen, vStr.GetWriteBuf(nLen));
817
818 vStr.UngetWriteBuf();
819 if (nCount == nLen )
820 {
821 // the class name might have been truncated, retry with larger
822 // buffer
823 nLen *= 2;
824 }
825 else
826 {
827 break;
828 }
829 }
830 return vStr;
831}
832
833WXWORD WXDLLEXPORT wxGetWindowId(
834 WXHWND hWnd
835)
836{
837 return ::WinQueryWindowUShort((HWND)hWnd, QWS_ID);
838}
839
840wxString WXDLLEXPORT wxPMErrorToStr(
841 ERRORID vError
842)
843{
844 wxString sError;
845
846 //
847 // Remove the high order byte -- it is useless
848 //
849 vError &= 0x0000ffff;
850 switch(vError)
851 {
852 case PMERR_INVALID_HWND:
853 sError = wxT("Invalid window handle specified");
854 break;
855
856 case PMERR_INVALID_FLAG:
857 sError = wxT("Invalid flag bit set");
858 break;
859
860 case PMERR_NO_MSG_QUEUE:
861 sError = wxT("No message queue available");
862 break;
863
864 case PMERR_INVALID_PARM:
865 sError = wxT("Parameter contained invalid data");
866 break;
867
868 case PMERR_INVALID_PARAMETERS:
869 sError = wxT("Parameter value is out of range");
870 break;
871
872 case PMERR_PARAMETER_OUT_OF_RANGE:
873 sError = wxT("Parameter value is out of range");
874 break;
875
876 case PMERR_INVALID_INTEGER_ATOM:
877 sError = wxT("Not a valid atom");
878 break;
879
880 case PMERR_INVALID_HATOMTBL:
881 sError = wxT("Atom table handle is invalid");
882 break;
883
884 case PMERR_INVALID_ATOM_NAME:
885 sError = wxT("Not a valid atom name");
886 break;
887
888 case PMERR_ATOM_NAME_NOT_FOUND:
889 sError = wxT("Valid name format, but cannot find name in atom table");
890 break;
891
892 default:
893 sError = wxT("Unknown error");
894 }
895 return(sError);
896} // end of wxPMErrorToStr
897
898