alaphate Posted February 6, 2010 Posted February 6, 2010 (edited) I'm leaning BHO programming with this tutorial./>http://www.codeproject.com/KB/shell/BHOinCPP.aspxI used VC6 to compile the project, and got the error:cannot convert from 'const struct _GUID' to 'unsigned long'from the line:const IID CClassFactory::SupportedIIDs[]={IID_IUnknown,IID_IClassFactory};SupportedIIDs is an array (class member of CClassFactory) which is declared as:private: static const IID SupportedIIDs[2];in SDK (Guiddef.h), IID is declared as:typedef GUID IIDtypedef struct _GUID { unsigned long Data1; unsigned short Data2; unsigned short Data3; unsigned char Data4[ 8 ];} GUID;the attachment is the VC6 project.Thank you for helping.bho.zip Edited February 6, 2010 by alaphate
enhzflep Posted February 8, 2010 Posted February 8, 2010 Never looked at BHOs, or even very much COM programming, to be honest.With that in mind, I've no idea if the mods I've made are ridiculous or just what is required to achieve a functioning program.For the error that you mention in the following code:const IID CClassFactory::SupportedIIDs[]={IID_IUnknown,IID_IClassFactory};I found a solution that will compile to be:const IID CClassFactory::SupportedIIDs[]={(unsigned long)&IID_IUnknown,(unsigned long)&IID_IClassFactory};I then notice complaints about InterlockedDecrement(&DllRefCount);which compile when turned into:InterlockedDecrement((long*)&DllRefCount);Anyhow, here's what I came up with:bho-edited.zip
alaphate Posted February 8, 2010 Author Posted February 8, 2010 (edited) enhzflep,Thank you very much for your reply.It's more like a c++ syntax issue.To make the question more clear, I wrote a short code below:#include <iostream>using namespace std;typedef struct _IID { int a; int b;} IID;IID IID_HELLO = {1,2};IID IID_WORLD = {3,4};//class with static memberclass Program {private: static IID arr[2]; //static member has to be initialized outside class};//with errors blow:IID Program::arr[] = {IID_HELLO, IID_WORLD};//if change it to://IID Program::arr[] = {{1,2},{3,4}}; //with no errorsint main() { cout<<"hello world!"<<endl; return 0;}Problem is it is not easy to find IID_IUNKOWN's instant value in the BHO prj,so I have to keep {IID_IUnknown,IID_IClassFactory}.the attachment is this new project.struct.zip Edited February 21, 2010 by alaphate
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now