Microbasic
Aug 2nd, 2001, 10:03 AM
I'm having a little problem with this code;
#include <windows.h>
#include <cpl.h>
#include "resource.h"
//#include "CPLhhdr.h"
HINSTANCE hinst = NULL;
int WINAPI DllMain(HINSTANCE hinst, DWORD Reason, LPVOID)
{ return 1; }
LONG CALLBACK CPlApplet(HWND hwndCPL, UINT uMsg, LPARAM lParam1, LPARAM lParam2)
{
int i;
LPCPLINFO lpCPlInfo;
i = (int) lParam1;
switch (uMsg) {
case CPL_INIT: // first message, sent once
hinst = GetModuleHandle("test.cpl");
return TRUE;
case CPL_GETCOUNT: // second message, sent once
return 1;
break;
case CPL_INQUIRE: // third message, sent once per application
lpCPlInfo = (LPCPLINFO) lParam2;
lpCPlInfo->lData = 0;
lpCPlInfo->idIcon = IDI_PC;
lpCPlInfo->idName = IDS_NAME;
lpCPlInfo->idInfo = IDS_DESC;
break;
case CPL_DBLCLK: // application icon double-clicked
DialogBox(hinst, MAKEINTRESOURCE(IDD_DIALOG1), hwndCPL, NULL);
break;
case CPL_STOP: // sent once per application before CPL_EXIT
break;
case CPL_EXIT: // sent once before FreeLibrary is called
break;
default:
break;
}
return 0;
}
It's supposed to be for a control panel application file, but when compiled, it gives me this error:
LINK : warning LNK4089: all references to "USER32.dll" discarded by /OPT:REF
And Control Panel acts like the function never existed - that is, it never calls the function.
What's wrong with the code? Could someone please send me a sample source code?
#include <windows.h>
#include <cpl.h>
#include "resource.h"
//#include "CPLhhdr.h"
HINSTANCE hinst = NULL;
int WINAPI DllMain(HINSTANCE hinst, DWORD Reason, LPVOID)
{ return 1; }
LONG CALLBACK CPlApplet(HWND hwndCPL, UINT uMsg, LPARAM lParam1, LPARAM lParam2)
{
int i;
LPCPLINFO lpCPlInfo;
i = (int) lParam1;
switch (uMsg) {
case CPL_INIT: // first message, sent once
hinst = GetModuleHandle("test.cpl");
return TRUE;
case CPL_GETCOUNT: // second message, sent once
return 1;
break;
case CPL_INQUIRE: // third message, sent once per application
lpCPlInfo = (LPCPLINFO) lParam2;
lpCPlInfo->lData = 0;
lpCPlInfo->idIcon = IDI_PC;
lpCPlInfo->idName = IDS_NAME;
lpCPlInfo->idInfo = IDS_DESC;
break;
case CPL_DBLCLK: // application icon double-clicked
DialogBox(hinst, MAKEINTRESOURCE(IDD_DIALOG1), hwndCPL, NULL);
break;
case CPL_STOP: // sent once per application before CPL_EXIT
break;
case CPL_EXIT: // sent once before FreeLibrary is called
break;
default:
break;
}
return 0;
}
It's supposed to be for a control panel application file, but when compiled, it gives me this error:
LINK : warning LNK4089: all references to "USER32.dll" discarded by /OPT:REF
And Control Panel acts like the function never existed - that is, it never calls the function.
What's wrong with the code? Could someone please send me a sample source code?