home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Freelog 27
/
Freelog027.iso
/
bestof
/
powerpro
/
ppro32.dat
/
plugsamp.c
< prev
next >
Wrap
C/C++ Source or Header
|
2001-06-08
|
1KB
|
71 lines
/*
Sample dll for PowerPro Plug-in
*/
#define VAR_SIZE 264
#include <windows.h>
#include <stdio.h>
static HWND g_hwndPowerPro;
// Main DLL entry point. Save handle to main PowerPro window.
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD dwReason, LPVOID lpvReserved)
{
if(dwReason == DLL_PROCESS_ATTACH)
{
g_hwndPowerPro = FindWindow("PowerProMain",NULL);
}
else if(dwReason == DLL_PROCESS_DETACH)
{
// Detaching process
}
return TRUE;
}
//Show the menu whose name is given in variable M
_declspec(dllexport) void showmenu(LPSTR szv, LPSTR szx)
{
char szCommand[VAR_SIZE];
COPYDATASTRUCT cd;
strcpy(szCommand, "*Menu Show ");
strcat(szCommand, szv + ('M'-'A')*VAR_SIZE);
cd.dwData = 1;
cd.cbData = strlen(szCommand)+1;
cd.lpData=szCommand;
SendMessage(g_hwndPowerPro, WM_COPYDATA, 0, (LPARAM)&cd);
}
// Change variable x1 to contents of variable whose letter is in variable x
_declspec(dllexport) void changevar(LPSTR szv, LPSTR szx)
{
LPSTR pX = szv + ('X' - 'A') * VAR_SIZE;
char szbuf[VAR_SIZE+24];
char c = (*pX);
if ('a' <= c && c<= 'z')
c -= 'a' - 'A';
if (c<'A' || c>'Z')
MessageBox(NULL, "Variable X is not a letter","PowerPro",MB_OK|MB_TOPMOST);
else
{
strcpy(szx + ('1' - '0')*VAR_SIZE, szv + (c - 'A') * VAR_SIZE);
strcpy(szbuf,"Variable X1 reset to Variable ");
strcat(szbuf,pX);
MessageBox(NULL,szbuf,"PowerPro",MB_OK|MB_TOPMOST);
}
}