[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: LOGO-L> dll question



Hello Erich

At 11:01 29.9.1998 +0100, neuwirth wrote:
>i want to give the graphics window a caption of my choice
>(instead of MSWLogo)
>and i want to be able to hide the menu line in the graphics window.

To set a menu, you have to use the API call SetMenu, where if you put 0 for
hMenu, then no menu should be shown.
There is also a comment in the manual:
"The SetMenu function replaces the previous menu, if any, but it does not
destroy it. An application should call the DestroyMenu function to
accomplish this task."
So you have either to destroy the menu or to store its handle for future
use (e.g. to set it back). The handle can be retrieved using GetMenu call.
The caption of a window can be changed sending WM_SETTEXT message to the
window (code 12).

Here are some MSWLogo procedures:

to DestroyMenu :m
  dllload "user32.dll
  localmake "status dllcall (list "w "DestroyMenu "l :m)
  dllfree
end

to setmenu :windowName :m
  dllload "user32.dll
  localmake "hwnd dllcall (list "l "FindWindowA "s :windowName "l 0)
  ifelse :hwnd = 0 [localmake "oldmenu 0] [
     localmake "oldmenu dllcall (list "l "GetMenu "l :hwnd)
     localmake "status dllcall (list "w "SetMenu "l :m "l :hwnd)]
  dllfree
  output :oldmenu
end

to setname :windowName :newName
  dllload "user32.dll
  localmake "hwnd dllcall (list "l "FindWindowA "s :windowName "l 0)
  localmake "status dllcall (list "l "SendMessageA "s :newName "l 0 "l 12
"l :hwnd)
  dllfree
end

To make delete the menu forever:
DestroyMenu SetMenu [MSWLogo Screen] 0

To set the menu to empty and then restoring it back:
Make "OldMenu SetMenu [MSWLogo Screen] 0
; some code here
ignore SetMenu [MSWLogo Screen] :oldmenu

to change the window's name:
SetName [MSWLogo Screen] [My name]

NOTE: I noticed that under some circumstanced (e.g. after executing EDALL)
the caption of main window returns back to MSWLogo Screen. I do not think
that this is a general Windows behavior, so we have to ask George Mills if
his code sets sometimes the caption of the main window back to its original
name.


Regards

Peter Tomcsanyi

My favourite Logo:
http://www.logo.com/catalogue/titles/superlogo/index.html
http://www.edi.fmph.uniba.sk/logo/

---------------------------------------------------------------
Please post messages to the Logo forum to logo-l@gsn.org.  Mail
questions about the list administration to logofdn@gsn.org.  To
unsubscribe send    unsubscribe logo-l    to majordomo@gsn.org.



Global SchoolNet Foundation - Linking Kids Around the World!
Copyright GSN - All Rights Reserved - Comments & Questions
Visit GSN's Global Schoolhouse for more exciting learning resources!
Search our Site - Home