Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to create a FLL library with VC++ of Visual Studio 6
Message
De
11/09/2001 09:20:21
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Divers
Thread ID:
00555080
Message ID:
00555095
Vues:
26
This message has been marked as the solution to the initial question of the thread.
>I'd like to create my own FLL library using Visual C++ of Visual Studio 6, but even if I correctly follow instructions of FoxHelp (Vfp 6) when I try to load the new library created VFP generates "Library file myFLL is invalid". Why???

Davide,
I just recreated and tested one of my old FLLs with exact these steps (For ease of use I keep PRO_EXT.H in VC++ include dir, WinApims.lib in lib dir):

-Launch VC++
-File New
-Selected Win32 DLL
-In location wrote c:\temp
-In project name wrote FileCopier (Writes to location itself)
-Create new workspace was selected by default
-OK then finish (Create empty DLL)
-OK to msg.
-File\new, C++ source file with file name FileCopierSource (Add to pjx checked by default)
-Project\Settings
-C++ tab, Category Code generation
Calling convention : _fastcall
Use runtime lib : Multithreaded DLL
-Link tab
Object library modules : Add winapims.lib just in front
***IMPORTANT*** Ignore all default libraries UNCHECKED

-Wrote code (below)
- F7 (shorcut for build\build)
-Renamed file to extension to .fll
* Fox test code - dir1,dir2 exist
set library to C:\temp\filecopier\Debug\filecopier.fll
FileCopyX('c:\dir1\*.*','c:\dir2')

*C++ source file
#include < windows.h >
#include < stdio.h >
#include < pro_ext.h >

char FAR *NullTerminate(Value FAR *cVal)
{
	char *RetVal;
	if (!_SetHandSize(cVal->ev_handle, cVal->ev_length + 1))
	{
		_Error(182); // "Insufficient memory"
	}
	
	((char FAR *) _HandToPtr(cVal->ev_handle))[cVal->ev_length] = '\0';
	RetVal = (char FAR *) _HandToPtr(cVal->ev_handle);
	return RetVal; 
}


void FAR FileOp(ParamBlk FAR *parm)
{
	SHFILEOPSTRUCT ShCopyInfo;
	ZeroMemory(&ShCopyInfo, sizeof (SHFILEOPSTRUCT));

	char FAR *source = NullTerminate(&parm->p[0].val);	
	char FAR *target = NullTerminate(&parm->p[1].val);
	
	ShCopyInfo.hwnd = GetActiveWindow();
	ShCopyInfo.pFrom=source;
	ShCopyInfo.pTo=target;
	ShCopyInfo.wFunc=FO_COPY;
	ShCopyInfo.fFlags=FOF_NOCONFIRMATION + FOF_NOCONFIRMMKDIR;

	int success = SHFileOperation(&ShCopyInfo);
	_RetInt(success,10);
}


FoxInfo myFoxInfo[] =
{
	{"FileCopyX", (FPFI) FileOp, 2, "CC"},
};



extern "C" {
FoxTable _FoxTable =
{
	(FoxTable *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo
};
} 
This produces an explorer style copy (with animation and prog.bar)
PS: When you're satisfied you should create a release version.
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform