NO

Author Topic: XML Manifest  (Read 4829 times)

avcaballero

  • Guest
XML Manifest
« on: August 24, 2015, 08:25:10 am »
Hello. I have created a PellesC project with the Win32 wizard. At this point everything is ok, compiles and executes right, but when I add a xml manifest, compiles ok, but fails when try to execute it.

Any help, please?
Thank you

Offline Stefan Pendl

  • Global Moderator
  • Member
  • *****
  • Posts: 567
    • Homepage
Re: XML Manifest
« Reply #1 on: August 24, 2015, 11:48:30 am »
You can't comment out an attribute of a node as you did with the processor architecture.
Remove the entire attribute of the AMD64 architecture and you are good to go.

Very bad
Code: [Select]
<assemblyIdentity
    type="win32"
    name="MyOrganization.MyDivision.MyApp"
    version="1.0.0.0"
    <!-- processorArchitecture="amd64" -->
    processorArchitecture="X86"
/>

Good
Code: [Select]
<assemblyIdentity
    type="win32"
    name="MyOrganization.MyDivision.MyApp"
    version="1.0.0.0"
    processorArchitecture="X86"
/>
« Last Edit: August 24, 2015, 11:50:23 am by Stefan Pendl »
---
Stefan

Proud member of the UltraDefrag Development Team

avcaballero

  • Guest
Re: XML Manifest
« Reply #2 on: August 24, 2015, 12:51:03 pm »
Thank you Stefan, now it works fine. Just one thing, I didn't do anything, this is how it comes by default.

Thank you again  :).

avcaballero

  • Guest
Re: XML Manifest
« Reply #3 on: August 24, 2015, 01:21:24 pm »
Hello again. The main reason to adding the xml manifest file is to creating an ico/bmp button with text. However, it doesn't show anything and, if I try to create a debug point in line 86, the application break up on debug-running. Any idea? Thank you.

Offline TimoVJL

  • Global Moderator
  • Member
  • *****
  • Posts: 1899
Re: XML Manifest
« Reply #4 on: August 24, 2015, 05:01:35 pm »
Use button style BS_BITMAP
May the source be with you

avcaballero

  • Guest
Re: XML Manifest
« Reply #5 on: August 25, 2015, 08:38:12 am »
No, it has to be BS_TEXT, ie 0 by default. So we can paint ico/bmp and text in the same button. For example, the same project in FASM.

Code: [Select]
        invoke    CreateWindowEx,WS_EX_LEFT, \
                          szClaseBoton, \
                          szBut01, \
                          WS_CHILD + WS_VISIBLE + BS_TEXT, \
                          cdXCol1,cdYCol+cdYAlto*0,cdXAncho1,cdYAlto, \
                          [hWnd],cdIdBoton+0, \
                          [wc.hInstance],NULL
        mov       [hBtn1], eax
        invoke    CreateWindowEx,WS_EX_LEFT, \
                          szClaseBoton, \
                          szBut02, \
                          WS_CHILD + WS_VISIBLE + BS_TEXT, \
                          cdXCol1,cdYCol+cdYAlto*1,cdXAncho1,cdYAlto, \
                          [hWnd],cdIdBoton+1, \
                          [wc.hInstance],NULL
        mov       [hBtn2], eax

Regards.

Offline TimoVJL

  • Global Moderator
  • Member
  • *****
  • Posts: 1899
Re: XML Manifest
« Reply #6 on: August 25, 2015, 07:35:30 pm »
OK. Give that string in that CreateWindowEx call.
May the source be with you

avcaballero

  • Guest
Re: XML Manifest
« Reply #7 on: August 26, 2015, 08:35:01 am »
Wow, what oversight, thank you very much.

Offline jj2007

  • Member
  • *
  • Posts: 516
Re: XML Manifest
« Reply #8 on: August 27, 2015, 10:50:45 am »
Code: [Select]
WS_CHILD + WS_VISIBLE + BS_TEXT
better:
Code: [Select]
WS_CHILD | WS_VISIBLE | BS_TEXT
No problem in 99% of all cases, and no problem here, but occasionally the Windows API plays foul.

