Now we are talking. This is what the jangle surrounding plug-ins is all about. The avi extension stands for Audio Video Interleave. That means it can conveniently play sound and show screenful of video at the same time. That does sound rather splashy, but following is the code for it. Before going further, make sure you do this:
#include<afxwin.h> #include "npapi.h" #include "npupp.h" #include "vfw.h" char a[100]; char c[100]; class yyy:public CWnd { public: void OnLButtonDown(UINT, CPoint p) { HWND h; h = MCIWndCreate(this->GetSafeHwnd(), AfxGetInstanceHandle(), WS_CHILD | WS_CAPTION | WS_VISIBLE | MCIWNDF_SHOWPOS | MCIWNDF_SHOWNAME, c); } DECLARE_MESSAGE_MAP() }; BEGIN_MESSAGE_MAP(yyy, CWnd) ON_WM_LBUTTONDOWN() END_MESSAGE_MAP() yyy *b; CWinApp q; short _stdcall NP_Initialize(NPNetscapeFuncs *p) { MessageBox(0, "in initialize", "in initialize", 0); return 0; } short aa(char *p, NPP i, unsigned short m, short c, char * n[], char *v[], NPSavedData *s) { MessageBox(0, "in aa", "hi", 0); return 0; } short bb(NPP i, NPWindow *w) { MessageBox(0, "in bb", "hi", 0); if (b == 0 && w->window) { b = new yyy; b->SubclassWindow( (HWND)w->window ); } return 0; } short cc(NPP i, char * p, NPStream *s, NPBool a, unsigned short *b) { MessageBox(0, "in cc", "hi", 0); *b = NP_ASFILE; return 0; } long dd(NPP i, NPStream *s) { MessageBox(0, "in dd", "hi", 0); return 0xffffff; } long ee(NPP i, NPStream *s, long o, long l, void *b) { return l; } void ff(NPP i, NPStream *s, const char *f) { strcpy(c, f); MessageBox(0, c, f,0); } short _stdcall NP_GetEntryPoints(NPPluginFuncs *p) { MessageBox(0, "in get entry points", "in get entry points", 0); p->newp = aa; p->setwindow = bb; p->newstream = cc; p->writeready = dd; p->write = ee; p->asfile = ff; return 0; } short _stdcall NP_Shutdown() { MessageBox(0, "in shutdown", "in shutdown", 0); return 0; }
Their names | Our names |
---|---|
NPP_New | aa() |
NPP_NewStream | bb() |
NPP_WriteReady | cc() |
NPP_Write | dd() |
NPP_StreamAsFile | ee() |
NPP_SetWindow | ff() |
Weak in the knees already? How about multiple embed statements ? Just speed to the next topic or pull up to see a real-life avi plug-in designed by some of our Netscape-diehards.
Got something that you are dying to tell someone but have no one to turn to? Well, this is not an agony column, but should you have any problems with Netscape plug-ins, help is just a click away...
Swivel round to Vijay Mukhi's Technology Cornucopia
Please note that this document really likes the Netscape browser