1
1
forked from 0ad/0ad

wdbg: temporarily removed LOCALIZED_TEXT so this works in another project. must find long-term solution: lib/ must not be dependent on ps/!

sysdep.h: add pick_dir
sysdep/win/win.cpp: .. and its win32 implementation

This was SVN commit r1655.
This commit is contained in:
janwas 2005-01-07 00:59:52 +00:00
parent 39783e6a17
commit 090ea2301a
3 changed files with 43 additions and 1 deletions

View File

@ -34,6 +34,8 @@ extern int clipboard_free(wchar_t* copy);
extern int get_executable_name(char* n_path, size_t buf_size);
extern int pick_directory(char* n_path, size_t buf_size);
#ifdef _MSC_VER
extern double round(double);

View File

@ -31,7 +31,7 @@
#include "assert_dlg.h"
#define LOCALISED_TEXT
//#define LOCALISED_TEXT
#ifdef LOCALISED_TEXT
#include "ps/i18n.h"
@ -763,12 +763,14 @@ int debug_main_exception_filter(unsigned int UNUSEDPARAM(code), PEXCEPTION_POINT
{
if (ep->ExceptionRecord->NumberParameters == 3)
{
/*/*
PSERROR* err = (PSERROR*) ep->ExceptionRecord->ExceptionInformation[1];
if (err->magic == 0x45725221)
{
int code = err->code;
error = GetErrorString(code);
}
*/
}
}
__except (EXCEPTION_EXECUTE_HANDLER)

View File

@ -26,6 +26,7 @@
#include <stdio.h>
#include <stdlib.h> // __argc
#include <malloc.h>
#include <shlobj.h> // pick_dir
extern HWND hWnd;
@ -56,6 +57,43 @@ inline int get_executable_name(char* n_path, size_t buf_size)
return nbytes? 0 : -1;
}
static int CALLBACK browse_cb(HWND hWnd, unsigned int msg, LPARAM lParam, LPARAM ldata)
{
if(msg == BFFM_INITIALIZED)
{
const char* cur_dir = (const char*)ldata;
SendMessage(hWnd, BFFM_SETSELECTIONA, 1, (LPARAM)cur_dir);
return 1;
}
return 0;
}
int pick_directory(char* path, size_t buf_size)
{
IMalloc* p_malloc;
SHGetMalloc(&p_malloc);
GetCurrentDirectory(PATH_MAX, path);
/// ShowWindow(hWnd, SW_HIDE);
BROWSEINFOA bi;
memset(&bi, 0, sizeof(bi));
bi.ulFlags = BIF_RETURNONLYFSDIRS;
bi.lpfn = (BFFCALLBACK)browse_cb;
bi.lParam = (LPARAM)path;
ITEMIDLIST* pidl = SHBrowseForFolderA(&bi);
BOOL ok = SHGetPathFromIDList(pidl, path);
/// ShowWindow(hWnd, SW_SHOW);
p_malloc->Free(pidl);
p_malloc->Release();
return ok? 0 : -1;
}
void display_msg(const char* caption, const char* msg)
{