AsmER
Joined: 25 Mar 2006
Posts: 64
Location: England
|
I have just found something pretty strange.
When I create resources for my application, using separate section like this:
section 'rs' resource readable writeable
directory RT_MENU,menus,\
RT_DIALOG, dialogs,\
RT_ICON,icons,\
RT_GROUP_ICON,group_icons
resource menus,\
IDM_MainMenu,LANG_ENGLISH,main_menu
resource dialogs,\
IDD_Options, LANG_ENGLISH, Options_Dlg
resource icons,\
1,LANG_NEUTRAL,icon_data
resource group_icons,\
IDI_MainIcon,LANG_NEUTRAL,main_icon
menu main_menu
menuitem '&Window',0,MFR_POPUP
menuitem '&Options',IDC_Options
menuseparator
menuitem 'E&xit',IDC_Exit,MFR_END
menuitem '&About',IDC_About, MFR_END
icon main_icon,icon_data,'WMIcon.ico'
dialog Options_Dlg, 'Options', 0, 0, 300, 215, WS_VISIBLE+WS_CAPTION+DS_3DLOOK+WS_SYSMENU, WS_EX_TOPMOST+WS_EX_TOOLWINDOW
dialogitem 'LISTBOX', '', IDOC_Programs, 10, 10, 120, 80, WS_VISIBLE+LBS_NOINTEGRALHEIGHT+WS_BORDER+WS_HSCROLL+WS_VSCROLL+LBS_NOTIFY
dialogitem 'BUTTON', '',IDOC_Assign, 10, 95, 120, 15, WS_VISIBLE+BS_VCENTER
dialogitem 'LISTBOX', '', IDOC_Commands, 140, 10, 150, 80, WS_VISIBLE+LBS_NOINTEGRALHEIGHT+WS_BORDER
dialogitem 'BUTTON', 'Remove Task', IDOC_Remove, 140, 95, 150, 15, WS_VISIBLE
dialogitem 'BUTTON','NEW TASK', 0, 10, 115, 280, 5, WS_VISIBLE+BS_GROUPBOX+WS_DISABLED
dialogitem 'STATIC','', IDOC_CtrlName, 10, 130, 120, 35, WS_VISIBLE+WS_BORDER
dialogitem 'BUTTON','Find Menu', IDOC_Find, 10, 165, 120, 15, WS_VISIBLE
dialogitem 'BUTTON', 'Add Task', IDOC_Add, 140, 145, 150, 15, WS_VISIBLE
dialogitem 'BUTTON','', IDOC_Progress, 140, 165, 150, 15, WS_VISIBLE+BS_VCENTER+BS_FLAT+WS_DISABLED
dialogitem 'STATIC','Every', 1, 140, 130, 40, 15, WS_VISIBLE
dialogitem 'EDIT','',IDOC_Delay, 165, 130, 30, 10, WS_VISIBLE+ES_NUMBER+WS_BORDER
dialogitem 'STATIC','min', 0, 200, 130, 30, 10, WS_VISIBLE
dialogitem 'BUTTON','CLOSE',IDOC_Close, 130, 190, 40, 15, WS_VISIBLE
enddialog
Everything works perfectly [my application have its menu and all resources working after start].
But when I create just the same resources using data resource directive, and recompile my app. menu is not visible anymore [resource viewers state that resources section in invalid/corrupted]:
data resource
;section 'rs' resource readable writeable
directory RT_MENU,menus,\
RT_DIALOG, dialogs,\
RT_ICON,icons,\
RT_GROUP_ICON,group_icons
resource menus,\
IDM_MainMenu,LANG_ENGLISH,main_menu
resource dialogs,\
IDD_Options, LANG_ENGLISH, Options_Dlg
resource icons,\
1,LANG_NEUTRAL,icon_data
resource group_icons,\
IDI_MainIcon,LANG_NEUTRAL,main_icon
menu main_menu
menuitem '&Window',0,MFR_POPUP
menuitem '&Options',IDC_Options
menuseparator
menuitem 'E&xit',IDC_Exit,MFR_END
menuitem '&About',IDC_About, MFR_END
icon main_icon,icon_data,'WMIcon.ico'
dialog Options_Dlg, 'Options', 0, 0, 300, 215, WS_VISIBLE+WS_CAPTION+DS_3DLOOK+WS_SYSMENU, WS_EX_TOPMOST+WS_EX_TOOLWINDOW
dialogitem 'LISTBOX', '', IDOC_Programs, 10, 10, 120, 80, WS_VISIBLE+LBS_NOINTEGRALHEIGHT+WS_BORDER+WS_HSCROLL+WS_VSCROLL+LBS_NOTIFY
dialogitem 'BUTTON', '',IDOC_Assign, 10, 95, 120, 15, WS_VISIBLE+BS_VCENTER
dialogitem 'LISTBOX', '', IDOC_Commands, 140, 10, 150, 80, WS_VISIBLE+LBS_NOINTEGRALHEIGHT+WS_BORDER
dialogitem 'BUTTON', 'Remove Task', IDOC_Remove, 140, 95, 150, 15, WS_VISIBLE
dialogitem 'BUTTON','NEW TASK', 0, 10, 115, 280, 5, WS_VISIBLE+BS_GROUPBOX+WS_DISABLED
dialogitem 'STATIC','', IDOC_CtrlName, 10, 130, 120, 35, WS_VISIBLE+WS_BORDER
dialogitem 'BUTTON','Find Menu', IDOC_Find, 10, 165, 120, 15, WS_VISIBLE
dialogitem 'BUTTON', 'Add Task', IDOC_Add, 140, 145, 150, 15, WS_VISIBLE
dialogitem 'BUTTON','', IDOC_Progress, 140, 165, 150, 15, WS_VISIBLE+BS_VCENTER+BS_FLAT+WS_DISABLED
dialogitem 'STATIC','Every', 1, 140, 130, 40, 15, WS_VISIBLE
dialogitem 'EDIT','',IDOC_Delay, 165, 130, 30, 10, WS_VISIBLE+ES_NUMBER+WS_BORDER
dialogitem 'STATIC','min', 0, 200, 130, 30, 10, WS_VISIBLE
dialogitem 'BUTTON','CLOSE',IDOC_Close, 130, 190, 40, 15, WS_VISIBLE
enddialog
; might as well be here [won't change anything]
; icon main_icon,icon_data,'WMIcon.ico'
end data
and now the strangest thing for me: after moving the line which defines the icon, like this:
data resource
...
resource group_icons,\
IDI_MainIcon,LANG_NEUTRAL,main_icon
;---now its here---
icon main_icon,icon_data,'WMIcon.ico'
menu main_menu
menuitem '&Window',0,MFR_POPUP
menuitem '&Options',IDC_Options
menuseparator
menuitem 'E&xit',IDC_Exit,MFR_END
menuitem '&About',IDC_About, MFR_END
...
end data
IT WORKS AGAIN o_O?! I don't know why. Can't find anything in help file about order of definitions that can cause trouble [well, it cant really. it worked before, didn't it? + when I leave icon main_icon,icon_data,'WMIcon.ico' there and use section directive again, it still works]
If i missed anything please infor me ;]
|