WinWorkstation.st
changeset 7598 fa0cfb5cedc1
parent 7509 d18f375ac80d
child 7600 8b42a8f0f649
child 7601 32eb7cdadd8a
--- a/WinWorkstation.st	Fri Oct 07 10:15:10 2016 +0200
+++ b/WinWorkstation.st	Fri Oct 07 16:58:05 2016 +0200
@@ -1,5 +1,3 @@
-"{ Encoding: utf8 }"
-
 "
 COPYRIGHT (c) 1996 by Claus Gittinger
 	      All Rights Reserved
@@ -2076,7 +2074,7 @@
 		    }
 		    goto again;
 		}
-		/* fail evtl. später ändern und in st verzögert aufrufen
+		/* fail evtl. später ändern und in st verzögert aufrufen
 		*/
 		console_fprintf(stderr, "WinWorkstation [info]: UnregisterClass %s failed.\n",(char*)ev->ev_arg1);
 	    }
@@ -17611,15 +17609,15 @@
     "If the function succeeds, the return value is a handle to the window that has the specified class name
      and window name. If the function fails, the return value is NULL."
 
-    ((lpClassName notNil and:[lpClassName bitsPerCharacter > 8])
-    or:[ (lpWindowName notNil and:[lpWindowName bitsPerCharacter > 8]) ]) ifTrue:[
-	^ self
-	    primFindWindowW:(lpClassName isNil
-				    ifTrue:[nil]
-				    ifFalse:[lpClassName asUnicode16String asAsciiZ])
-	    windowName:(lpWindowName isNil
-				    ifTrue:[nil]
-				    ifFalse:[lpWindowName asUnicode16String asAsciiZ])
+    ((lpClassName notNil and:[lpClassName isWideString])
+     or:[lpWindowName notNil and:[lpWindowName isWideString]]) ifTrue:[
+        ^ self
+            primFindWindowW:(lpClassName isNil
+                                    ifTrue:[nil]
+                                    ifFalse:[lpClassName asUnicode16StringZ])
+            windowName:(lpWindowName isNil
+                                    ifTrue:[nil]
+                                    ifFalse:[lpWindowName asUnicode16StringZ])
     ].
     ^ self primFindWindowA:lpClassName windowName:lpWindowName
 
@@ -18121,7 +18119,7 @@
     <apicall: handle "FindWindowA" (lpstr lpstr) module: "user32.dll" >
 
     "
-     self primFindWindow: nil windowName: 'WORK2 ST/X Launcher [FELIXM]'
+     Display primFindWindowA: nil windowName: 'ST/X Launcher'
     "
 !
 
@@ -18129,10 +18127,10 @@
     "If the function succeeds, the return value is a handle to the window that has the specified
      class name and window name. If the function fails, the return value is NULL."
 
-    <apicall: handle "FindWindowW" (lpstr lpstr) module: "user32.dll" >
-
-    "
-     self primFindWindow: nil windowName: 'WORK2 ST/X Launcher [FELIXM]' asAsciiZ
+    <apicall: handle "FindWindowW" (pointer pointer) module: "user32.dll" >
+
+    "
+     Display primFindWindowW: nil windowName: 'ST/X Launcher' asUnicode16String 
     "
 !
 
@@ -18159,7 +18157,7 @@
      The SendMessage function calls the window procedure for the specified window and
      does not return until the target's window procedure has processed the message."
 
-    <apicall: bool "SendMessageA" (handle uint ulong ulong) module: "user32.dll" >
+    <apicall: bool "SendMessageA" (handle uint pointer pointer) module: "user32.dll" >
 !
 
 primSetForegroundWindow: aWindowId
@@ -18495,29 +18493,25 @@
 sendCopyData: aByteArray toWindowId: aWindowId
     "send copy-paste data to a window by id (handle)"
 
-    |externalBytes messageType wParam lParam copyDataStruct result|
+    |externalBytes messageType lParam copyDataStruct|
 
     (aWindowId isNil or:[aWindowId address == 0]) ifTrue:[^ self].
 
     messageType := 74 "WM_COPYDATA".
-    wParam := 0.
-
+
+    externalBytes := aByteArray asExternalBytesUnprotected.
     copyDataStruct := CopyDataStructStructure new.
-    copyDataStruct cbData:aByteArray size.
-    externalBytes := ExternalBytes from:aByteArray.
-    copyDataStruct lpData:externalBytes address.
-    lParam := ExternalBytes from:copyDataStruct.
-    result := self primSendMessage:aWindowId message:messageType wParam:wParam lParam:lParam address.
-    externalBytes free.
-    lParam free.
-    ^ result
-
-    "
-     |string bytes externalAddress handle|
-
-     string := 'c:\pipo.net' , 0 asCharacter asString.
-     bytes := string asByteArray.
-     handle := Display primFindWindow: nil windowName: 'ST/X Launcher [FELIXM]' asAsciiZ.
+    copyDataStruct 
+        cbData:externalBytes size;
+        lpData:externalBytes address.
+    lParam := copyDataStruct asExternalBytesUnprotected.
+    ^ self primSendMessage:aWindowId message:messageType wParam:nil lParam:lParam.
+
+    "
+     |bytes externalAddress handle|
+
+     bytes := 'c:\pipo.net' asByteArray.
+     handle := Display primFindWindowA: nil windowName: 'ST/X Launcher'.
      (handle isNil or:[handle address == 0]) ifTrue:[self halt.].
      externalAddress := handle asExternalAddress.
      Display setForegroundWindow: externalAddress.
@@ -18535,13 +18529,12 @@
     self sendCopyData: aByteArray toWindowId: aWindowId
 
     "
-     |string externalAddress handle|
-     string := 'c:\pipo.net' , 0 asCharacter asString.
-     handle := Display primFindWindow: nil windowName: 'WORK6 ST/X Launcher [FELIXM]' asAsciiZ.
+     |externalAddress handle|
+     handle := Display primFindWindowA: nil windowName: 'Windows-Befehlsprozessor'.
      (handle isNil or:[handle address == 0]) ifTrue:[self halt.].
      externalAddress := handle asExternalAddress.
      Display setForegroundWindow: externalAddress.
-     Display sendCopyDataString: string toWindowId: externalAddress.
+     Display sendCopyDataString: 'c:\windows\notepad.exe' toWindowId: externalAddress.
     "
 !
 
@@ -19022,7 +19015,7 @@
     }
 %}
     "
