Jump to content
View in the app

A better way to browse. Learn more.

Tuts 4 You

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

BHO project compiling errors, c++

Featured Replies

Posted

I'm leaning BHO programming with this tutorial.
/>http://www.codeproject.com/KB/shell/BHOinCPP.aspx

I 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 IID

typedef 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 by alaphate

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

  • Author

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 member
class 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 by alaphate

Create an account or sign in to comment

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.