Page 1 of 1

First true Windows 8 Metro app from FWH !!!

PostPosted: Thu Mar 29, 2012 12:22 pm
by Antonio Linares
First true Windows 8 Metro window using the WinRT API from FWH and Harbour !!! :-)

Image

Re: First true Windows 8 Metro app from FWH !!!

PostPosted: Thu Mar 29, 2012 12:32 pm
by Antonio Linares
As a curiosity here you have the Metro IID_IApplication value that it is no where yet in Google :-)

Code: Select all  Expand view
static const IID IID_IApplication =
{
   0x74B861A1, 0x7487, 0x46A9,
   { 0x9A, 0x6E, 0xC7, 0x8B, 0x51, 0x27, 0x26, 0xC5 }
}


So Google, go and index it :-)

Re: First true Windows 8 Metro app from FWH !!!

PostPosted: Thu Mar 29, 2012 5:34 pm
by Antonio Linares
In order to build Windows 8 WinRT apps, we need to link combase.lib. Windows 8 provides a combase.dll, so we can extract combase.def this way:

impdef.exe combase.def combase.dll

Then to build a lib: (if using Borland)

implib.exe combase.lib combase.dll

If using Microsoft C/C++:

lib.exe /DEF:combase.def /OUT:combase.lib

Re: First true Windows 8 Metro app from FWH !!!

PostPosted: Thu Mar 29, 2012 5:44 pm
by Antonio Linares
Google already indexed IID_IApplication, lets go now for IID_IApplicationFactory :-)

Code: Select all  Expand view

static const IID IID_IApplicationFactory =
{
   0x93BBE361, 0xBE5A, 0x4EE3,
   { 0xB4, 0xA3, 0x95, 0x11, 0x8D, 0xC9, 0x7A, 0x89 }
};
 

Re: First true Windows 8 Metro app from FWH !!!

PostPosted: Fri Mar 30, 2012 4:47 pm
by dutch
Dear Antonio,

Sorry for the question, what is this?
Antonio Linares wrote:Google already indexed IID_IApplication, lets go now for IID_IApplicationFactory :-)

Code: Select all  Expand view

static const IID IID_IApplicationFactory =
{
   0x93BBE361, 0xBE5A, 0x4EE3,
   { 0xB4, 0xA3, 0x95, 0x11, 0x8D, 0xC9, 0x7A, 0x89 }
};
 

Thanks,
Dutch

Re: First true Windows 8 Metro app from FWH !!!

PostPosted: Fri Mar 30, 2012 5:54 pm
by Antonio Linares
Dutch,

http://en.wikipedia.org/wiki/Globally_unique_identifier

The value of a GUID is represented as a 32-character hexadecimal string, such as {21EC2020-3AEA-1069-A2DD-08002B30309D}, and is usually stored as a 128-bit integer. The total number of unique keys is 2128 or 3.4×1038. This number is so large that the probability of the same number being generated randomly twice is negligible, however, GUID numbers are not always generated randomly


Microsoft Windows uses GUIDs internally to identify the classes and interfaces of COM objects. A script can activate a specific class or object without having to know the name or location of the dynamic linked library that contains it

Re: First true Windows 8 Metro app from FWH !!!

PostPosted: Fri Mar 30, 2012 11:53 pm
by dutch
Thanks Antonio,

I've got it.

Regards,
Dutch

Re: First true Windows 8 Metro app from FWH !!!

PostPosted: Sun Apr 20, 2014 8:08 pm
by cnavarro
Antonio Linares wrote:In order to build Windows 8 WinRT apps, we need to link combase.lib. Windows 8 provides a combase.dll, so we can extract combase.def this way:

impdef.exe combase.def combase.dll

Then to build a lib: (if using Borland)

implib.exe combase.lib combase.dll

If using Microsoft C/C++:

lib.exe /DEF:combase.def /OUT:combase.lib


Antonio
Uso Win 8.1 64 bits
Cómo convierto Combase.Dll a Lib?

He conseguido esa .Dll en la version de Windows 8 a 32 bits y, siguiendo tus pasos he generado Combase.Lib, la he añadido en los correspondientes ficheros .Bat, y he intentado generar el .EXE

En Borland (Bcc582), compila y linka sin errores, pero al ejecutar obtengo un hb_out.log
Application Internal Error - C:\Fwh\Fwh1312\samples\winrt.exe
Terminated at: 2014.04.20 21:52:09
Unrecoverable error 6005: Exception error:

Exception Code:C0000005
Exception Address:00000001
EAX:006A9044 EBX:006A9034 ECX:00000000 EDX:00060000
ESI:00000000 EDI:0054B154 EBP:0018FDF8
CS:EIP:0023:00000001 SS:ESP:002B:0018FDE0
DS:002B ES:002B FS:0053 GS:002B
Flags:00010212
CS:EIP:
SS:ESP: 0049D900 00000001 00000000 00000000 00000000 00000000 0018FF0C 00497AAE 00000000 00000000 00000001 0065D622 00000358 0065C200 002839BC 006A93A0

