wintpv.c
internet.prg(402) : warning C4244: 'function' : conversion from 'HB_SIZE' to 'DWORD', possible loss of data
internet.prg(443) : warning C4996: 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\INCLUDE\stdio.h(211) : see declaration of 'fopen'
internet.prg(512) : warning C4996: 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\INCLUDE\stdio.h(211) : see declaration of 'fopen'
internet.prg(574) : warning C4996: 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\INCLUDE\stdio.h(211) : see declaration of 'fopen'
internet.prg(657) : warning C4996: 'gethostbyname': Use getaddrinfo() or GetAddrInfoW() instead or define _WINSOCK_DEPRECATED_NO_WARNINGS to disable deprecated API warnings
C:\Program Files (x86)\Windows Kits\8.1\include\um\winsock2.h(2238) : see declaration of 'gethostbyname'
internet.prg(667) : warning C4996: 'strcpy': This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
internet.prg(667) : warning C4996: 'inet_ntoa': Use inet_ntop() or InetNtop() instead or define _WINSOCK_DEPRECATED_NO_WARNINGS to disable deprecated API warnings
C:\Program Files (x86)\Windows Kits\8.1\include\um\winsock2.h(1868) : see declaration of 'inet_ntoa'
internet.prg(719) : warning C4996: 'gethostbyname': Use getaddrinfo() or GetAddrInfoW() instead or define _WINSOCK_DEPRECATED_NO_WARNINGS to disable deprecated API warnings
C:\Program Files (x86)\Windows Kits\8.1\include\um\winsock2.h(2238) : see declaration of 'gethostbyname'
internet.prg(730) : warning C4996: 'strcpy': This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
internet.prg(730) : warning C4996: 'inet_ntoa': Use inet_ntop() or InetNtop() instead or define _WINSOCK_DEPRECATED_NO_WARNINGS to disable deprecated API warnings
C:\Program Files (x86)\Windows Kits\8.1\include\um\winsock2.h(1868) : see declaration of 'inet_ntoa'
internet.prg(734) : warning C4996: 'inet_addr': Use inet_pton() or InetPton() instead or define _WINSOCK_DEPRECATED_NO_WARNINGS to disable deprecated API warnings
C:\Program Files (x86)\Windows Kits\8.1\include\um\winsock2.h(1850) : see declaration of 'inet_addr'
internet.prg(750) : warning C4267: 'function' : conversion from 'size_t' to 'int', possible loss of data
tokh.prg(2907) : warning C4996: 'sprintf': This function or variable may be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\INCLUDE\stdio.h(356) : see declaration of 'sprintf'
tokh.prg(2938) : warning C4996: 'strtok': This function or variable may be unsafe. Consider using strtok_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\INCLUDE\string.h(204) : see declaration of 'strtok'
tokh.prg(2952) : warning C4996: 'strtok': This function or variable may be unsafe. Consider using strtok_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\INCLUDE\string.h(204) : see declaration of 'strtok'
tokh.prg(2993) : warning C4996: 'strtok': This function or variable may be unsafe. Consider using strtok_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\INCLUDE\string.h(204) : see declaration of 'strtok'
tokh.prg(3007) : warning C4996: 'strtok': This function or variable may be unsafe. Consider using strtok_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\INCLUDE\string.h(204) : see declaration of 'strtok'
tokh.prg(3086) : warning C4996: 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\INCLUDE\stdio.h(211) : see declaration of 'fopen'
Microsoft (R) Windows (R) Resource Compiler Version 6.3.9600.17298
Copyright (C) Microsoft Corporation. All rights reserved.
FiveH64.lib(TSOCKET.obj) : warning LNK4006: HB_FUN_SHOWIP already defined in wintpv.obj; second definition ignored
FiveHC64.lib(DC.obj) : warning LNK4006: HB_FUN_FWDISPBEGIN already defined in TWBRWX64_H.lib(wbrwline.obj); second definition ignored
FiveHC64.lib(DC.obj) : warning LNK4006: HB_FUN_FWDISPEND already defined in TWBRWX64_H.lib(wbrwline.obj); second definition ignored
wintpv.exe : warning LNK4088: image being generated due to /FORCE option; image may not run
* Application successfully built *
BOOL lSuccess = InternetReadFile( ( HINTERNET ) hb_parnl( 1 ), ( LPVOID ) hb_parc( 2 ), hb_parclen( 2 ), &nBytesRead );
elemento = strtok(cadena,"\n"); // "\n" es nueva línea=LF
BOOL InternetReadFile(
_In_ HINTERNET hFile,
_Out_ LPVOID lpBuffer,
_In_ DWORD dwNumberOfBytesToRead,
_Out_ LPDWORD lpdwNumberOfBytesRead
);
Generating C source output to 'wintpv.c'... Done.
wintpv.c
internet.prg(458) : warning C4047: 'function' : 'HB_USHORT' differs in levels of indirection from 'char [2]'
internet.prg(458) : warning C4024: 'hb_fsOpen' : different types for formal and actual parameter 2
internet.prg(458) : warning C4047: '=' : 'FILE *' differs in levels of indirection from 'HB_FHANDLE'
internet.prg(529) : warning C4047: 'function' : 'HB_USHORT' differs in levels of indirection from 'char [2]'
internet.prg(529) : warning C4024: 'hb_fsOpen' : different types for formal and actual parameter 2
internet.prg(529) : warning C4047: '=' : 'FILE *' differs in levels of indirection from 'HB_FHANDLE'
internet.prg(591) : warning C4047: 'function' : 'HB_USHORT' differs in levels of indirection from 'char [2]'
internet.prg(591) : warning C4024: 'hb_fsOpen' : different types for formal and actual parameter 2
internet.prg(591) : warning C4047: '=' : 'FILE *' differs in levels of indirection from 'HB_FHANDLE'
internet.prg(773) : warning C4267: 'function' : conversion from 'size_t' to 'int', possible loss of data
tokh.prg(2907) : warning C4996: 'sprintf': This function or variable may be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
tokh.prg(2952) : warning C4996: 'strtok': This function or variable may be unsafe. Consider using strtok_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
Copyright (C) Microsoft Corporation. All rights reserved.
wintpv.obj : error LNK2001: unresolved external symbol HB_FUN_HB_FSOPEN
wintpv.obj : error LNK2019: unresolved external symbol fw_strcpy referenced in function HB_FUN_CHK_INTERNET
wintpv.exe : fatal error LNK1120: 2 unresolved externals
* Linking errors *
#define _WINSOCK_DEPRECATED_NO_WARNINGS // Para evitar warnings relativos a WinSock. Fuente info: Microsoft.
#include <hbapifs.h>
#include <stdio.h>
#include <ws2tcpip.h> //Equivalente actualizado de #include <winsock2.h>
char * fw_strcpy( char * s1, const char * s2 );
HB_FUNC( CHK_INTERNET )
{
WSADATA wsa;
char *hostname = (char *) hb_parc(1); //char *hostname = hb_parc(1);
char ip[100];
struct hostent *he;
struct in_addr **addr_list;
int i;
//printf("\nInitialising Winsock...");
if (WSAStartup(MAKEWORD(2,2),&wsa) != 0)
//printf("Failed. Error Code : %d",WSAGetLastError());
hb_retni(1); //return 1;
else {
//printf("Initialised.\n");
if ( (he = gethostbyname( hostname ) ) == NULL)
//gethostbyname failed
//printf("gethostbyname failed : %d" , WSAGetLastError());
hb_retni(2); //return 1;
else {
//Cast the h_addr_list to in_addr , since h_addr_list also has the ip address in long format only
addr_list = (struct in_addr **) he->h_addr_list;
for(i = 0; addr_list[i] != NULL; i++)
{ //Return the first one;
fw_strcpy(ip , inet_ntoa(*addr_list[i]) );
}
//printf("%s resolved to : %s\n" , hostname , ip);
hb_retni(0); //return 0;
}
}
WSACleanup();
}
#include "ws2tcpip.h" //For WinSock 2 library: ws2_32.lib
#include "wininet.h"
#include "windows.h"
#include <hbapifs.h>
#include "hbapi.h"
#include "stdio.h"
#include "WinBase.h"
//Devuelve el nombre del último fichero modificado según una máscara en un directorio FTP.
HB_FUNC( FTPLASTFILEINDIR ) //Método por el último nombre en el listado obtenido.
{
WIN32_FIND_DATA ultdir;
WIN32_FIND_DATA dirtemp;
SYSTEMTIME stUTC;
HINTERNET FtpHandle;
FILE *fichero;
//HB_FHANDLE fichero;
char nombre[12] = "LISTFTP.DAT";
fichero = hb_fsopen( nombre, "w" );
//fichero = fopen( nombre, "w" );
...
// Esta función es llamada automáticamente por oWnd:end() o por la X de la ventana principal.
EXIT PROCEDURE KillApp()
// Escribe en .INI lo que corresponda.
// Decrementa el número de usuarios.
// Cierra las DLL's.
//freelibrary("nviewlib.dll")
//freelibrary("avicap32.dll")
// Cierra los recursos.
// ResAllFree() Innecesario a partir de los 32 bits
// Cierra las bases de datos.
//CLOSE DATABASES
// Libera la memoria.
//CLEAR MEMORY
//set RESOURCES TO //Solo si se usan recursos en dll.
return
Verhoven wrote:Y otra cosa más que me gustaría dejar resañada es que para que el programa en 64 bits no se quede colgado al salir, tengo que comentar todas las líneas del siguiente código que venía usando para 32 bits sin problemas con BCC63 y BCC582:
- Code: Select all Expand view
// Esta función es llamada automáticamente por oWnd:end() o por la X de la ventana principal.
EXIT PROCEDURE KillApp()
// Escribe en .INI lo que corresponda.
// Decrementa el número de usuarios.
// Cierra las DLL's.
//freelibrary("nviewlib.dll")
//freelibrary("avicap32.dll")
// Cierra los recursos.
// ResAllFree() Innecesario a partir de los 32 bits
// Cierra las bases de datos.
//CLOSE DATABASES
// Libera la memoria.
//CLEAR MEMORY
//set RESOURCES TO //Solo si se usan recursos en dll.
return
// Para VSC2013.
#include "warningsVSC2013.h"
#include "ws2tcpip.h" //For WinSock 2 library: ws2_32.lib
#include "wininet.h"
#include "windows.h"
#include <hbapifs.h>
#include <fileio.ch>
#include "hbapi.h"
#include "stdio.h"
#include "WinBase.h"
//Devuelve el nombre del último fichero modificado según una máscara en un directorio FTP.
HB_FUNC( FTPLASTFILEINDIR ) //Método por el último nombre en el listado obtenido.
{
WIN32_FIND_DATA ultdir;
WIN32_FIND_DATA dirtemp;
SYSTEMTIME stUTC;
HINTERNET FtpHandle;
FILE *fichero;
//HB_FHANDLE fichero;
char nombre[12] = "LISTFTP.DAT";
//fichero = fopen( nombre, "w" );
fichero = hb_fsopen( nombre, FO_WRITE );
Generating C source output to 'wintpv.c'... Done.
wintpv.c
internet.prg(462) : warning C4013: 'hb_fsopen' undefined; assuming extern returning int
internet.prg(462) : warning C4047: '=' : 'FILE *' differs in levels of indirection from 'int'
internet.prg(778) : warning C4267: 'function' : conversion from 'size_t' to 'int', possible loss of data
Microsoft (R) Windows (R) Resource Compiler Version 6.3.9600.17298
Copyright (C) Microsoft Corporation. All rights reserved.
wintpv.obj : error LNK2019: unresolved external symbol hb_fsopen referenced in function HB_FUN_FTPLASTFILEINDIR
wintpv.exe : fatal error LNK1120: 1 unresolved externals
* Linking errors *
Return to FiveWin para Harbour/xHarbour
Users browsing this forum: wilsongamboa and 56 guests