IonicWind Software

IWBasic => The Roundtable => Topic started by: sapero on November 14, 2008, 09:45:19 AM

Title: Office menu v2
Post by: sapero on November 14, 2008, 09:45:19 AM
latest version link (http://www.ionicwind.com/forums/index.php/topic,2914.msg24202.html#msg24202)

This is converted version from Aurora forum, with small addition that allowed me to handle three different menus: system, window and context menu.
In this example the system menu and window menu are styled.

I have added four properties to main window:
"WindowMenu" - holds pointer to COfficeMenuBase class with window menu attached
"SystemMenu" - same, for system menu
"ContextMenu" - same, for context menu
"CurrentMenu" - currently active menu (window menu by default).

CurrentMenu switching is done internally, you need only to initialize properties - see in sub main()

Please update your includes before compiling - two fixed gdiplus headers are in "include update" subfolder.

todo's:
Menu bitmaps are still not correctly handled.
Some items from system menu (minimize, maximize and close) are not resized (no message received). I think I need to delete and insert these items to get it working.


EDIT: in main.eba, please find line with PostQuitMessage, and replace (whole line) with$ifndef USE_EBASIC_WINDOW
PostQuitMessage(0)
$endif

Please also replace WM_CONTEXTMENU with WM_RBUTTONUP, or at least forward this message to default handler, because the system menu may not appear when clicking on window caption.
Title: Re: Office menu v2
Post by: gjaking on November 14, 2008, 10:00:00 AM
1000 thanks sapero  ;)
this is a great work !!!  :P

Title: Re: Office menu v2
Post by: Rock Ridge Farm (Larry) on November 14, 2008, 11:47:36 AM
I am running a complete new install on a new computer.
I am missing windowssdk.inc - where should I look to get this file?
Title: Re: Office menu v2
Post by: sapero on November 14, 2008, 12:02:41 PM
On the Ionic Wind homepage in downloads section, or click the link my sig and choose rapidshare or sendspace.
If you choose rapidshare, you'll give me a thankyou-point for your download. For 10k points I can become one month of premium account for free.
Title: Re: Office menu v2
Post by: sapero on November 14, 2008, 04:57:14 PM
I have attached second (really it is the third) release. Fixed system menu, added context menu. Added also code for the context menu handler to change active menu (sub DlgProc, WM_RBUTTONUP).

Major change in HandleMessage method - none from WM_NC* messages is blocking. Added handler for WM_UNINITMENUPOPUP to detect when the system menu is closing.
All items from system menu are resized now - a 'remove and insert item' was neccesary.
Bitmaps are now supported - by handle, or one based index.
Added not working Detach method :) I think nobody will need to detach styles, so this method could be removed. Or?
Title: Re: Office menu v2
Post by: pistol350 on November 14, 2008, 05:26:56 PM
Hi sapero.

In which step of using rapidshare can one give a thankyou point ?
I tried redownload the paks but did not see any additional options that lead to give credit to the uploader.
Title: Re: Office menu v2
Post by: sapero on November 15, 2008, 03:00:47 AM
Quote from faq: You get a RapidPoint for each download, provided that the file is bigger than 5 megabyte and the user has not generated more than 3 RapidPoints in the last hour.
Title: Re: Office menu v2
Post by: Rock Ridge Farm (Larry) on November 15, 2008, 05:12:01 AM
I still can not get this to compile on a new laptop with vista.
It has issues with the local include files.
Title: Re: Office menu v2
Post by: sapero on November 15, 2008, 07:24:05 AM
Larry, what errors do you have?
Title: Re: Office menu v2
Post by: Rock Ridge Farm (Larry) on November 15, 2008, 04:52:36 PM
Compiling...
main
File: C:\Users\lsikes\Desktop\ebrad\main.eba (28) Warning: Uninitialized variable: mmenu
File: C:\Users\lsikes\Desktop\ebrad\main.eba (29) Warning: Uninitialized variable: sysmenu
File: C:\Users\lsikes\Desktop\ebrad\main.eba (30) Warning: Uninitialized variable: ctxmenu
File: C:\Users\lsikes\Desktop\ebrad\main.eba (51) undefined variable - menu - )
File: C:\Users\lsikes\Desktop\ebrad\main.eba (51) Invalid & operation - )
File: C:\Users\lsikes\Desktop\ebrad\main.eba (54) undefined variable - menu - )
File: C:\Users\lsikes\Desktop\ebrad\main.eba (54) Invalid & operation - )
File: C:\Users\lsikes\Desktop\ebrad\main.eba (59) undefined variable - menu
File: C:\Users\lsikes\Desktop\ebrad\main.eba (59) unknown class
File: C:\Users\lsikes\Desktop\ebrad\main.eba (60) undefined variable - menu
File: C:\Users\lsikes\Desktop\ebrad\main.eba (60) unknown class
File: C:\Users\lsikes\Desktop\ebrad\main.eba (62) undefined variable - menu
File: C:\Users\lsikes\Desktop\ebrad\main.eba (62) invalid use of dot operator, unknown type
File: C:\Users\lsikes\Desktop\ebrad\main.eba (70) undefined variable - menu - )
File: C:\Users\lsikes\Desktop\ebrad\main.eba (70) invalid use of dot operator, unknown type - )
File: C:\Users\lsikes\Desktop\ebrad\main.eba (73) undefined variable - menu - )
File: C:\Users\lsikes\Desktop\ebrad\main.eba (73) invalid use of dot operator, unknown type - )
File: C:\Users\lsikes\Desktop\ebrad\main.eba (192) Warning: Uninitialized variable: img
Error(s) in compiling C:\Users\lsikes\Desktop\ebrad\main.eba
Title: Re: Office menu v2
Post by: Rock Ridge Farm (Larry) on November 15, 2008, 05:02:26 PM
I downloaded the latest version - now it compiles with the following warnings
Compiling Resources...
No Errors

