K-Meleon

KPluginExample

#include "stdafx.h"
#define KMELEON_PLUGIN_EXPORTS
#include "kmeleon_plugin.h"
BOOL APIENTRY DllMain (
 HANDLE hModule,
 DWORD ul_reason_for_call,
 LPVOID lpReserved) { 
 return TRUE;
}
LRESULT CALLBACK WndProc (
 HWND hWnd, UINT message, 
 WPARAM wParam, 
 LPARAM lParam);
void * KMeleonWndProc;
int Init();
void Create(HWND parent);
void Config(HWND parent);
void Quit();
void DoMenu(HMENU menu, char *param);
long DoMessage(const char *to, const char *from, const char *subject, long data1, long data2);
void DoRebar(HWND rebarWnd);
int DoAccel(char *param);
kmeleonPlugin kPlugin = {
 KMEL_PLUGIN_VER,
 "A Plugin That Does Nothing",
 DoMessage
};
long DoMessage(const char *to, const char *from, const char *subject, long data1, long data2)
{
 if (to[0] == '*' || stricmp(to, kPlugin.dllname) == 0) {
 if (stricmp(subject, "Init") == 0) {
 Init();
 }
 else if (stricmp(subject, "Create") == 0) {
 Create((HWND)data1);
 }
 else if (stricmp(subject, "Config") == 0) {
 Config((HWND)data1);
 }
 else if (stricmp(subject, "Quit") == 0) {
 Quit();
 }
 else if (stricmp(subject, "DoMenu") == 0) {
 DoMenu((HMENU)data1, (char *)data2);
 }
 else if (stricmp(subject, "DoRebar") == 0) {
 DoRebar((HWND)data1);
 }
 else if (stricmp(subject, "DoAccel") == 0) {
 *(int *)data2 = DoAccel((char *)data1);
 }
 else return 0;
 return 1;
 }
 return 0;
}
int Init(){
 return true;
}
void Create(HWND parent){
 KMeleonWndProc = (void *) GetWindowLong(parent, GWL_WNDPROC);
 SetWindowLong(parent, GWL_WNDPROC, (LONG)WndProc);
}
void Config(HWND parent){
 MessageBox(parent, "This plugin does absolutely nothing", "Nothing", 0);
}
void Quit(){
}
void DoMenu(HMENU menu, char *param){
}
int DoAccel(char *param) {
 return 0;
}
void DoRebar(HWND rebarWnd){
}
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam){
 if (message == WM_COMMAND){
 WORD command = LOWORD(wParam);
 }
 return CallWindowProc((WNDPROC)KMeleonWndProc, hWnd, message, wParam, lParam);
}
extern "C" {
 KMELEON_PLUGIN kmeleonPlugin *GetKmeleonPlugin() {
 return &kPlugin;
 }
 KMELEON_PLUGIN int DrawBitmap(DRAWITEMSTRUCT *dis) {
 return 14; // 14 = icon width
 }
}


EditThisPage BackLinks PageInfo last changed on Fri Jun 29 12:54:46 2007

(c) 2000-2010 kmeleonbrowser.org. All rights reserved.
design by splif.

AltStyle によって変換されたページ (->オリジナル) /