Any idea why compiling this code produces two linker errors (with #include <windows.h>)?
Code: [Select]
POLINK: error: Unresolved external symbol '__imp__CreateSolidBrush@4'.
POLINK: error: Unresolved external symbol '__imp__DeleteObject@4'.

P.S.: Solved with #pragma comment(linker, "gdi32.lib")
« Last Edit: August 27, 2015, 10:53:01 am by jj2007 »

avcaballero

  • Guest
Re: XML Manifest
« Reply #9 on: August 27, 2015, 12:33:39 pm »
Hello, jj.

As long as I know, it's the same using '+' than '|' because all of these constants are designed to be binary independent, ie

0  = 000
2  = 010
3  = 011 <-- This one wouldn't exists because overlap 2 in the second bit
4  = 100

That's because there wouldn't be 3, for example. So 2+4 = 2|4. Maybe there're some constants that are not compatible with others because they are not binary independent for the same propose.

This is in this way for you can get the style of a window and tell if any property is activated isolating it with an "&"

Any one has any other info regarding this subject?


Do you have any compiler failure with this code? I compile and execute it without problems...
« Last Edit: August 27, 2015, 01:52:52 pm by avcaballero »

Offline jj2007

  • Member
  • *
  • Posts: 516
Re: XML Manifest
« Reply #10 on: August 27, 2015, 10:23:34 pm »
As long as I know, it's the same using '+' than '|' because all of these constants are designed to be binary independent

Indeed, but 'occasionally the Windows API plays foul' ;-)

Code: [Select]
include \masm32\MasmBasic\MasmBasic.inc
  Init
  mov eax, WS_EX_OVERLAPPEDWINDOW+WS_EX_CLIENTEDGE+WS_EX_WINDOWEDGE
  mov ebx, WS_EX_OVERLAPPEDWINDOW or WS_EX_CLIENTEDGE or WS_EX_WINDOWEDGE
  deb 4, "Windows plays foul", b:eax, b:ebx
  Exit
end start

Output:
Windows plays foul
b:eax           00000000000000000000011000000000
b:ebx           00000000000000000000001100000000

avcaballero

  • Guest
Re: XML Manifest
« Reply #11 on: August 28, 2015, 11:28:28 am »
Hello.

WS_EX_OVERLAPPEDWINDOW = (WS_EX_WINDOWEDGE | WS_EX_CLIENTEDGE)
The window is an overlapped window.
Code: [Select]
#define WS_EX_WINDOWEDGE   0x00000100L  = 0100000000b
#define WS_EX_CLIENTEDGE   0x00000200L  = 1000000000b
So, WS_EX_OVERLAPPEDWINDOW              = 1100000000b
Thus, if you do WS_EX_OVERLAPPEDWINDOW | WS_EX_WINDOWEDGE | WS_EX_CLIENTEDGE, you ensure that WS_EX_OVERLAPPEDWINDOW = WS_EX_OVERLAPPEDWINDOW = 1100000000b

On the contrary, if you do WS_EX_OVERLAPPEDWINDOW + WS_EX_WINDOWEDGE + WS_EX_CLIENTEDGE, in fact you are doing WS_EX_OVERLAPPEDWINDOW + WS_EX_OVERLAPPEDWINDOW  :o

Regards

Offline jj2007

  • Member
  • *
  • Posts: 516
Re: XML Manifest
« Reply #12 on: August 28, 2015, 02:12:47 pm »
Exactly. And since you can hardly control, every time you see a Windows constant, if it's "pure" or "combined" (there aren't many, but they do exist), it's generally a good idea to always use the or operator "|" instead of the "+".

Grincheux

  • Guest
Re: XML Manifest
« Reply #13 on: February 12, 2016, 07:57:53 pm »
Here is the manifest I use. Pelle's manifests are wrong. It is compatible from Vista to Windows 10 :

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

<assemblyIdentity
    type="win32"
    name="MyOrganization.MyDivision.MyApp"
    version="1.0.0.0"
    processorArchitecture="amd64"
/>

<description>Verbal description of MyApp.</description>

<dependency>
  <dependentAssembly>
    <assemblyIdentity
        type="win32"
        name="Microsoft.Windows.Common-Controls"
        version="6.0.0.0"
        processorArchitecture="amd64"
        publicKeyToken="6595b64144ccf1df"
        language="*"
    />
  </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>

And if you call GetVersion you have the correct windows version.

http://www.phrio.biz/mediawiki/Windows_Manifest