******************************************************* Instructions *****************************************************
(1) Make a folder named C:\dll
// strdll.cpp : Defines the entry point for the DLL application.
//
#include "stdafx.h"
#include "string.h"
#include "iostream.h"
#include "stdlib.h"
BOOL APIENTRY DllMain( HANDLE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
return TRUE;
}
typedef struct {
char *a;
char *b;
}VB_UDT;
void WINAPI TestFunc(VB_UDT *pudt)
{
MessageBox(NULL, pudt->a, pudt->b, MB_ICONINFORMATION | MB_TASKMODAL);
MessageBox(NULL, strcat(pudt->a,pudt->b), pudt->b, MB_ICONINFORMATION | MB_TASKMODAL);
MessageBox(NULL, itoa(strlen(pudt->a),pudt->a,10), pudt->b, MB_ICONINFORMATION | MB_TASKMODAL);
MessageBox(NULL, itoa(strcmp(pudt->a, pudt->b),pudt->a,10), pudt->b, MB_ICONINFORMATION | MB_TASKMODAL);
MessageBox(NULL, strstr(pudt->a, pudt->b), pudt->b, MB_ICONINFORMATION | MB_TASKMODAL);
MessageBox(NULL, strcpy(pudt->a,pudt->b), pudt->b, MB_ICONINFORMATION | MB_TASKMODAL);
}
(1) Make a folder named C:\dll
(2) In that make a project named strdll ,make c++ file & copy strdll.cpp in it...
(3) Then copy vbpofdll in vbp prg & make form like dllpaint.jpg
(4) Also make def file as strdef like strdef.txt...
(5) make .dll & ENjoy with basic string operations...
**************************************************** strdll.cpp ***********************************************************// strdll.cpp : Defines the entry point for the DLL application.
//
#include "stdafx.h"
#include "string.h"
#include "iostream.h"
#include "stdlib.h"
BOOL APIENTRY DllMain( HANDLE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
return TRUE;
}
typedef struct {
char *a;
char *b;
}VB_UDT;
void WINAPI TestFunc(VB_UDT *pudt)
{
MessageBox(NULL, pudt->a, pudt->b, MB_ICONINFORMATION | MB_TASKMODAL);
MessageBox(NULL, strcat(pudt->a,pudt->b), pudt->b, MB_ICONINFORMATION | MB_TASKMODAL);
MessageBox(NULL, itoa(strlen(pudt->a),pudt->a,10), pudt->b, MB_ICONINFORMATION | MB_TASKMODAL);
MessageBox(NULL, itoa(strcmp(pudt->a, pudt->b),pudt->a,10), pudt->b, MB_ICONINFORMATION | MB_TASKMODAL);
MessageBox(NULL, strstr(pudt->a, pudt->b), pudt->b, MB_ICONINFORMATION | MB_TASKMODAL);
MessageBox(NULL, strcpy(pudt->a,pudt->b), pudt->b, MB_ICONINFORMATION | MB_TASKMODAL);
}
**************************************************** strdef.txt ***********************************************************
LIBRARY strdll
EXPORTS
TestFunc @1
*************************************************** vbpofdll.txt *********************************************************
Private Declare Sub TestFunc Lib "C:\dll\Debug\strdll.dll" (ByRef pudt As VB_UDT)
Private Type VB_UDT
a As String
b As String
End Type
Private Sub Command1_Click()
Dim udt As VB_UDT
udt.a = Text1.Text
udt.b = Text2.Text
Call TestFunc(udt)
End Sub
*************************************************** dllpaint.jpg *********************************************************
No comments:
Post a Comment