static const double mm2pt = (METRIC_CONVERSION_CONSTANT*72);
static const double pt2mm = (1/(METRIC_CONVERSION_CONSTANT*72));
+// 260 was taken from windef.h
+#ifndef MAX_PATH
+ #define MAX_PATH 260
+#endif
+
// ---------------------------------------------------------------------------
// standard icons from the resources
// ---------------------------------------------------------------------------
WXDLLIMPEXP_BASE void wxSetInstance(HINSTANCE hInst);
+// return the full name of the program file
+inline wxString wxGetFullModuleName()
+{
+ wxString fullname;
+ if ( !::GetModuleFileName
+ (
+ (HMODULE)wxGetInstance(),
+ wxStringBuffer(fullname, MAX_PATH),
+ MAX_PATH
+ ) )
+ {
+ wxLogLastError(_T("GetModuleFileName"));
+ }
+
+ return fullname;
+}
+
#if wxUSE_GUI
// cursor stuff
}
#ifdef __WXWINCE__
- // WinCE doesn't insert the program itself, so let's
- // do it here.
- wxString programName;
-
- if ( ::GetModuleFileName( (HMODULE) wxGetInstance(), wxStringBuffer(programName, MAX_PATH), MAX_PATH ) == 0)
- {
- wxLogLastError(_T("GetModuleFileName"));
- }
- args.Insert(programName, 0);
+ // WinCE doesn't insert the program itself, so do it ourselves.
+ args.Insert(wxGetFullModuleName(), 0);
#endif
int argc = args.GetCount();
#endif
#endif
-// 260 was taken from windef.h
-#ifndef MAX_PATH
- #define MAX_PATH 260
-#endif
-
// ----------------------------------------------------------------------------
// constants
// ----------------------------------------------------------------------------
}
else // fall back to the program directory
{
- wxString strPath;
- ::GetModuleFileName(::GetModuleHandle(NULL),
- wxStringBuffer(strPath, MAX_PATH), MAX_PATH);
-
- // extract the dir name
- wxSplitPath(strPath, &strDir, NULL, NULL);
+ // extract the directory component of the program file name
+ wxSplitPath(wxGetFullModuleName(), &strDir, NULL, NULL);
}
#endif // UNIX/Win