Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

C++ Dll????

Status
Not open for further replies.

Blixten69

Programmer
Oct 4, 2004
1
SE
Didnt know if i should have put it under C++ Or VB

Well i found a c++ code that allowed u to add the c++ dll in the refrence menu.. All this workes fine and everything..
"
//MYDll.cpp
void __stdcall Dll_PrintIT(HDC hdc, int x, int y, int Height, int Width, HDC hdc2, int sx, int sy)
{
BitBlt(hdc,x,y,Height,Width,hdc2,sx,sy,SRCCOPY);
}

//MYDll.odl

library MyDll
{
module MyDllFunctions
{
[
helpstring("Bitblt a hdc to another"),
entry("Dll_PrintIT")
]
void __stdcall PrintBit([in] HDC hdc, [in] int x,
[in] int y, [in] int Height,
[in] int Width, [in] HDC hdc2,
[in] int sx, [in] int sy);
}
}


"
Is used to specifie the function/sub..
Now the problem is that when i now import this DLL to Vb i has transformed the HDC in to a wireHDC... and i am not abel to use the sub.... but if i change the HDC to int it works but it dosent find the correct function because BITBLT in C++ had to have an HDC variabel..
Dose anyone know how to fix this problem???
I can send source code if u want to look at the whole C++ code.. but i got the importatnt bits in.. i hope :D...
 
Hi Blixten69:

I am going way out on a limb in this reply. So, please forgive me if I lead you astray.

I am not sure which function you are trying to access above, but the first one, I would start by declaring
Code:
Public Declare Sub Dll_PrintIT Lib "MYDLL" Alias "DLL_Print" ( _
    ByVal hdc As Long, _
    ByVal x As Long, _
    ByVal y As Long, _
    ByVal Height As Long, _
    ByVal Width As Long, _
    ByVal hdc2 As Long, _
    ByVal sx As Long, _
    ByVal sy As Long)

This is per Microsoft's Help file, under the item "Converting C Declarations To Visual Basic".

HTH,
Cassandra
 
Is there some reason why you don't just call BitBlt from VB?
Declare it from the GDI library and use it directly.
(Check the API viewer for the definitions)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top