-     (StandardSystemView new label:'äöü') open
+     (StandardSystemView new label:'äöü') open
     "
 !
 
@@ -19276,7 +19269,9 @@
 !WinWorkstation::CopyDataStructStructure class methodsFor:'accessing'!
 
 sizeInBytes
-
+    ExternalAddress pointerSize == 8 ifTrue:[
+        ^ 20.
+    ].
     ^ 12
 ! !
 
@@ -19290,33 +19285,45 @@
 !WinWorkstation::CopyDataStructStructure methodsFor:'accessing'!
 
 cbData
-
-    ^ self doubleWordAt: 4 + 1
+    ExternalAddress pointerSize == 8 ifTrue:[
+        ^ self unsignedInt64At: 8 + 1.
+    ].
+    ^ self unsignedInt32At: 4 + 1.
 !
 
 cbData: cbData
-
-    ^ self doubleWordAt: 4 + 1 put: cbData
+    ExternalAddress pointerSize == 8 ifTrue:[
+        ^ self unsignedInt64At: 8 + 1  put: cbData.
+    ].
+    ^ self unsignedInt32At: 4 + 1  put: cbData.
 !
 
 dwData
-
-    ^ self doubleWordAt: 0 + 1
+    ExternalAddress pointerSize == 8 ifTrue:[
+        ^ self unsignedInt64At: 0 + 1.
+    ].
+    ^ self unsignedInt32At: 0 + 1.
 !
 
 dwData: dwData
-
-    ^ self doubleWordAt: 0 + 1 put: dwData
+    ExternalAddress pointerSize == 8 ifTrue:[
+        ^ self unsignedInt64At: 0 + 1 put:dwData.
+    ].
+    ^ self unsignedInt32At: 0 + 1 put:dwData.
 !
 
 lpData
-
-    ^ self doubleWordAt: 8 + 1
+    ExternalAddress pointerSize == 8 ifTrue:[
+        ^ self unsignedInt64At: 12 + 1.
+    ].
+    ^ self unsignedInt32At: 8 + 1.
 !
 
 lpData: lpData
-
-    ^ self doubleWordAt: 8 + 1 put: lpData
+    ExternalAddress pointerSize == 8 ifTrue:[
+        ^ self unsignedInt64At: 12 + 1  put: lpData.
+    ].
+    ^ self unsignedInt32At: 8 + 1  put: lpData.
 ! !
 
 !WinWorkstation::MonitorInfo methodsFor:'accessing'!