NO

Author Topic: Bizarre  (Read 10333 times)

Offline TimoVJL

  • Global Moderator
  • Member
  • *****
  • Posts: 2091
Re: Bizarre
« Reply #15 on: March 13, 2016, 06:33:10 PM »
I like that simple macro that John prefers.
without rect pointer that macro is useless?
Code: [Select]
warning #2130: Result of comparison is constant.
May the source be with you

Offline frankie

  • Global Moderator
  • Member
  • *****
  • Posts: 2096
Re: Bizarre
« Reply #16 on: March 13, 2016, 07:13:40 PM »
Sorry John, I don't understand what's wrong.
Please try this code:
Code: [Select]
#include <windows.h>
#include <stdio.h>
#include <commctrl.h>
#undef SNDMSG
#define SNDMSG myfunc
BOOL myfunc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
PRECT prc = (PRECT)lParam;
printf("hwnd=%p, msg=%u, prc=%p, left=%d, wParam=%d\n", hwnd, msg, prc, prc ? prc->left : 0, wParam);
return TRUE;
}

void foo(PRECT prc)
{
//Here we don't get 'comparison constant' because prc is defined outside
ListView_GetItemRect(NULL, 10, prc,  20);
}

int main(int argn, char **args)
{
RECT rc;
//Here we got a 'comparison constant' because rc is defined here
ListView_GetItemRect(NULL, 10, &rc,  20);
ListView_GetItemRect(NULL, 10, NULL, 20);
foo(&rc);
        return 0;
}
This is a simple test for the list view macros, and as I can see it works.
« Last Edit: March 13, 2016, 07:21:45 PM by frankie »
It is better to be hated for what you are than to be loved for what you are not. - Andre Gide

Offline frankie

  • Global Moderator
  • Member
  • *****
  • Posts: 2096
Re: Bizarre
« Reply #17 on: March 13, 2016, 07:29:00 PM »
Timo, see my updated sample that shows that the macro is correct.
The scope of the test is to avoid an exception when the user pass a null pointer. Because inside SendMessage no exception is generated, and the function simply fails, to let have an exception in the macro is to like to modify the standard behavior of SendMessage.
For these reasons the macro is correct IMHO.
About the
Quote
warning #2130: Result of comparison is constant.
message it is correct. See my code in previous post, it is generated only in the main where it is known to the compiler that rc exists. In this case the comparison is always true and the dead code, for comparison, is removed (this is the sense of the warning).
This is confirmed in the function foo where the warning is not generated because the pointer is defined outside and the camparison result is unknown at compile time.

P.S. To be noted that even on the line where we pass a NULL for rectangle pointer the compiler doesn't generate the warning. Maybe this conditional is resolved at preprocessor level?
« Last Edit: March 13, 2016, 09:58:37 PM by frankie »
It is better to be hated for what you are than to be loved for what you are not. - Andre Gide

Grincheux

  • Guest
Re: Bizarre
« Reply #18 on: March 13, 2016, 09:27:14 PM »
Thank you for your research. :D

Grincheux

  • Guest
Re: Bizarre
« Reply #19 on: March 13, 2016, 09:44:50 PM »
The problem comes from the manifest file. It is created by MSVC and set in ressources for Pelles. If I use the Pelle's manifest the result is the same.

Offline frankie

  • Global Moderator
  • Member
  • *****
  • Posts: 2096
Re: Bizarre
« Reply #20 on: March 13, 2016, 09:53:58 PM »
Great!  :)
No bugs then  ;)
It is better to be hated for what you are than to be loved for what you are not. - Andre Gide

Grincheux

  • Guest
Re: Bizarre
« Reply #21 on: March 13, 2016, 09:56:12 PM »
I try to get the manifest created by MSVC and to import it into a ressoucre for Pelle and say to MSVC that it must use the rc manifest!
Thank for your help

Grincheux

  • Guest
