How create a dll to return values ?

How create a dll to return values ?

Postby dbzap » Tue May 16, 2006 1: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)
User avatar
dbzap
 
Posts: 189
Joined: Mon Nov 07, 2005 7:36 pm
Location: Chile

Re: How create a dll to return values ?

Postby Enrico Maria Giordano » Tue May 16, 2006 2: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
User avatar
Enrico Maria Giordano
 
Posts: 8570
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Postby dbzap » Tue May 16, 2006 4:07 pm

enrico, really both !!
i dont know how it makes.
sorry
can't u help my ?
User avatar
dbzap
 
Posts: 189
Joined: Mon Nov 07, 2005 7:36 pm
Location: Chile

Postby Enrico Maria Giordano » Tue May 16, 2006 4:28 pm

This is a sample:

Code: Select all  Expand view
#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
User avatar
Enrico Maria Giordano
 
Posts: 8570
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Postby dbzap » Tue May 16, 2006 4: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.
User avatar
dbzap
 
Posts: 189
Joined: Mon Nov 07, 2005 7:36 pm
Location: Chile

Postby Enrico Maria Giordano » Tue May 16, 2006 5:57 pm

I think you can't.

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8570
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Postby dbzap » Tue May 16, 2006 6:40 pm

ok, thanks again.
User avatar
dbzap
 
Posts: 189
Joined: Mon Nov 07, 2005 7:36 pm
Location: Chile

Postby Antonio Linares » Tue May 16, 2006 7: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
User avatar
Antonio Linares
Site Admin
 
Posts: 41909
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Enrico Maria Giordano » Tue May 16, 2006 7:47 pm

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

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8570
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Postby dbzap » Tue May 16, 2006 7: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
User avatar
dbzap
 
Posts: 189
Joined: Mon Nov 07, 2005 7:36 pm
Location: Chile

Re:

Postby Vikthor.Thomas » Mon Feb 10, 2014 9:11 pm

Enrico Maria Giordano wrote:This is a sample:

Code: Select all  Expand view
#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'
User avatar
Vikthor.Thomas
 
Posts: 144
Joined: Thu Jan 02, 2014 1:49 pm

Re: Re:

Postby Enrico Maria Giordano » Mon Feb 10, 2014 9: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
User avatar
Enrico Maria Giordano
 
Posts: 8570
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 70 guests