Subversion Repositories Aucun

Rev

Rev 125 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
113 ixe013 1
// RESHelper.cpp: implementation of the RESHelper class.
2
//
3
//////////////////////////////////////////////////////////////////////
4
 
5
#include "stdafx.h"
6
#include "RESHelper.h"
7
#include <atlstr.h>
8
 
9
TCHAR CRESHelper::mURL[MAX_PATH+24] = _T("res://");
192 ixe013 10
size_t CRESHelper::len = 0;
113 ixe013 11
 
12
void CRESHelper::Initialize(HINSTANCE dll)
13
{
14
    TCHAR filename[MAX_PATH];
15
 
16
    if(GetModuleFileName((HMODULE)dll, filename, MAX_PATH))
17
    {
18
        _tcscat_s(mURL, sizeof mURL / sizeof *mURL, filename);
19
        len = _tcslen(mURL);
20
    }
21
}
22
 
23
int CRESHelper::GetURLForID(int id, TCHAR *url, size_t size)
24
{
25
    TCHAR buf[32];
26
 
27
    buf[0] = '/';
28
    _itot_s(id, buf+1, (sizeof buf / sizeof *buf)-1, 10);
29
 
30
    _tcscpy_s(url, size, mURL);
31
    _tcscpy_s(url+len, size-len, buf);
32
 
33
    return len+_tcslen(buf);
34
}
35