Re: call a .DLL in a VB form
Try debugging the value of Cproduct. Then it might tell you why Cproduct mod 2 <> 0.
-Cool Bizs
Re: call a .DLL in a VB form
hi cool Bizs, u in the same time zone as me?
Re: call a .DLL in a VB form
Try this.
#include <windows.h>
LONG __stdcall Multiply(int Cheight, int Cwidth)
{
INT CProduct;
Cproduct = Cheight * Cwidth;
return CProduct;
}
Then in the VB Program
option Explicit
private Declare Sub Multiply Lib "C:\dlldemo.dll" (byval Cheight as Integer, byval Cwidth as Integer) as long
'-------------------------------------------------------------------
'In my form, upon OK button is clicked....
private Sub CmdOk_Click()
Dim Cheight as Integer, Cwidth as Integer, Cproduct as Long
Cheight = Val(txtHeight.Text) 'input height from textbox
Cwidth = Val(txtWidth.Text) 'input width from textbox
cProduct = Multiply(Cheight, Cwidth) ' call DLL
If Cproduct Mod 2 <> 0 then 'return(Cproduct) the computed value in .DLL to here...
'POP up a msgbox if the computed Cproduct is an odd num...
MsgBox "The values generate an odd number of icons." & vbCrLf & _ "Change Width and/or Height so that their product " & vbCrLf & _ "is an even number.", vbInformation, "Change Width and/or Height"
Exit Sub
Hope this helps
Re: call a .DLL in a VB form
Well .. I live in Malaysia (for another 2 weeks) and will be back in Stamford CT USA after that. Where are you from?
-Cool Bizs