ra_rodri 0 Newbie Poster

hello all i wrote the a dll using vb 6.0 this dll only has this function:

Public Function Impresion(ByVal Nombre As String)

    Printer.Orientation = vbPRORLandscape
    Printer.ScaleMode = vbInches
    Printer.Font = "Arial"
    Printer.CurrentX = 0.5
    Printer.CurrentY = 1
    Printer.Print Nombre
    MsgBox Nombre
    Printer.EndDoc
    DoEvents

End Function

the dlll works fine when i load it from vb 6.0

i wrote a program in c/c++ using dev c++ to load the same dll this is the code i use:

typedef void (*function1_ptr) (char *);

function1_ptr function1=NULL;


int APIENTRY WinMain(HINSTANCE, HINSTANCE, LPSTR, int) { 



    HMODULE myDll = LoadLibrary("PrintDll.dll"); 



    if(myDll) {     

       function1 = (function1_ptr) GetProcAddress(myDll,"Impresion");  
       cout<<"entro"<<endl;
       getch();
}


    if(function1) { 

       function1("xxxx");
       cout<<"entro1"<<endl;
       getch();
}


    FreeLibrary(myDll);



    return 0;
}

but the program never enters the second if (if(funtcion1)) .

i dont know why isnt working if in vb works

all help is appreciated.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.