Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
28445 Discussions

My menu, toolbar & stsatus bar have disapeared

davidgraham
Beginner
1,786 Views
I have been debugging my program and suddenly my menu, toolbar & statusbar have all gone. Previously they were all working correctly.

hmenu = LoadMenu(hInstance, LOC(lpszMenuName))
hWndSB=CreateDialogparam(hinst,MAKEINTRESOURCE(IDD_SB),hwnd,loc(DlgProc),0)
hWndTB=CreateDialogparam(hinst,MAKEINTRESOURCE(IDD_TOOLBAR),hwnd,loc(ToolDlgProc),0)

all return 0.

Do you have any idea what I could have done.
The *.rc file looks OK.

Thanks
0 Kudos
59 Replies
davidgraham
Beginner
966 Views
I have just had another example of this going wrong. The menu, toolbar & ststus bar were OK. I removed some code that had nothing to do with the menu/dialogs, deleted the files in the debug directory, recompiled and the menu, toolbar & status bar have gone.

I only have the Microsoft Visual Sudio Shell. I have noticed that in the Solution Explorer when I click on resuorces it only shows the icons and bitmaps not the dialogs (I'm not sure if it ever did show these).

Thanks
0 Kudos
anthonyrichards
New Contributor III
966 Views
This sounds like a resource editor problem.
What resource editor are you using?
Or are you editing a resource file directly?
0 Kudos
Steven_L_Intel1
Employee
966 Views
The shell does not include the Microsoft resource editor. ResEdit (www.resedit.net) can be used as an alternative.
0 Kudos
davidgraham
Beginner
966 Views
I'm using Resedit.
I wondered if that was a problem but I have not used Resedit yet on this project - but have used it on another project.
The problem may have started after I edited another projects *.rc file - now I can't get the menu, toolbar or status bar to dispay on any project.
0 Kudos
anthonyrichards
New Contributor III
966 Views
Make sure that your resource.fd file is up-to-date.
You have to ensure that deftofd.exe is executed after each time you change your resource file in order to get the resource.def file properly translated to the Fortran-friendly resource.fd file that you have to include wherever you refer to resource identifiers in your Fortran code.
0 Kudos
davidgraham
Beginner
966 Views
I'm sure the resource file is up-to-date.
How do you ensure deftold.exe is executed after each time I change the resource file?
Thanks
0 Kudos
anthonyrichards
New Contributor III
966 Views
Can you attach the troublesome RESOURCE.RC file (and perhaps the accompanying RESOURCE.H and RESOURCE.FD)?
0 Kudos
anthonyrichards
New Contributor III
966 Views
You can add a custom-build event by right-clicking on RESOURCE.H (after including it in your project) to bring up its 'properties' page then selecting 'custom build step' to execute deftofd.exe. An example I have shows

deftofd "$(InputPath)" "$(InputDir)$(InputName).fd"

as the custom build step, which will then invoke DEFTOFD.EXE with RESOURCE.H as input and RESOURCE.FD as output, (the executable will be automatically found in the default executable search path, probably in folder $(IFortInstallDir)bin\ia32\).

(edited for errors!)
0 Kudos
davidgraham
Beginner
966 Views
Do I add RESOURCE.H to the heder files, resource files or source files?
Thanks
0 Kudos
Jugoslav_Dujic
Valued Contributor II
966 Views
It does not matter at all, this grouping is only for your convenience. "Header files" would be my choice.
0 Kudos
davidgraham
Beginner
966 Views
Thanks,
I have added it and found the propery page but not sure exactly what to enter, I didn't follow your instructions.

deftofd "$(InputPath)" "$(InputDir)$(InputName).fd"

as the custom build step, which will then invoke DEFTOFD.EXE with RESOURCE.H as input and RESOURCE.FD as output, (the executable will be automatically found in the default executable search path, probably in folder $(IFortInstallDir)bin\ia32\).

This is what I have.


0 Kudos
davidgraham
Beginner
966 Views
I'm still stuck on this problem.
Not sure if what I entered for the Custom Buils Setup is correct.
I have attached my resource files as requested a few posts ago.
Hope this help.
Thanks
0 Kudos
anthonyrichards
New Contributor III
966 Views
Please can you add all the missing icons?
And bitmaps?

And what exactly goes wrong - dialogs do not display?
0 Kudos
anthonyrichards
New Contributor III
966 Views
The resource files you attached display OK in the resource editor of CVF (after references to missing icons and bitmaps were commentd out). All dialogs appear to be 'there'.

The Resource.fd appears to contain the required resource symbols (IDD_SB etc.) so as long as it is included, they should be found OK. Always include 'IMPLICIT NONE' in you code to ensure that all variables used have been defined, his will pick up missing INCLUDE 'resource.FD' statements and mistyped variable names etc.

I think you should delve more into the statements you posted that create the dialogs using CreateDialogParam. You should check that Hinst and Hwnd are valid handles (where do you get them from?), that the DialogProc exists and is correctly pointed to, and if the return value is still Null you should ask for more information by calling GetLast Error and displaying the error message.
0 Kudos
davidgraham
Beginner
966 Views
Thanks for your comments. I assume that you do not need the bitmaps & icons now, if you still need them I could attach them.

I don't think there is a problem with the calls to create the dialogs. This project was working OK in cvf. I then upgraded to ivf and it again worked correctly. I found a problem that the program hangs occasionally (this is described in another post). I was going to send my program to Intel support but as it is a very large program I was in the process of cutting it down. This involved removing most options and therefore removing dialogs, icons and bitmaps that were not required. As I only have Microsoft Visual Studio shell I edited the resources in ResEdit. Since I have done this I find that no projects work in Microsoft Visual Studio - even other projects where I had not changed the dialogs.
I went back to my cvf project (using the original cvf resuources), upgraded it to ivf following the same process as before and again I got the problem with the menu, toolbar, status bar etc. - had not edited the resources this time.
It appears that because I used ResEdit once I can never display any resousce in any project.
Maybe the only, but expensive, solution is to buy the full version of Microsoft Visual Studio.

I have not used 'implicit none' as in Project Properies - Configuration Properties - Fortran - Diagnostics, I have warn form undeclared symbols & warn for unused symbols set to 'Yes'. I have added 'implicit none' but it does not give any errors.

I added getlasterror (after the call to display the menu) and got error 1813 'The specified resource type cannot be found in the image file'.

I hope this helps to find what the problem is. I wonder if others have used ResEdit successfully with ivf.
0 Kudos
anthonyrichards
New Contributor III
966 Views
Are your dialog resources included in your main application file, or are they in another file, for example a resource-only EXE?
0 Kudos
davidgraham
Beginner
966 Views
I'm not exactly sure what your question is but I'm sure the answer is that it is included in the main application file.
I am creating one executable. All the fortran files and *.rc file is in the same location. The executable is created from these files.
For every project there are seperate fortran files (they may share some library files) and *.rc files and they are in sepertate directories and they create a seperate executables.
I'm not using a resource only EXE.

Thanks

0 Kudos
davidgraham
Beginner
966 Views
Anthony,
Thanks for all the work you have done on this.
I loaded your program, compiled it and tried to run it.
It came up with an error message "Error initializing application dodgydialog"
I try to investigate it a bit more.
0 Kudos
anthonyrichards
New Contributor III
966 Views
By the way, are you compiling a 32-bit or 64-bit application for running on a 32-bit or 64-bit operating system?

The project I supplied should just have been unzipped to a location and the project loaded into IVF.
You should then be able to execute it by using 'Start without debugging' with no building required.

What exactly did you do?
If you created a new project, then you have to include all the resource and header files into the project, as well as the Fortran source files in order to get all the resources included into the application executable., where they should then be found - unless you get a problem trying to use a 32-bit program on a 64-bit machine, when you can have problems with 8-byte integer handles being required where only 4-byte integers are specified in the code.
0 Kudos
davidgraham
Beginner
871 Views
I'm running a 32 bit application on a 64 bit machine (I think).

I unzipped the file into the a directory - I just used the project you sent.
I got an error message when I tried to run it.
I had to go into Project properties, Configuration Properties, Linker, Input, Ignore Specific Library - and specified 'comsuppw.lib'. Then it 'runs' and gives the error as mentioned in the last post after
lret = DlgInit(IDD_DODGYDIALOG_DIALOG, gdlg)
0 Kudos
Reply