aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authornyamatongwe <unknown>2002-06-09 02:58:47 +0000
committernyamatongwe <unknown>2002-06-09 02:58:47 +0000
commitc06e1e893caa023d5de09ac2364e565fad2f6139 (patch)
treeb6e7149f27524e0a395625832ec006de73a33609
parentbdbc6ab53dd4e602b7d7973954a78fb0ede785ed (diff)
downloadscintilla-mirror-c06e1e893caa023d5de09ac2364e565fad2f6139.tar.gz
Compatibility with 64 bit systems.
-rw-r--r--win32/PlatWin.cxx11
-rw-r--r--win32/ScintillaWin.cxx31
2 files changed, 32 insertions, 10 deletions
diff --git a/win32/PlatWin.cxx b/win32/PlatWin.cxx
index 709e6e480..be6c2305a 100644
--- a/win32/PlatWin.cxx
+++ b/win32/PlatWin.cxx
@@ -16,6 +16,7 @@
#include <windows.h>
#include <commctrl.h>
#include <richedit.h>
+#include <windowsx.h>
#include "Platform.h"
#include "PlatformRes.h"
@@ -769,8 +770,7 @@ ListBox::~ListBox() {
}
void ListBox::Create(Window &parent, int ctrlID) {
- HINSTANCE hinstanceParent = reinterpret_cast<HINSTANCE>(
- ::GetWindowLong(reinterpret_cast<HWND>(parent.GetID()),GWL_HINSTANCE));
+ HINSTANCE hinstanceParent = GetWindowInstance(reinterpret_cast<HWND>(parent.GetID()));
id = ::CreateWindowEx(
WS_EX_WINDOWEDGE, "listbox", "",
WS_CHILD | WS_THICKFRAME | WS_VSCROLL | LBS_NOTIFY,
@@ -816,7 +816,7 @@ void ListBox::Clear() {
void ListBox::Append(char *s) {
Window_SendMessage(this, LB_ADDSTRING, 0, reinterpret_cast<LPARAM>(s));
- size_t len = strlen(s);
+ unsigned int len = static_cast<unsigned int>(strlen(s));
if (maxItemCharacters < len)
maxItemCharacters = len;
}
@@ -959,6 +959,11 @@ long Platform::SendScintilla(WindowID w, unsigned int msg, unsigned long wParam,
return ::SendMessage(reinterpret_cast<HWND>(w), msg, wParam, lParam);
}
+long Platform::SendScintillaPointer(WindowID w, unsigned int msg, unsigned long wParam, void *lParam) {
+ return ::SendMessage(reinterpret_cast<HWND>(w), msg, wParam,
+ reinterpret_cast<LPARAM>(lParam));
+}
+
bool Platform::IsDBCSLeadByte(int codePage, char ch) {
return ::IsDBCSLeadByteEx(codePage, ch) != 0;
}
diff --git a/win32/ScintillaWin.cxx b/win32/ScintillaWin.cxx
index bad4758fe..e93d6ef4b 100644
--- a/win32/ScintillaWin.cxx
+++ b/win32/ScintillaWin.cxx
@@ -16,6 +16,7 @@
#include <windows.h>
#include <commctrl.h>
#include <richedit.h>
+#include <windowsx.h>
#include "Platform.h"
@@ -1060,7 +1061,7 @@ void ScintillaWin::CreateCallTipWindow(PRectangle) {
ct.wCallTip = ::CreateWindow(callClassName, "ACallTip",
WS_VISIBLE | WS_CHILD, 100, 100, 150, 20,
MainHWND(), reinterpret_cast<HMENU>(idCallTip),
- reinterpret_cast<HINSTANCE>(::GetWindowLong(MainHWND(),GWL_HINSTANCE)),
+ GetWindowInstance(MainHWND()),
&ct);
ct.wDraw = ct.wCallTip;
#endif
@@ -1461,7 +1462,7 @@ void ScintillaWin::AddCharBytes(char b0, char b1) {
dbcsChars[0] = b0;
dbcsChars[1] = b1;
dbcsChars[2] = '\0';
- AddCharUTF(dbcsChars, strlen(dbcsChars), true);
+ AddCharUTF(dbcsChars, 2, true);
} else {
AddChar(b0);
}
@@ -1877,18 +1878,34 @@ bool ScintillaWin::Unregister() {
return result;
}
+// Take care of 32/64 bit pointers
+#ifdef GetWindowLongPtr
+static void *PointerFromWindow(HWND hWnd) {
+ return reinterpret_cast<void *>(::GetWindowLongPtr(hWnd, 0));
+}
+static void SetWindowPointer(HWND hWnd, void *ptr) {
+ ::SetWindowLongPtr(hWnd, 0, reinterpret_cast<LONG_PTR>(ptr));
+}
+#else
+static void *PointerFromWindow(HWND hWnd) {
+ return reinterpret_cast<void *>(::GetWindowLong(hWnd, 0));
+}
+static void SetWindowPointer(HWND hWnd, void *ptr) {
+ ::SetWindowLong(hWnd, 0, reinterpret_cast<LONG>(ptr));
+}
+#endif
+
sptr_t PASCAL ScintillaWin::CTWndProc(
HWND hWnd, UINT iMessage, WPARAM wParam, sptr_t lParam) {
// Find C++ object associated with window.
- CallTip *ctp = reinterpret_cast<CallTip *>(GetWindowLong(hWnd, 0));
+ CallTip *ctp = reinterpret_cast<CallTip *>(PointerFromWindow(hWnd));
// ctp will be zero if WM_CREATE not seen yet
if (ctp == 0) {
if (iMessage == WM_CREATE) {
// Associate CallTip object with window
CREATESTRUCT *pCreate = reinterpret_cast<CREATESTRUCT *>(lParam);
- ::SetWindowLong(hWnd, 0,
- reinterpret_cast<LONG>(pCreate->lpCreateParams));
+ SetWindowPointer(hWnd, pCreate->lpCreateParams);
return 0;
} else {
return ::DefWindowProc(hWnd, iMessage, wParam, lParam);
@@ -1923,13 +1940,13 @@ sptr_t PASCAL ScintillaWin::SWndProc(
//Platform::DebugPrintf("S W:%x M:%x WP:%x L:%x\n", hWnd, iMessage, wParam, lParam);
// Find C++ object associated with window.
- ScintillaWin *sci = reinterpret_cast<ScintillaWin *>(::GetWindowLong(hWnd, 0));
+ ScintillaWin *sci = reinterpret_cast<ScintillaWin *>(PointerFromWindow(hWnd));
// sci will be zero if WM_CREATE not seen yet
if (sci == 0) {
if (iMessage == WM_CREATE) {
// Create C++ object associated with window
sci = new ScintillaWin(hWnd);
- ::SetWindowLong(hWnd, 0, reinterpret_cast<LONG>(sci));
+ SetWindowPointer(hWnd, sci);
return sci->WndProc(iMessage, wParam, lParam);
} else {
return ::DefWindowProc(hWnd, iMessage, wParam, lParam);