|
Is there a way to monitor a control (TreeView) from another program(AIM) to see if it has changed?
|
|
|
|
|
The best way is to create an application hook, and subclassing the parent window of the control, or the control itself ( depending on your needs!) in the hook function.
P.S: Take a look at the Hooks topic on the sdk docs
don´t worry drink happy
|
|
|
|
|
You can use WM_COPYDATA, that way you can also indicate something about what the new selection is.
Nish
The posting stats are now in PDF:-
http://www.busterboy.org/codeproject/
Feel free to make your comments.
Updated - May 04th, Saturday
|
|
|
|
|
I have downloaded the IE Security Manger sample (http://download.microsoft.com/download/ie5/secumgr/1/w9xnt4/en-us/Secumgr.exe [new window]) and it works without problem (prevents scripts/ActiveX/etc. in hosted WebBrowser).
However, I copied the custsite.h and custsite.cpp files into my project and removed the references to the dialog used in the sample. These files provide an extended COleControlSite and COccManager. I replaced the use of the dialog variables from the sample with global variables in my project.
Unfortunately in my project I get the following linker error when trying to build it in to my project:
custsite.obj : error LNK2001: unresolved external symbol "protected: static struct AFX_INTERFACEMAP const COleControlSite::interfaceMap" (?interfaceMap@COleControlSite@@1UAFX_INTERFACEMAP@@B)
Please can someone explain why and how to fix it. I've looked everywhere to try and find it and I can't
Derek Lakin.
I wish I was what I thought I was when I wished I was what I am.
Salamander Software Ltd.
|
|
|
|
|
Hey Guys
I have been trying to export a class from a DLL for ages now and had little luck could someone post a quick example or tutorial on how to export a class.
Peter
|
|
|
|
|
This example was generated by the app wizards for a DLL.
Here is the header file:
#ifdef EXAMPLE_EXPORTS
#define EXAMPLE_API __declspec(dllexport)
#else
#define EXAMPLE_API __declspec(dllimport)
#endif
class EXAMPLE_API CExample {
public:
CExample(void);
};
extern EXAMPLE_API int nExample;
EXAMPLE_API int fnExample(void);
Here is the cpp file:
#include "stdafx.h"
#include "example.h"
BOOL APIENTRY DllMain( HANDLE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}
EXAMPLE_API int nExample=0;
EXAMPLE_API int fnExample(void)
{
return 42;
}
CExample::CExample()
{
return;
}
Good Luck!
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
class AFX_EXT_CLASS CMyClass
{
...
}
Cheers,
Tom Archer
Author, Inside C#
Author, Visual C++.NET Bible
A total abstainer is one who abstains from everything but abstention, and especially from inactivity in the af
|
|
|
|
|
When using the 'Properties' window in Visual C++ .Net and adding a handler for a Windows message (or overriding a virtual function), the VC++ .NET IDE adds the prototype as a 'public:' member.
This is a pain since I then have to go and cut and paste it into the 'protected:' section of my class def.
Does anyone know how to get the IDE to put it in the protected section for me like VC 6 used to do?
It makes no sense to me that a WM_LBUTTONDOWN handler be made public: by default!
|
|
|
|
|
Where should I post my TurboC++ / ASM / BIOS question?
I need a way to wake up the BIOS chip on an AGP card under DOS environment.
Can anyone help ??
Thank you!
Maxwell Chen
People say "No news is good news". Then, no code is good code!?
|
|
|
|
|
Oh, damn I accidentally postd this in the Lounge...now heres it is. I'd appreciate ny help.
Can somebody help me. I'm trying to create an array of pointers. I'd do something like this:
int *array[SIZE];
But the array's large so I'd like to use the _new_ operator. How do I do that?
I've tried the following without luck:
int ** array = new int[size];
int * array = new *int[size];
Plz help
|
|
|
|
|
int *array[SIZE];
for(int i=0;i<SIZE;i++)
array[i] = new int;
Nish
The posting stats are now in PDF:-
http://www.busterboy.org/codeproject/
Feel free to make your comments.
Updated - May 04th, Saturday
|
|
|
|
|
You were close:
int **array = new int*[SIZE];
That will allocate an array of integer pointers that has SIZE number of elements.
Just for everyone's knowledge, to access the pointers in this new array, you will need to do something like this:
int a = 10;
int b = 20;
int c = 30;
array[0] = &a;
array[1] = &b;
array[2] = new int;
*array[2] = 50;
array[3] = new int[10];
array[3][0] = 100;
just remember to delete any memory that you allocate, even in the pointers inside of your allocated array.
Good Luck!
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
Some day I asked Bjarne Stroustrup a question to dynamically allocating square array ( 2 X 2 or 3 X 3 or 10 X 10 ... ), He told me to use vector!
Maxwell Chen
People say "No news is good news". Then, no code is good code!?
|
|
|
|
|
He's a wise man.
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
And you don't spend much time with the opposite sex working day and night, unless the pizza delivery person happens to be young, cute, single and female. I can assure you, I've consumed more than a programmer's allotment of pizza, and these conditions have never aligned. - Christopher Duncan - 18/04/2002
|
|
|
|
|
His way is nice!
But finally I approached my goal via a template class that wraps a low-level 2d int array.
Maxwell Chen
People say "No news is good news". Then, no code is good code!?
|
|
|
|
|
Hi.
I would like to create a generic class that wraps around, say, an API function. I need a way to pass into a function parameters such as FEATURE1 | FEATURE3. I believe that requires the use of bitwise AND, OR, and NOT similar to MFC programming style.
For example:
-----
// call function to initialize variables
SetVariableA(FEATURE1 | FEATURE 3) // I want feature1 and feature3
-----
Here is what SetVariableA(...) might look like
-----
enum STYLE {FEATURE1 = 0, FEATURE2, FEATURE3}
SetVariableA(...)
{
}
-----
Basically, I am not familiar with the use of enum with bitwise AND, OR, and NOT. Here is a what I would like to accomplish.
- user calls function to setup a feature: function(FEATURE1)
- function determines what feature the user wants
How would you implement some like the above using enum, bitwise AND, OR, and NOT?
Thanks,
Kuphryn
P.S. MFC programmers seem to use the bitwise AND, OR, and NOT
|
|
|
|
|
setVariableA (UINT bitMask)
{
enum STYLE styleIterator;
for (enum STYLE styleIterator=FEATURE1; (styleIterator <= FEATURE3) styleIterator++) {
if (bitMask & styleIterator) {
...
}
}
} /ravi
"There is always one more bug..."
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Hi Ravi,
Your code doesn't compile, there're several errors. Check your code, compile it, and you will see!
Maxwell Chen
People say "No news is good news". Then, no code is good code!?
|
|
|
|
|
Thanks.
Your sample code helped me understand *almost* everything. I have two questions.
1) I assume enum STYLE is *defined* as global inside whatever class setVariableA(UINT bitMask) belongs to. Right?
-----
enum STYLE {FEATURE1 = 0, FEATURE2, FEATURE3}
class CArbitrary
{
public:
setVariableA(UINT bitMask);
};
-----
If yes: Will the class that declare CArbitrary understand what, for example, FEATURE1 actually is?
For example:
-----
setVariableA(FEATURE2);
-----
// FEATURE2 is defined is enum STYLE
// However, SetVariableA(UINT bitMask)
// UINT == enum STYLE?
2) In the code you posted, I cases (bitMask & FEATURE1), etc., but how about cases such as FEATURE1 | FEATURE3?
Thanks,
Kuphryn
|
|
|
|
|
Hi Kuphryn,
While wrapping such functions in a class, you use this way:
#include <iostreamᡊe9ac73-238b-46be-991d-0f050c37248dusing namespace std;
class MyCtrl
{
public:
enum ST { enType1 = 0x01, enType2 = 0x02, enType3 = 0x04 };
void SetVar(int style)
{
int tt;
for(tt = enType1; tt <= enType3; tt = (tt << 1))
{
if(style & tt)
cout << "Type " << tt / 2 + 1 << " implemented\n";
}
}
};
void main()
{
MyCtrl ctrl;
ctrl.SetVar(MyCtrl::enType1 | MyCtrl::enType3);
}
Maxwell Chen
People say "No news is good news". Then, no code is good code!?
|
|
|
|
|
Ugh. What was I thinking? Of course you have to bit shift (and not sequence thru like I did) a mask. I'm going to hold doff posting until I'm sufficiently awake!
/ravi
"There is always one more bug..."
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Maxwell Chen
People say "No news is good news". Then, no code is good code!?
|
|
|
|
|
I used to do this way......
#include <iostreamᡊe9ac73-238b-46be-991d-0f050c37248dusing namespace std;
enum ST { enType1 = 0x01, enType2 = 0x02, enType3 = 0x03 };
void SetVar(int style)
{
int tt;
for(tt = enType1; tt <= enType3; tt = (tt << 1))
{
if(style & tt)
cout << "Type " << tt / 2 + 1 << " implemented\n";
}
}
void main()
{
SetVar(enType1 | enType3);
}
Maxwell Chen
People say "No news is good news". Then, no code is good code!?
|
|
|
|
|
Thanks.
Please read my reply above.
Kuphryn
|
|
|
|
|
I would not use an enum, but rather just a set of defines for every flag
#define FEATURE1 0x00000001 // bit one
#define FEATURE2 0x00000002 // bit two
#define FEATURE3 0x00000004 // bit three
#define FEATURE4 0x00000008 // bit four
#define FEATURE5 0x00000010 // bit five
.
.
. This will give you up to 32 flags.
Then, the parameter used to set the flags would be a DWORD
void SetVariableA (DWORD dwflags = 0);
You would call it this way
SetVariableA (FEATURE1 | FEATURE3);
Then, inside SetVariableA() you would check to see which flags have been set by using the bitwise AND ( & ) operator
void SetVariableA (DWORD dwFlags)
{
if (dwFlags & FEATURE1)
{
}
if (dwFlags & FEATURE2)
{
.
.
.
HTH
---
CPUA 0x5041
Sonork 100.11743 Chicken Little
If a man is standing in the middle of the forest speaking and there is no woman around to hear him...is he still wrong?
|
|
|
|