Re: Bizarre
« Reply #22 on: March 13, 2016, 10:13:07 PM »
Here is the manifest found in ImageViewer.exe (Version MSVC)

Quote
<?xml version='1.0' encoding='UTF-8' standalone='yes'?>
<assembly xmlns='urn:schemas-microsoft-com:asm.v1' manifestVersion='1.0'>
</assembly>

And here is what I put in Pelle's version :

Quote
<?xml version="1.0" encoding="UTF-8" standalone="true"?>
-<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
<assemblyIdentity processorArchitecture="amd64" version="1.0.0.0" name="MyOrganization.MyDivision.MyApp" type="win32"/>
<description>Verbal description of MyApp.</description>
-<dependency>
-<dependentAssembly>
<assemblyIdentity language="*" processorArchitecture="amd64" version="6.0.0.0" name="Microsoft.Windows.Common-Controls" type="win32" publicKeyToken="6595b64144ccf1df"/>
</dependentAssembly>
</dependency>
-<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
-<application>
<!-- Windows Vista -->
<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>
<!-- Windows 7 -->
<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
<!-- Windows 8 -->
<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
<!-- Windows 8.1 -->
<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
<!-- Windows 10 -->
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>
</application>
</compatibility>
</assembly>

Extracted with Ressources Hacker.
« Last Edit: March 13, 2016, 10:15:43 PM by Grincheux »

Offline TimoVJL

  • Global Moderator
  • Member
  • *****
  • Posts: 2091
Re: Bizarre
« Reply #23 on: March 14, 2016, 08:34:35 AM »
In Visual Studio 2008:
Project option -> Manifest Tool -> Input and Output -> Additional Manifest Files
« Last Edit: March 16, 2016, 07:21:38 PM by TimoVJL »
May the source be with you

Grincheux

  • Guest
Re: Bizarre
« Reply #24 on: March 14, 2016, 11:09:30 AM »
That's what I already made.
But the outline color must be drawn only when I click on a image, not always.
If there is no manisfest I get my result.
Thanks

Philippe

Grincheux

  • Guest
Re: Bizarre
« Reply #25 on: March 14, 2016, 11:15:18 AM »
That's what I already made.
But the outline color must be drawn only when I click on a image, not always.
If there is no manisfest I get my result.

Quote
LVS_EX_BORDERSELECT Version 4.71 and later. Changes border color when an item is selected, instead of highlighting the item.


Quote
SendMessage(hListView,LVM_SETEXTENDEDLISTVIEWSTYLE,LVS_EX_BORDERSELECT|LVS_EX_DOUBLEBUFFER|LVS_EX_AUTOAUTOARRANGE,LVS_EX_BORDERSELECT|LVS_EX_DOUBLEBUFFER|LVS_EX_AUTOAUTOARRANGE) ;
Thanks

Philippe
« Last Edit: March 14, 2016, 11:17:37 AM by Grincheux »

Grincheux

  • Guest
Re: Bizarre
« Reply #26 on: March 14, 2016, 12:59:32 PM »
You know ImageViewer than I!

I replaced the value in ImageViewer.ini and re-set the manifest for both MSVC and Pelle, all is OK.

Thank you for people who helped me without you I had not the answer to my problem.

I made a site for ImageViewer but members of this forum can access source files here.

I put the software in donationware.

Grincheux

  • Guest
Re: Bizarre
« Reply #27 on: March 14, 2016, 01:29:00 PM »
The program that I wrote is not extraordinary , but it makes things that other
they do not do.
I tried to minimize the dialog boxes, there are only two , because I do not like them.
Perhaps that this software will help someone and whether he can bring me a few euros , why not.
Finally, I did not do it for the money but for the fun of programming .
I wish I have no gift for graphics, the interface would surely have been more beautiful.
I will continue to evolve , now a crazy idea is outstanding gestation ,
but I gladly accept your ideas.

Thank you , Frankie , Timo & John .

Philippe