C stack:
EIP: EBP: Frame: OldEBP, RetAddr, Params...
00000001 0018FDF8 0018FF0C 00497AAE 00000000 00000000 00000001 0065D622 00000358 0065C200 002839BC 006A93A0
00497AAE 0018FF0C 0018FF34 0040154C 0054B148 0054B0A4 0049D900 00000000 00000000 00000000 00000000 00000009
0040154C 0018FF34 0018FF48 00496D84 00000000 0054B034 008122CD
00496D84 0018FF48 0018FF54 0049685A 00000001
0049685A 0018FF54 0018FF84 00546FEB 00400000 00000000 008122CD 0000000A 00000000 00000000 7FFDE000 7FFDE000
00546FEB 0018FF84 0018FF98 00000000 0054B034 74E5495D 7FFDE000
00000000 0018FF98 0018FFDC 774398EE 7FFDE000 A604CE4C 00000000 00000000 7FFDE000 00000000 00000000 00000001


Modules:
0x00400000 0x002CF000 C:\Fwh\Fwh1312\samples\winrt.exe
0x773F0000 0x00168000 C:\WINDOWS\SYSTEM32\ntdll.dll
0x74E40000 0x00140000 C:\WINDOWS\SYSTEM32\KERNEL32.DLL
0x770B0000 0x000CF000 C:\WINDOWS\SYSTEM32\KERNELBASE.dll
0x75E00000 0x00077000 C:\WINDOWS\SYSTEM32\ADVAPI32.DLL
0x73330000 0x00008000 C:\WINDOWS\SYSTEM32\VERSION.DLL
0x732D0000 0x0005E000 C:\WINDOWS\SYSTEM32\WINSPOOL.DRV
0x757C0000 0x00086000 C:\WINDOWS\WinSxS\x86_microsoft.windows.common-controls_6595b64144ccf1df_5.82.9600.16384_none_7c55c866aa0c3ff0\COMCTL32.DLL
0x77290000 0x00087000 C:\WINDOWS\SYSTEM32\COMDLG32.DLL
0x75440000 0x00108000 C:\WINDOWS\SYSTEM32\GDI32.DLL
0x70F70000 0x00006000 C:\WINDOWS\SYSTEM32\MSIMG32.DLL
0x75E80000 0x011A4000 C:\WINDOWS\SYSTEM32\SHELL32.DLL
0x752F0000 0x0014F000 C:\WINDOWS\SYSTEM32\USER32.DLL
0x75B70000 0x0010B000 C:\WINDOWS\SYSTEM32\OLE32.DLL
0x75850000 0x00087000 C:\WINDOWS\SYSTEM32\OLEAUT32.DLL
0x70EB0000 0x0001D000 C:\WINDOWS\SYSTEM32\OLEDLG.DLL
0x758E0000 0x0014E000 C:\WINDOWS\SYSTEM32\COMBASE.DLL
0x75D40000 0x000BE000 C:\WINDOWS\SYSTEM32\msvcrt.dll
0x75700000 0x0003E000 C:\WINDOWS\SYSTEM32\sechost.dll
0x771D0000 0x000B1000 C:\WINDOWS\SYSTEM32\RPCRT4.dll
0x77180000 0x00041000 C:\WINDOWS\SYSTEM32\SHLWAPI.dll
0x74E20000 0x0001D000 C:\WINDOWS\SYSTEM32\SspiCli.dll
0x74E10000 0x00009000 C:\WINDOWS\SYSTEM32\CRYPTBASE.dll
0x71CA0000 0x00077000 C:\WINDOWS\SYSTEM32\SHCORE.DLL
0x74DB0000 0x00051000 C:\WINDOWS\SYSTEM32\bcryptPrimitives.dll
0x77080000 0x00025000 C:\WINDOWS\system32\IMM32.DLL
0x75A70000 0x000F7000 C:\WINDOWS\SYSTEM32\MSCTF.dll

Called from ROINITIALIZE(0)
Called from MAIN(9) in winrt.prg


Y en VC2012 Prof., compila correctamente, pero me da los siguientes errores de linkado:
┌────────────────────────────────────────────────────────────────────────────┐
│ FiveWin for Harbour 13.12 (MSVC++) Dec. 2013 Harbour development power │▄
│ (c) FiveTech, 1993-2013 for Microsoft Windows 9X/NT/200X/ME/XP/Vista/7/8 │█
└────────────────────────────────────────────────────────────────────────────┘█
  ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
Compiling...
Harbour 3.2.0dev (r1310011443)
Copyright (c) 1999-2013, http://harbour-project.org/
Compiling 'winrt.prg' and generating preprocessed output to 'winrt.ppo'...
Lines 4551, Functions/Procedures 1
Generating C source output to 'winrt.c'... Done.
Compilador de optimización de C/C++ de Microsoft (R) versión 17.00.61030 para x86
(C) Microsoft Corporation. Reservados todos los derechos.

