I just started to work on my first Windows app with the intel compiler. In that I encounter an issue when starting my Windows app: More often than not RegisterClass fails to do what it is expected to do. The error code is 87: "The parameter is incorrect".
But I failed to track down any glitch in my parameters - and after some retries the App starts without any problem. I fail to recognize any pattern in the messed starts: sometimes I can have 5 Starts in a row without a single one failing, at another time I need 5 or more tries to have my app running. Note: Without any modifications of my code prior to registering the class.
Any way to repair this unnerving behavior?
I am using Visual Studio 2017 in a windows 11 environment. This happens under debug-mode compilation. In release mode I did not succeed yet - but did not try very hard - to get it running.
There's little we can do to help you without a (hopefully small) but complete test case that demonstrates the problem. The best guess I can offer is that there's a field in your WNDCLASS structure you're not initializing.
Yes, I know. I was under way to compile such an extract - and spotted my error. The variable receiving the return value from RegisterClass was of the wrong type: boolean instead of integer.
lRslt = RegisterClass(tWndClass)
iRslt = RegisterClass(tWndClass)
At least since I adjusted the type, the prog works well.
Thanks for your rapid response anyway.
The return value if register class is a 16 bit integer, the default Fortran integer is 32 bit, the default logical is also 32 bit so I think your diagnosis/fix is not correct. integer(USHORT) :: iRslt or integer(C_INT16_T) :: iRslt is what you should have.
Show your initialisation of tWndClass
Yes, that is what I thought too. That is why I did not give it too much thought if I used integer or logical as return variable. Any integer > 1 to be considered as true, 0 as false. But here I am. Works now.
Yes, that is what I thought too. That is why I did not give it too much thought if I used integer or logical as return variable. Any integer > 1 to be considered as true, 0 as false.
Not quite - at least not unless you also enabled /standard-semantics. See Doctor Fortran in "To .EQV. or to .NEQV., that is the question", or "It's only LOGICAL" - Doctor For...
unless there was a glitch I did not recognize but inadvertantly eradicated, there was nothing else I did than change this logical to intgeger declaration. Since then I had long working hours with my code and dozens of builds per day - and this malfunction never occurred again.
Whatever the problem was changing to default integer (integer(4)) is not a solution as the return value is integer(2) as I noted upthread. With corruption/ initialised type errors any edit changes the code and may make it work because the thing that is getting corrupted changes to something that is not important. Such errors often come back on futures edits.....