Skip to content

Commit

Permalink
[TouchKeyboard] Use current process ID
Browse files Browse the repository at this point in the history
  • Loading branch information
wqweto committed Oct 3, 2019
1 parent 9c8c77c commit b5023fe
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
6 changes: 3 additions & 3 deletions contrib/TouchKeyboard/src/ctxTouchButton.ctl
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ Private Declare Function ApiUpdateWindow Lib "user32" Alias "UpdateWindow" (ByVa
Private Declare Function GetEnvironmentVariable Lib "kernel32" Alias "GetEnvironmentVariableA" (ByVal lpName As String, ByVal lpBuffer As String, ByVal nSize As Long) As Long
Private Declare Function SetEnvironmentVariable Lib "kernel32" Alias "SetEnvironmentVariableA" (ByVal lpName As String, ByVal lpValue As String) As Long
Private Declare Function AlphaBlend Lib "msimg32" (ByVal hDestDC As Long, ByVal lX As Long, ByVal lY As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal widthSrc As Long, ByVal heightSrc As Long, ByVal blendFunct As Long) As Boolean
Private Declare Function GetCurrentProcessId Lib "kernel32" () As Long
'--- gdi+
Private Declare Function GdiplusStartup Lib "gdiplus" (hToken As Long, pInputBuf As Any, Optional ByVal pOutputBuf As Long = 0) As Long
Private Declare Function GdipCreateBitmapFromScan0 Lib "gdiplus" (ByVal lWidth As Long, ByVal lHeight As Long, ByVal lStride As Long, ByVal lPixelFormat As Long, ByVal Scan0 As Long, hBitmap As Long) As Long
Expand Down Expand Up @@ -137,7 +138,6 @@ Private Declare Function GdipBitmapUnlockBits Lib "gdiplus" (ByVal hBitmap As Lo
#If Not ImplNoIdeProtection Then
Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWndParent As Long, ByVal hWndChildAfter As Long, ByVal lpszClass As String, ByVal lpszWindow As String) As Long
Private Declare Function GetWindowThreadProcessId Lib "user32" (ByVal hWnd As Long, lpdwProcessId As Long) As Long
Private Declare Function GetCurrentProcessId Lib "kernel32" () As Long
#End If
#If Not ImplUseShared Then
Private Declare Function QueryPerformanceCounter Lib "kernel32" (lpPerformanceCount As Currency) As Long
Expand Down Expand Up @@ -1669,12 +1669,12 @@ Private Property Get pvThunkGlobalData(sKey As String) As Long
Dim sBuffer As String

sBuffer = String$(50, 0)
Call GetEnvironmentVariable("_MST_GLOBAL" & App.hInstance & "_" & sKey, sBuffer, Len(sBuffer) - 1)
Call GetEnvironmentVariable("_MST_GLOBAL" & GetCurrentProcessId() & "_" & sKey, sBuffer, Len(sBuffer) - 1)
pvThunkGlobalData = Val(Left$(sBuffer, InStr(sBuffer, vbNullChar) - 1))
End Property

Private Property Let pvThunkGlobalData(sKey As String, ByVal lValue As Long)
Call SetEnvironmentVariable("_MST_GLOBAL" & App.hInstance & "_" & sKey, lValue)
Call SetEnvironmentVariable("_MST_GLOBAL" & GetCurrentProcessId() & "_" & sKey, lValue)
End Property
#End If

Expand Down
10 changes: 5 additions & 5 deletions contrib/TouchKeyboard/src/ctxTouchKeyboard.ctl
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ Private Declare Function GetModuleHandle Lib "kernel32" Alias "GetModuleHandleA"
Private Declare Function SystemParametersInfo Lib "user32" Alias "SystemParametersInfoA" (ByVal uAction As Long, ByVal uParam As Long, ByRef lpvParam As Any, ByVal fuWinIni As Long) As Long
Private Declare Function GetEnvironmentVariable Lib "kernel32" Alias "GetEnvironmentVariableA" (ByVal lpName As String, ByVal lpBuffer As String, ByVal nSize As Long) As Long
Private Declare Function SetEnvironmentVariable Lib "kernel32" Alias "SetEnvironmentVariableA" (ByVal lpName As String, ByVal lpValue As String) As Long
Private Declare Function GetCurrentProcessId Lib "kernel32" () As Long
'--- gdi+
Private Declare Function GdiplusStartup Lib "gdiplus" (hToken As Long, pInputBuf As Any, Optional ByVal pOutputBuf As Long = 0) As Long
Private Declare Function GdipDeleteGraphics Lib "gdiplus" (ByVal hGraphics As Long) As Long
Expand All @@ -110,7 +111,6 @@ Private Declare Function GdipDrawString Lib "gdiplus" (ByVal hGraphics As Long,
#If Not ImplNoIdeProtection Then
Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWndParent As Long, ByVal hWndChildAfter As Long, ByVal lpszClass As String, ByVal lpszWindow As String) As Long
Private Declare Function GetWindowThreadProcessId Lib "user32" (ByVal hWnd As Long, lpdwProcessId As Long) As Long
Private Declare Function GetCurrentProcessId Lib "kernel32" () As Long
#End If
#If Not ImplUseShared Then
'--- for thunks
Expand Down Expand Up @@ -320,12 +320,12 @@ Private Property Get pvNppGlobalData(sKey As String) As Long
Dim sBuffer As String

sBuffer = String$(50, 0)
Call GetEnvironmentVariable("_NPP_GLOBAL" & App.hInstance & "_" & sKey, sBuffer, Len(sBuffer) - 1)
Call GetEnvironmentVariable("_NPP_GLOBAL" & GetCurrentProcessId() & "_" & sKey, sBuffer, Len(sBuffer) - 1)
pvNppGlobalData = Val(Left$(sBuffer, InStr(sBuffer, vbNullChar) - 1))
End Property

Private Property Let pvNppGlobalData(sKey As String, ByVal lValue As Long)
Call SetEnvironmentVariable("_NPP_GLOBAL" & App.hInstance & "_" & sKey, lValue)
Call SetEnvironmentVariable("_NPP_GLOBAL" & GetCurrentProcessId() & "_" & sKey, lValue)
End Property

'=========================================================================
Expand Down Expand Up @@ -858,12 +858,12 @@ Private Property Get pvThunkGlobalData(sKey As String) As Long
Dim sBuffer As String

sBuffer = String$(50, 0)
Call GetEnvironmentVariable("_MST_GLOBAL" & App.hInstance & "_" & sKey, sBuffer, Len(sBuffer) - 1)
Call GetEnvironmentVariable("_MST_GLOBAL" & GetCurrentProcessId() & "_" & sKey, sBuffer, Len(sBuffer) - 1)
pvThunkGlobalData = Val(Left$(sBuffer, InStr(sBuffer, vbNullChar) - 1))
End Property

Private Property Let pvThunkGlobalData(sKey As String, ByVal lValue As Long)
Call SetEnvironmentVariable("_MST_GLOBAL" & App.hInstance & "_" & sKey, lValue)
Call SetEnvironmentVariable("_MST_GLOBAL" & GetCurrentProcessId() & "_" & sKey, lValue)
End Property
#End If ' Not ImplUseShared

Expand Down
1 change: 0 additions & 1 deletion contrib/TouchKeyboard/test/Project1.vbp
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
Type=Exe
Reference=*\G{00020430-0000-0000-C000-000000000046}#2.0#0#..\..\..\..\..\..\Windows\SysWOW64\stdole2.tlb#OLE Automation
Reference=*\G{B64B59AE-8789-49B7-9BA9-0453819E63CA}#1.0#0#..\..\..\..\..\Dreem\1.5\Binn\UcsDsQuery.tlb#Unicontsoft Active Directory Query Type Library 1.0
Class=cNinePatch; ..\..\..\src\cNinePatch.cls
Module=mdTouchKeyboard; ..\src\mdTouchKeyboard.bas
UserControl=..\src\ctxTouchKeyboard.ctl
Expand Down

0 comments on commit b5023fe

Please sign in to comment.