You are not logged in. You can browse in the PowerBASIC Community, but you must click Login (top right) before you can post. If this is your first visit, check out the FAQ or Sign Up.
Announcement
Collapse
No announcement yet.
Howto change the default buttons/icons in system menu?
Howto change the default buttons/icons in system menu?
Howto change the default buttons/icons in system menu?
I want to change %SC_MINIMIZE, %SC_MAXIMIZE etc.. with own icon or bmp recource.
How it to make?
Thanks.
[B]dwItemData[/B]
Application-defined value associated with the menu item.
[B]dwTypeData[/B]
Content of the menu item. The meaning of this member depends on the menu item type: the MFT_BITMAP, MFT_SEPARATOR, or MFT_STRING values.
.dwItemData - does not work too...
Code:
DIM mnuItemInfo AS MENUITEMINFO
hItemBmp& = loadicon(0, "MyClose")
mnuItemInfo.cbSize = LEN(mnuItemInfo)
mnuItemInfo.fMask = %MIIM_TYPE OR %MIIM_ID OR %MIIM_DATA
mnuItemInfo.fType = %MFT_BITMAP
mnuItemInfo.dwTypeData = VARPTR(hItemBmp&)
mnuItemInfo.dwItemData = hItemBmp&
SysMenu& = GetSystemMenu (MyDialog, %FALSE)
SetMenuItemInfo SysMenu&, %SC_CLOSE, %TRUE, mnuItemInfo
fMask
Members to retrieve or set. This member can be one or more of these values.
MIIM_BITMAP
Microsoft® Windows® 98/Windows Millennium Edition (Windows Me), Windows 2000/Windows XP: Retrieves or sets the hbmpItem member
.....
hbmpItem
Windows 98/Me, Windows 2000/XP: Handle to the bitmap to be displayed, or it can be one of the values in the following table. It is used when the MIIM_BITMAP flag is set in the fMask member.
At this point, you are going to have to show what you've tried so far.
If the program is "too big to post" then you need to create a small compilable example.
I think you are using the wrong fmask and hBmpItem in the MENUITEMINFO structure. But I have no way of knowing if you've tried what I think would be correct.
And if you can't find the documentation on this from the link provided, the correct solution for your application is, "the standard bitmaps will be just fine."
#include <resource.h>
CLOSE16 BITMAP CLOSE16.BMP // 16 x 16 x 8bpp
CLOSE24 BITMAP CLOSE24.BMP // 24 x 24 x 8bpp
CLOSE32 BITMAP CLOSE32.BMP // 32 x 32 x 8bpp
CLOSE48 BITMAP CLOSE48.BMP // 48 x 48 x 8bpp
//-----------------------------------------------------------------------------
// ** Version Info **
//-----------------------------------------------------------------------------
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,0,0,0
PRODUCTVERSION 1,0,0,0
FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
FILEFLAGS 0x0
FILEOS VOS_WINDOWS32
FILETYPE VFT_APP
FILESUBTYPE VFT2_UNKNOWN
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "00000000"
BEGIN
VALUE "FileDescription", "Test\0"
VALUE "FileVersion", "1.0.0.0\0"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x0, 0
END
END
//-----------------------------------------------------------------------------
EXE (SYSMENU_CHANGE.BAS)
Code:
#COMPILE EXE
#RESOURCE "sysmenu_change.PBR"
#INCLUDE "WIN32API.INC"
GLOBAL ghInst AS LONG
FUNCTION PBMAIN () AS LONG
LOCAL MyDialog AS LONG
DIM mnuItemInfo AS MENUITEMINFO
ghInst = GetModuleHandle("SYSMENU_CHANGE.EXE")
DIALOG NEW 0, "Test", , , 400, 200, %WS_SYSMENU TO MyDialog
hItemBmp& = loadbitmap(0, "CLOSE24") ' loadbitmap(ghInst, "CLOSE24")
mnuItemInfo.cbSize = LEN(mnuItemInfo)
mnuItemInfo.fMask = %MIIM_TYPE' OR %MIIM_DATA OR %MIIM_ID
mnuItemInfo.fType = %MFT_BITMAP
mnuItemInfo.dwTypeData = VARPTR(hItemBmp&)
' mnuItemInfo.dwItemData = hItemBmp&
mnuItemInfo.hbmpItem = hItemBmp&
SysMenu& = GetSystemMenu (MyDialog, %FALSE)
SetMenuItemInfo SysMenu&, %SC_CLOSE, %TRUE, mnuItemInfo
' ModifyMenu SysMenu&, %SC_CLOSE, %MF_BYCOMMAND, mnuItemInfo.hbmpItem, BYVAL %MF_BITMAP [COLOR="Red"]<= program crash!??
[/COLOR]
DIALOG SHOW MODAL MyDialog
END FUNCTION
I will be greatful if there is anybody who can help me.
Thanks.
#COMPILE EXE
#RESOURCE "sysmenu_change.PBR"
#INCLUDE "WIN32API.INC"
%ID_ABOUT = 1000
GLOBAL ghInst AS LONG
FUNCTION PBMAIN () AS LONG
LOCAL MyDialog AS LONG
DIM mnuItemInfo AS MENUITEMINFO
ghInst = GetModuleHandle("SYSMENU_CHANGE.EXE")
DIALOG NEW 0, "Test", , , 400, 200, %WS_OVERLAPPEDWINDOW OR %WS_CAPTION OR %WS_DLGFRAME OR %WS_OVERLAPPED TO MyDialog
hItemBmp& = LoadBitmap(ghInst, "[COLOR="Red"]CLOSE16[/COLOR]") '<= from sysmenu_change.PBR
mnuItemInfo.cbSize = SIZEOF(mnuItemInfo)
mnuItemInfo.fMask = %MIIM_BITMAP
mnuItemInfo.hbmpItem = hItemBmp&
SysMenu& = GetSystemMenu (MyDialog, %FALSE)
SetMenuItemInfo SysMenu&, %SC_CLOSE , %FALSE, BYVAL VARPTR(mnuItemInfo)
DIALOG SHOW MODAL MyDialog
END FUNCTION
Alexander,
Although MCM was only making a point of "We can not help, if we can't see the problem". I noticed a few small points overlooked (I missed them too till I decided to toss you a bone and realized these points)
1) Where can i to update a file Win32 SDK Reference Help? (I have at 26.11.1996)
2) I needed a working code example, please!?
Thanks
Often overlooked...Even by me....(and god knows why? ) but the Downloads section of PB WinApi Help Files
Working code? I see Dominic beat me to it, so I won't bother with that part.
I see MCM's point, too often I see posts for snippets, and there is no evidence of the user even attempting to find the answer. (I am guilty of this myself, but learning) and often when trying to make a small sample with the same problem, I often trip into the "mistake" that I made, and answered my own question.
Anyways, now you got the Win32 help files, you will be AMAZED the power you have (once you get grips on the concept you are researching)
Engineer's Motto: If it aint broke take it apart and fix it
"If at 1st you don't succeed... call it version 1.0"
"Half of Programming is coding"....."The other 90% is DEBUGGING"
"Document my code????" .... "WHYYY??? do you think they call it CODE? "
We process personal data about users of our site, through the use of cookies and other technologies, to deliver our services, and to analyze site activity. For additional details, refer to our Privacy Policy.
By clicking "I AGREE" below, you agree to our Privacy Policy and our personal data processing and cookie practices as described therein. You also acknowledge that this forum may be hosted outside your country and you consent to the collection, storage, and processing of your data in the country where this forum is hosted.
Comment