winrt.c
Creando biblioteca winrt.lib y objeto winrt.exp
winrt.obj : error LNK2019: símbolo externo "wchar_t * __cdecl AnsiToWide(char *)" (?AnsiToWide@@YAPA_WPAD@Z) sin resolver al que se hace referencia en la función _HB_FUN_WINDOWSCREATESTRING
winrt.obj : error LNK2019: símbolo externo "long __stdcall RoInitialize(int)" (?RoInitialize@@YGJH@Z) sin resolver al que se hace referencia en la función _HB_FUN_ROINITIALIZE
winrt.obj : error LNK2019: símbolo externo "void __stdcall RoUninitialize(void)" (?RoUninitialize@@YGXXZ) sin resolver al que se hace referencia en la función _HB_FUN_ROUNINITIALIZE
winrt.obj : error LNK2019: símbolo externo "long __stdcall RoActivateInstance(void *,void *)" (?RoActivateInstance@@YGJPAX0@Z) sin resolver al que se hace referencia en la función _HB_FUN_ROACTIVATEINSTANCE
winrt.obj : error LNK2019: símbolo externo "long __stdcall RoGetActivationFactory(void *,struct _GUID const &,void * *)"
(?RoGetActivationFactory@@YGJPAXABU_GUID@@PAPAX@Z) sin resolver al que se hace referencia en la función _HB_FUN_ROGETACTIVATIONFACTORY
winrt.obj : error LNK2019: símbolo externo "long __stdcall WindowsCreateString(wchar_t *,unsigned long,unsigned long *)"
(?WindowsCreateString@@YGJPA_WKPAK@Z) sin resolver al que se hace referencia en la función _HB_FUN_WINDOWSCREATESTRING
winrt.obj : error LNK2019: símbolo externo "unsigned int __stdcall WindowsGetStringLen(void *)" (?WindowsGetStringLen@@Y
GIPAX@Z) sin resolver al que se hace referencia en la función _HB_FUN_WINDOWSGETSTRINGLEN
winrt.obj : error LNK2019: símbolo externo "long __stdcall WindowsDeleteString(void *)" (?WindowsDeleteString@@YGJPAX@Z)
sin resolver al que se hace referencia en la función _HB_FUN_WINDOWSDELETESTRING
winrt.exe : fatal error LNK1120: 8 externos sin resolver


Algún hilo para solucionarlo?
Gracias

Re: First true Windows 8 Metro app from FWH !!!

PostPosted: Mon Apr 21, 2014 7:45 am
by Patrick Mast
Antonio Linares wrote:First true Windows 8 Metro window using the WinRT API from FWH and Harbour !!! :-)
Congrats Antonio! ;-)

This is an interesting read about the difference between regular desktop apps and WinRT apps:
https://software.intel.com/en-us/articl ... evelopment

Patrick

Re: First true Windows 8 Metro app from FWH !!!

PostPosted: Mon Apr 21, 2014 1:05 pm
by Antonio Linares
Cristobal,

Could you please post Called from ROINITIALIZE source code ? thanks :-)

Re: First true Windows 8 Metro app from FWH !!!

PostPosted: Mon Apr 21, 2014 1:35 pm
by cnavarro
Antonio Linares wrote:Cristobal,

Could you please post Called from ROINITIALIZE source code ? thanks :-)


Code: Select all  Expand view

#include "FiveWin.ch"

//-------------------------------------------------------------------------//

function Main()

   local hString, hApp, hFact

   MsgInfo( RoInitialize() )

   hString = WindowsCreateString( "Windows.UI.Xaml.Application" )
   
   // hFact = RoGetActivationFactory( hString )
   // AfCreateInstance( hFact )
   
   if ( hApp := RoActivateInstance( hString ) ) != 0
      MsgInfo( "before" )
      AppRun( hApp )
      MsgInfo( "after" )
   else
      MsgInfo( "failed" )  
   endif

   WindowsDeleteString( hString )

   RoUninitialize()

return nil

 


Uso el ejemplo que aparece en Samples
Using the example shown in Samples

Re: First true Windows 8 Metro app from FWH !!!

PostPosted: Mon Apr 21, 2014 5:47 pm
by Antonio Linares
Cristobal,

Ese es un código que desarrollé basado en el trabajo de un ex-R+D de Borland, con quien lo comenté, pero él mismo no continuó :-(

https://plus.google.com/101466385048851863100/posts/HpP97BiiTVH

Re: First true Windows 8 Metro app from FWH !!!

PostPosted: Mon Apr 21, 2014 10:47 pm
by Kleyber
Antonio,

Congratulations!!!! Maybe this is an answer to my previous post, about Windows 8 messages?

Re: First true Windows 8 Metro app from FWH !!!

PostPosted: Tue Apr 22, 2014 7:42 am
by Antonio Linares
Kleyber,

Somehow it is the same, but this way took us to a dead end place.

The other way that Antonio Mart commented may be ok