- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi there,
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.
Cheers
PF
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
I had
logical lRslt
.
lRslt = RegisterClass(tWndClass)
instead of
integer iRslt
.
iRslt = RegisterClass(tWndClass)
At least since I adjusted the type, the prog works well.
Thanks for your rapid response anyway.
Cheers
PF
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
Cheers
PF
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@Paul_Felz wrote:
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 Fortran (stevelionel.com)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Steve,
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.
Cheers
PF
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.....
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
... I will keep my fingers crossed (hard to type this way, though).
Thank for your support anyway.
Cheers
PF
![](/skins/images/FA4C5A4524EC383CF88312AF9F66732D/responsive_peak/images/icon_anonymous_message.png)
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page