FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour How create a dll to return values ?
Posts: 189
Joined: Mon Nov 07, 2005 07:36 PM
How create a dll to return values ?
Posted: Tue May 16, 2006 01:51 PM

I need create a dll to return a value
How must be created ?
Thanks.

( fw+h last version mar/07 )

------spanish on------------
Necesito crear un dll para retornar un valor a otra aplicacion.
Como se hace la dll para que esto ocurra ?

Gracias de antemano.

(No se siquiera como crear la DLL)

Julio Gonzalez V.

RANDOM S.A.

SISTEMICA S.A.
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: How create a dll to return values ?
Posted: Tue May 16, 2006 02:17 PM

Are you asking how to create a DLL or just how to return a value? You can use C language to create a DLL and return statement to return a value.

EMG

Posts: 189
Joined: Mon Nov 07, 2005 07:36 PM
How create a dll to return values ?
Posted: Tue May 16, 2006 04:07 PM

enrico, really both !!
i dont know how it makes.
sorry
can't u help my ?

Julio Gonzalez V.

RANDOM S.A.

SISTEMICA S.A.
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
How create a dll to return values ?
Posted: Tue May 16, 2006 04:28 PM
This is a sample:

#define STRICT
#define WIN32_LEAN_AND_MEAN


#include <windows.h>


BOOL APIENTRY DllMain( HINSTANCE hinstDLL, DWORD dwReason, LPVOID lpvReserved )
{
    return TRUE;
}


HENHMETAFILE APIENTRY __declspec( dllexport ) Wmf2Emf( LPCTSTR cWMF )
{
    HMETAFILE hWMF = GetMetaFile( cWMF );

    UINT nSize = GetMetaFileBitsEx( hWMF, 0, NULL );

    LPVOID lpvData = HeapAlloc( GetProcessHeap(), 0, nSize );

    HENHMETAFILE hEMF;

    GetMetaFileBitsEx( hWMF, nSize, lpvData );

    hEMF = SetWinMetaFileBits( nSize, lpvData, 0, NULL );

    HeapFree( GetProcessHeap(), 0, lpvData );

    DeleteMetaFile( hWMF );

    return hEMF;
}

/*
HENHMETAFILE APIENTRY __declspec( dllexport ) hWmf2Emf( HDC hDC, HMETAFILE hWMF )
{
    UINT nSize = GetMetaFileBitsEx( hWMF, 0, NULL );

    LPVOID lpvData = HeapAlloc( GetProcessHeap(), 0, nSize );

    HENHMETAFILE hEMF;

    GetMetaFileBitsEx( hWMF, nSize, lpvData );

    hEMF = SetWinMetaFileBits( nSize, lpvData, hDC, NULL );

    HeapFree( GetProcessHeap(), 0, lpvData );

    return hEMF;
}
*/

BOOL APIENTRY __declspec( dllexport ) PlayEMF( HDC hDC, HENHMETAFILE hEMF )
{
    ENHMETAHEADER emh;

    if ( !GetEnhMetaFileHeader( hEMF, sizeof( emh ), &emh ) )
        return FALSE;

    return PlayEnhMetaFile( hDC, hEMF, ( CONST RECT * ) &emh.rclBounds );
}

/*
BOOL APIENTRY __declspec( dllexport ) PlayEMF2( HDC hDC, HENHMETAFILE hEMF )
{
    ENHMETAHEADER emh;

    if ( !GetEnhMetaFileHeader( hEMF, sizeof( emh ), &emh ) )
        return FALSE;

    return PlayEnhMetaFile( hDC, hEMF, ( CONST RECT * ) &emh.rclFrame );
}
*/

BOOL APIENTRY __declspec( dllexport ) DeleteEMF( HENHMETAFILE hEMF )
{
    return DeleteEnhMetaFile( hEMF );
}


Let me know if you have any question on this code.

EMG
Posts: 189
Joined: Mon Nov 07, 2005 07:36 PM
How create a dll to return values ?
Posted: Tue May 16, 2006 04:48 PM

Enrico.
I want create a DLL via fw + Harbour.
Thats is my question. Is Harbour prepared to create a DLL not like "RC container", like "function container".
That is the right question.
Sorry for my english.

------spanish on-------------
Enrico
Quiero crear una DLL via fw+h.
Esa es mi pregunta. Esta Harbour preparado para crear DLL no como "contenedor de RC" sino como "contenedor de funcinoes".
Esa es la pregunta correcta.
Gracias de antemano.

Julio Gonzalez V.

RANDOM S.A.

