Hello,
I would like to make two questions please.
1) How can I detect the default Internet browser on the PC?.
2) How can I read a cookie?.
Thank you in advance.
Hello,
I would like to make two questions please.
1) How can I detect the default Internet browser on the PC?.
2) How can I read a cookie?.
Thank you in advance.
De manera predeterminada, Windows XP utiliza una configuraci贸n global en la clave del registro HKeyLocalMachine (HKLM) para establecer una inicial, el correo electr贸nico predeterminado y el cliente de explorador Web en el men煤 Inicio . Windows XP tambi茅n implementa nuevas claves del registro en HKeyCurrentUser (HKCU) para almacenar individuales de internet y la informaci贸n de cliente de correo electr贸nico de cada usuario como parte de su perfil, si los usuarios seleccionan a un cliente diferente a la predeterminada
BOOL InternetGetCookie(
_In_ LPCTSTR lpszUrl,
_In_ LPCTSTR lpszCookieName,
_Out_ LPTSTR lpszCookieData,
_Inout_ LPDWORD lpdwSize
);#pragma BEGINDUMP
#include <windows.h>
#include <hbapi.h>
HB_FUNC( INTERNETGETCOOKIE )
{
DWORD dwSize = 0;
char * buffer;
InternetGetCookie( ( LPCTSTR ) hb_parc( 1 ), ( LPCTSTR ) hb_parc( 2 ), ( LPCTSTR ) hb_parc( 3 ), NULL, &dwSize );
buffer = ( char * ) hb_xgrab( dwSize );
if( InternetGetCookie( ( LPCTSTR ) hb_parc( 1 ), ( LPCTSTR ) hb_parc( 2 ), ( LPCTSTR ) hb_parc( 3 ), buffer, &dwSize ) )
hb_retclen( buffer, dwSize );
else
hb_retc( "" );
hb_xfree( buffer );
);
#pragma ENDDUMPAntonio,
Many thanks, but I get this errors:
Borland C++ 5.82 for Win32 Copyright (c) 1993, 2005 Borland
antonio.c:
Warning W8065 antonio.prg 50: Call to function 'InternetGetCookie' with no prototype in function HB_FUN_INTERNETGETCOOKIE
Warning W8065 antonio.prg 54: Call to function 'InternetGetCookie' with no prototype in function HB_FUN_INTERNETGETCOOKIE
Turbo Incremental Link 5.69 Copyright (c) 1997-2005 Borland
Error: Unresolved external '_InternetGetCookie' referenced from C:\API\COOKIES\ANTONIO.OBJ
Jose Luis,
This header file is missing:
and you also have to link wininet.lib
#pragma BEGINDUMP
#include <windows.h>
#include <wininet.h>
#include <hbapi.h>
/*
BOOLAPI
InternetGetCookie(
聽 聽 __in LPCSTR lpszUrl,
聽 聽 __in_opt LPCSTR lpszCookieName,
聽 聽 __out_ecount_opt(*lpdwSize) LPSTR lpszCookieData,
聽 聽 __inout LPDWORD lpdwSize
聽 聽 );
*/
HB_FUNC( INTERNETGETCOOKIE )
{
聽 聽DWORD dwSize = 0;
聽 聽char * buffer;
聽 聽InternetGetCookie( ( LPCTSTR ) hb_parc( 1 ), ( LPCTSTR ) hb_parc( 2 ), NULL, &dwSize );
聽 聽buffer = ( char * ) hb_xgrab( dwSize );
聽 聽if( InternetGetCookie( ( LPCTSTR ) hb_parc( 1 ), ( LPCTSTR ) hb_parc( 2 ), buffer, 聽&dwSize ) )
聽 聽 聽 hb_retclen( buffer, dwSize );
聽 聽else
聽 聽 聽 hb_retc( "" );
聽 聽hb_xfree( buffer );
}
#pragma ENDDUMP#pragma BEGINDUMP
#include <windows.h>
#include <wininet.h>
#include <hbapi.h>
HB_FUNC( INTERNETGETCOOKIE )
{
聽 聽DWORD dwSize = 0; 聽 聽 聽
聽 聽char * buffer;
聽 聽InternetGetCookie( ( LPCTSTR ) hb_parc( 1 ), ( LPCTSTR ) hb_parc( 2 ), NULL, &dwSize );
聽 聽buffer = ( char * ) hb_xgrab( dwSize );
聽 聽if( InternetGetCookie( ( LPCTSTR ) hb_parc( 1 ), ( LPCTSTR ) hb_parc( 2 ), buffer, &dwSize ) )
聽 聽 聽 hb_retclen( buffer, dwSize );
聽 聽else
聽 聽 聽 hb_retc( "" );
聽 聽hb_xfree( buffer );
);
#pragma ENDDUMPThank you Antonio.
It麓s working now fine.