~ubuntu-installer/wubi/trunk

« back to all changes in this revision

Viewing changes to src/7z/CPP/Windows/ResourceString.cpp

  • Committer: Agostino Russo
  • Date: 2008-12-04 00:37:30 UTC
  • Revision ID: agostino.russo@gmail.com-20081204003730-3o051yp78d6ujckl
* Bumped version to 9.04
* Added required binaries (will be compiled at a later stage)
* Added uninstallation page
* Added BitTorrent source
* Added documentation and licenses
* Connected download managers
* Fixed download status updates
* Added more information to the README
* Made the tasklist thread daemonic so that it does not prevent the
  main application from quitting

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// Windows/ResourceString.cpp
 
2
 
 
3
#include "StdAfx.h"
 
4
 
 
5
#include "Windows/ResourceString.h"
 
6
#ifndef _UNICODE
 
7
#include "Common/StringConvert.h"
 
8
#endif
 
9
 
 
10
extern HINSTANCE g_hInstance;
 
11
#ifndef _UNICODE
 
12
extern bool g_IsNT;
 
13
#endif
 
14
 
 
15
namespace NWindows {
 
16
 
 
17
CSysString MyLoadString(HINSTANCE hInstance, UINT resourceID)
 
18
{
 
19
  CSysString s;
 
20
  int size = 256;
 
21
  int len;
 
22
  do
 
23
  {
 
24
    size += 256;
 
25
    len = ::LoadString(hInstance, resourceID, s.GetBuffer(size - 1), size);
 
26
  } 
 
27
  while (size - len <= 1);
 
28
  s.ReleaseBuffer();
 
29
  return s;
 
30
}
 
31
 
 
32
CSysString MyLoadString(UINT resourceID)
 
33
{
 
34
  return MyLoadString(g_hInstance, resourceID);
 
35
}
 
36
 
 
37
#ifndef _UNICODE
 
38
UString MyLoadStringW(HINSTANCE hInstance, UINT resourceID)
 
39
{
 
40
  if (g_IsNT)
 
41
  {
 
42
    UString s;
 
43
    int size = 256;
 
44
    int len;
 
45
    do
 
46
    {
 
47
      size += 256;
 
48
      len = ::LoadStringW(hInstance, resourceID, s.GetBuffer(size - 1), size);
 
49
    } 
 
50
    while (size - len <= 1);
 
51
    s.ReleaseBuffer();
 
52
    return s;
 
53
  }
 
54
  return GetUnicodeString(MyLoadString(hInstance, resourceID));
 
55
}
 
56
 
 
57
UString MyLoadStringW(UINT resourceID)
 
58
{
 
59
  return MyLoadStringW(g_hInstance, resourceID);
 
60
}
 
61
 
 
62
#endif
 
63
 
 
64
}