SISTEMICA S.A.
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
How create a dll to return values ?
Posted: Tue May 16, 2006 05:57 PM

I think you can't.

EMG

Posts: 189
Joined: Mon Nov 07, 2005 07:36 PM
How create a dll to return values ?
Posted: Tue May 16, 2006 06:40 PM

ok, thanks again.

Julio Gonzalez V.

RANDOM S.A.

SISTEMICA S.A.
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
How create a dll to return values ?
Posted: Tue May 16, 2006 07:32 PM

Este documento explica como crear DLLs con Harbour/xHarbour:

http://hyperupload.com/download/01cdd50 ... l.txt.html

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
How create a dll to return values ?
Posted: Tue May 16, 2006 07:47 PM

Ok, but it seems too limited, in my opinion. Or am I wrong?

EMG

Posts: 189
Joined: Mon Nov 07, 2005 07:36 PM
How create a dll to return values ?
Posted: Tue May 16, 2006 07:47 PM
Antonio. Mi SpyWare indica:

"PC Tools Spyware Doctor le ha impedido el acceso a este sitio sospechoso de contenido dañino."

Podrias enviarlo por correo ?
jgv@random.cl
Julio Gonzalez V.

RANDOM S.A.

SISTEMICA S.A.
Posts: 144
Joined: Thu Jan 02, 2014 01:49 PM
Re:
Posted: Mon Feb 10, 2014 09:11 PM
Enrico Maria Giordano wrote:This is a sample:

Code (fw): Select all Collapse
#define STRICT
#define WIN32_LEAN_AND_MEAN


#include <windows.h>


BOOL APIENTRY DllMain( HINSTANCE hinstDLL, DWORD dwReason, LPVOID lpvReserved )
{
    return TRUE;
}


HENHMETAFILE APIENTRY __declspec( dllexport ) Wmf2Emf( LPCTSTR cWMF )
{
    HMETAFILE hWMF = GetMetaFile( cWMF );

    UINT nSize = GetMetaFileBitsEx( hWMF, 0, NULL );

    LPVOID lpvData = HeapAlloc( GetProcessHeap(), 0, nSize );

    HENHMETAFILE hEMF;

    GetMetaFileBitsEx( hWMF, nSize, lpvData );

    hEMF = SetWinMetaFileBits( nSize, lpvData, 0, NULL );

    HeapFree( GetProcessHeap(), 0, lpvData );

    DeleteMetaFile( hWMF );

    return hEMF;
}

/*
HENHMETAFILE APIENTRY __declspec( dllexport ) hWmf2Emf( HDC hDC, HMETAFILE hWMF )
{
    UINT nSize = GetMetaFileBitsEx( hWMF, 0, NULL );

    LPVOID lpvData = HeapAlloc( GetProcessHeap(), 0, nSize );

    HENHMETAFILE hEMF;

    GetMetaFileBitsEx( hWMF, nSize, lpvData );

    hEMF = SetWinMetaFileBits( nSize, lpvData, hDC, NULL );

    HeapFree( GetProcessHeap(), 0, lpvData );

    return hEMF;
}
*/

BOOL APIENTRY __declspec( dllexport ) PlayEMF( HDC hDC, HENHMETAFILE hEMF )
{
    ENHMETAHEADER emh;

    if ( !GetEnhMetaFileHeader( hEMF, sizeof( emh ), &emh ) )
        return FALSE;

    return PlayEnhMetaFile( hDC, hEMF, ( CONST RECT * ) &emh.rclBounds );
}

/*
BOOL APIENTRY __declspec( dllexport ) PlayEMF2( HDC hDC, HENHMETAFILE hEMF )
{
    ENHMETAHEADER emh;

    if ( !GetEnhMetaFileHeader( hEMF, sizeof( emh ), &emh ) )
        return FALSE;

    return PlayEnhMetaFile( hDC, hEMF, ( CONST RECT * ) &emh.rclFrame );
}
*/

BOOL APIENTRY __declspec( dllexport ) DeleteEMF( HENHMETAFILE hEMF )
{
    return DeleteEnhMetaFile( hEMF );
}


Let me know if you have any question on this code.

EMG


Hi Enrico , I can't compile it when I use FW64 and VS I got this message : error C2059: syntax error : 'type'
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Re:
Posted: Mon Feb 10, 2014 09:50 PM
Vikthor (or Thomas?),

Vikthor.Thomas wrote:Hi Enrico , I can't compile it when I use FW64 and VS I got this message : error C2059: syntax error : 'type'


I'm not familiar with FW64 (Win64?). At which line did you get the error? Please show me the line code.

EMG

Continue the discussion