Compiling...
main
File: C:\Users\lsikes\Desktop\ebrad\main.eba (28) Warning: Uninitialized variable: wndmenu
File: C:\Users\lsikes\Desktop\ebrad\main.eba (29) Warning: Uninitialized variable: sysmenu
File: C:\Users\lsikes\Desktop\ebrad\main.eba (30) Warning: Uninitialized variable: ctxmenu
File: C:\Users\lsikes\Desktop\ebrad\main.eba (222) Warning: Uninitialized variable: img
OfficeMenu

Linking...
Emergence Linker v1.11 Copyright ÂÃ,© 2006 Ionic Wind Software
Generating OfficeMenu.exe
Build completed

When executed it crashes - I am running this on Vista Home.
Title: Re: Office menu v2
Post by: Rock Ridge Farm (Larry) on November 15, 2008, 05:05:43 PM
The debug data from the crash:
Starting debug session...
Loading DLL: ntdll.dll
Loading DLL: C:\Windows\system32\kernel32.dll
Loading DLL: C:\Windows\system32\GDI32.DLL
Loading DLL: C:\Windows\system32\USER32.dll
Loading DLL: C:\Windows\system32\ADVAPI32.dll
Loading DLL: C:\Windows\system32\RPCRT4.dll
Loading DLL: C:\Windows\system32\OLE32.DLL
Loading DLL: C:\Windows\system32\msvcrt.dll
Loading DLL: C:\Windows\WinSxS\x86_microsoft.windows.gdiplus_6595b64144ccf1dfw
Loading DLL: C:\Windows\system32\MSIMG32.DLL
Loading DLL: C:\Windows\system32\CRTDLL.DLL
Loading DLL: C:\Windows\system32\IMM32.DLL
Loading DLL: C:\Windows\system32\MSCTF.dll
Loading DLL: C:\Windows\system32\LPK.DLL
Loading DLL: C:\Windows\system32\USP10.dll
Loading DLL: C:\Windows\system32\avgrsstx.dll
Loading DLL: C:\Windows\system32\uxtheme.dll
Loading DLL: C:\Program Files\McAfee\SiteAdvisor\saHook.dll
First chance exception: Address 0x4D525453 Access Violation.
Final chance exception: Address 0x4D525453 Access Violation.

Call stack:
<unknown>! <missing symbols>
<unknown>! <missing symbols>
OfficeMenu! <missing symbols>
OfficeMenu! <missing symbols>
OfficeMenu! <missing symbols>
<unknown>! <missing symbols>
<unknown>! <missing symbols>
<unknown>! <missing symbols>

Title: Re: Office menu v2
Post by: sapero on November 15, 2008, 05:55:21 PM
0x4D525453 must be inside gdiplus module. If you debug it in real debugger, you'll see"return to gdiplus" in call-stack window.
Did you updated included two gdi+ headers ? You need to replace two files in include directory.
You can also update the code in main.eba by adding "+0" to three variables:
GdipLoadImageFromStream(stream +0, &img)
GdipCreateHBITMAPFromBitmap(img +0, &bitmap, 0)
GdipDisposeImage(img +0)
Title: Re: Office menu v2
Post by: sapero on November 16, 2008, 07:22:44 AM
I have finished it.
If an item is disabled, its bitmap will be grayed. The way you assign image index to menu item has changed - image (by index) is extracted and assigned to menu item as checkmarks.
Please remember to call SetActiveMenu before displaying context menu. It may be automated only if you ensure different menu item id's for context menu and the window menu.
Title: Re: Office menu v2
Post by: Rock Ridge Farm (Larry) on November 16, 2008, 04:14:20 PM
Downloaded the latest - it compiles and runs.
I do get the warnings at compile:
Compiling Resources...
No Errors

Compiling...
main
File: C:\Users\lsikes\Desktop\ebrad\main.eba (61) Warning: Uninitialized variable: wndmenu
File: C:\Users\lsikes\Desktop\ebrad\main.eba (62) Warning: Uninitialized variable: sysmenu
File: C:\Users\lsikes\Desktop\ebrad\main.eba (63) Warning: Uninitialized variable: ctxmenu
OfficeMenu
png

Linking...
Emergence Linker v1.11 Copyright ÂÃ,© 2006 Ionic Wind Software
Generating OfficeMenu.exe
Build completed