|
i Used RegNotifyChangeKeyValue for monitoring the changes all subkeys in the one of the selected Root Key(For Ex.HKEY_CLASSES_ROOT) .
But Am not getting how i can capture the changed registry key name,value,status(created/modified/deleted).
Can Any one tell about this...............
Kiran.V
-- modified at 13:32 Tuesday 25th April, 2006
|
|
|
|
|
Hello to all
I developed a DLL, to which I added a control to him OCX, but the dialog box called from dll function still does not show
Helpme
Thank
alferx
|
|
|
|
|
|
Hi,
If you can download the project, and help me in some way... is only a class and its goal es mainly:
* To have an image at the back (alphablended with AlphaBlend function), and if the window receive ScrollWindow() messages, to don't move.
It work all right, but if I've some controls on it, they will be drawn on the alphablended image, so if you move the window, later it will be visible.
Just open the zip, compile it (I've Visual Studio .NET 2003), and press "ACCEPT" to load the alphablended image, and you must press "CANCEL" several times to make the window scroll.
I'm new to GDI, and maybe there are lots of things very bad. I will appreciate a lot your comments, to learn more.
Here you can download the file !!
THANK YOU VERY MUCH !!!
|
|
|
|
|
Well if you're curious, here you are:
ImagenTransparente.cpp
<br />
<br />
#include "stdafx.h"<br />
#include "Transparencia.h"<br />
#include "ImagenTransparente.h"<br />
#include ".\imagentransparente.h"<br />
<br />
<br />
<br />
IMPLEMENT_DYNAMIC(ImagenTransparente, CStatic)<br />
ImagenTransparente::ImagenTransparente(int nID, BYTE transparencia )<br />
{<br />
bm.LoadBitmap(nID);<br />
<br />
bm.GetBitmap(&BitMap);<br />
m_nWidth = BitMap.bmWidth;<br />
m_nHeight = BitMap.bmHeight;<br />
<br />
bf.AlphaFormat = 0;<br />
bf.BlendFlags = 0;<br />
bf.BlendOp = AC_SRC_OVER;<br />
bf.SourceConstantAlpha = transparencia;<br />
<br />
this->nID = nID;<br />
}<br />
<br />
ImagenTransparente::~ImagenTransparente()<br />
{<br />
}<br />
<br />
<br />
BEGIN_MESSAGE_MAP(ImagenTransparente, CStatic)<br />
ON_WM_CREATE()<br />
ON_WM_PAINT()<br />
ON_WM_ERASEBKGND()<br />
ON_WM_MOVE()<br />
END_MESSAGE_MAP()<br />
<br />
<br />
<br />
<br />
<br />
int ImagenTransparente::OnCreate(LPCREATESTRUCT lpCreateStruct)<br />
{<br />
if (CStatic::OnCreate(lpCreateStruct) == -1)<br />
return -1;<br />
<br />
CRect rect;<br />
GetWindowRect(&rect);<br />
GetParent()->ScreenToClient(&rect);<br />
<br />
miPosicion.left = rect.left;<br />
miPosicion.right = rect.right;<br />
miPosicion.top = rect.top;<br />
miPosicion.bottom = rect.bottom;<br />
<br />
this->izquierda = rect.left;<br />
this->arriba = rect.top;<br />
<br />
CClientDC dc(this);<br />
<br />
CDC MemDC;<br />
MemDC.CreateCompatibleDC(&dc);<br />
CBitmap MemBmp;<br />
MemBmp.CreateCompatibleBitmap(&dc, m_nWidth, m_nHeight);<br />
CBitmap *pOldMemBmp = MemDC.SelectObject(&MemBmp);<br />
<br />
CDC MemDC2;<br />
MemDC2.CreateCompatibleDC(&dc);<br />
CBitmap *pOldbmp = MemDC2.SelectObject(&bm);<br />
MemDC.BitBlt(0, 0, m_nWidth, m_nHeight, &MemDC2, 0, 0, SRCCOPY);<br />
MemDC2.SelectObject(pOldbmp);<br />
<br />
dc.AlphaBlend(0, 0, m_nWidth, m_nHeight, &MemDC, 0, 0, m_nWidth, m_nHeight, bf);<br />
<br />
MemDC.SelectObject(pOldMemBmp);<br />
<br />
return 0;<br />
}<br />
<br />
void ImagenTransparente::OnPaint()<br />
{<br />
CPaintDC dc(this);
<br />
CDC MemDC;<br />
MemDC.CreateCompatibleDC(&dc);<br />
CBitmap MemBmp;<br />
MemBmp.CreateCompatibleBitmap(&dc, m_nWidth, m_nHeight);<br />
<br />
CBitmap *pOldMemBmp = MemDC.SelectObject(&MemBmp);<br />
<br />
CDC MemDC2;<br />
MemDC2.CreateCompatibleDC(&dc);<br />
CBitmap *pOldbmp = MemDC2.SelectObject(&bm);<br />
MemDC.BitBlt(0, 0, m_nWidth, m_nHeight, &MemDC2, 0, 0, SRCCOPY);<br />
MemDC2.SelectObject(pOldbmp);<br />
<br />
<br />
dc.AlphaBlend(0, 0, m_nWidth, m_nHeight, &MemDC, 0, 0, m_nWidth, m_nHeight, bf);<br />
<br />
MemDC.SelectObject(pOldMemBmp);<br />
}<br />
<br />
BOOL ImagenTransparente::OnEraseBkgnd(CDC* pDC)<br />
{<br />
return TRUE;<br />
}<br />
<br />
void ImagenTransparente::OnMove(int x, int y)<br />
{<br />
this->SetWindowPos(&CWnd::wndBottom, miPosicion.left, miPosicion.top, miPosicion.right - miPosicion.left, miPosicion.bottom - miPosicion.top, 0);<br />
GetParent()->Invalidate();<br />
}<br />
ImagenTransparente.h
<br />
#pragma once<br />
<br />
<br />
<br />
class ImagenTransparente : public CStatic<br />
{<br />
DECLARE_DYNAMIC(ImagenTransparente)<br />
<br />
public:<br />
ImagenTransparente(int nID, BYTE transparencia = 0x7f );<br />
virtual ~ImagenTransparente();<br />
<br />
protected:<br />
DECLARE_MESSAGE_MAP()<br />
<br />
private:<br />
CBitmap bm;<br />
BITMAP BitMap;<br />
BLENDFUNCTION bf;<br />
CRect miPosicion;<br />
<br />
int m_nWidth;<br />
int m_nHeight;<br />
int izquierda;<br />
int arriba;<br />
int nID;<br />
public:<br />
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);<br />
afx_msg void OnPaint();<br />
afx_msg BOOL OnEraseBkgnd(CDC* pDC);<br />
afx_msg void OnMove(int x, int y);<br />
};<br />
|
|
|
|
|
What to do use arrays for? please give an example. And why multi-demensions arrays.
|
|
|
|
|
|
His sentences were very coherent to me. Why are they giving you trouble?
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"We will be known forever by the tracks we leave." - Native American Proverb
|
|
|
|
|
"What to do use arrays for?"
is this english ?
|
|
|
|
|
While it is bad grammar, yes it is certainly English.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"We will be known forever by the tracks we leave." - Native American Proverb
|
|
|
|
|
#hackC++ wrote: What to do use arrays for?
To hold more than one of an item.
#hackC++ wrote: please give an example.
An array of baseball cards, phone numbers, computer names, songs, etc.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"We will be known forever by the tracks we leave." - Native American Proverb
|
|
|
|
|
After reading an article on CP about exceptions, I wanted to test efficiency of exceptions compared to normal error checking by using the following program, but when run in debug mode it says there is an unhandled exception. What am I doing wrong ?
<br />
#include "stdafx.h"<br />
<br />
using namespace std;<br />
<br />
int _tmain(int argc, _TCHAR* argv[])<br />
{<br />
DWORD dwStart = ::GetTickCount();
const int x = 1000000;<br />
const int xEnd = -x;<br />
int y = x;<br />
int z;<br />
<br />
while ( y > xEnd )<br />
{<br />
try<br />
{<br />
while ( y > xEnd )<br />
z = x / y--;
}<br />
catch (...)<br />
{<br />
cout << "Divide by zero" << endl;
y--;
}<br />
}<br />
<br />
DWORD dwStop = ::GetTickCount();<br />
DWORD dwDiff = dwStop - dwStart;<br />
char csMessage[100];<br />
sprintf(csMessage, "mSec = %d\n", dwDiff);<br />
cout << (LPCTSTR)csMessage << endl;<br />
<br />
return 0;<br />
}<br />
|
|
|
|
|
interesting.
did u see output cout<<...?
if not, i guess "catch" can not catch num/0 because CPU can not treat things like this.
|
|
|
|
|
Because dividing by zero is a hardware exception not a language exception - this is the way C++ is supposed to behave. MSVC6 got it wrong. Newer versions have the /EHa switch to switch to the old non-standard behaviour.
Steve
|
|
|
|
|
Thanks for the info Steve. I'm haven't really used exceptions before, so I'm trying to understand when they should be used and when they shouldn't be used.
However, it did not completely solve the problem. When using the /EHa switch, the exception seems to get caught, but the catch{} handler is not called (ie. the message is not printed out). I tried using Microsoft own example below, but again the message "Caught an exception in...." is not displayed. Why isn't the catch(...){} block being executed ?
Also, since hardware exceptions should not be caught in standard C++, what would be the correct way to handle such an exception (eg. divide-by-zero) in a standards compliant way (eg. using if (0 == y) checks ?) ?
#include <iostream><br />
#include <excpt.h><br />
using namespace std;<br />
<br />
void fail() {
try {<br />
int i = 0, j = 1;<br />
j /= i;
}<br />
catch(...) {
cout<<"Caught an exception in catch(...)."<<endl;<br />
}<br />
}<br />
<br />
int main() {<br />
__try {<br />
fail(); <br />
}<br />
<br />
__except(EXCEPTION_EXECUTE_HANDLER) { <br />
cout << "An exception was caught in __except." << endl;<br />
}<br />
}
|
|
|
|
|
Hi
I'm working in a two way authentification system, that replaces the GINA.
The problem I had found with the beta testers, is that they don't really know their user and passwords, because XP always remember their names, or if they are the only one user, XP don't even ask them to login.
The outcome of all this, is that once installed the new GINA and they reboot the machine, they can't login anymore.
So, the question is...
Is any way an application can check if the user and password are valid?
Thanks in advance
|
|
|
|
|
Doing a random project for school. blah. Been fighting with it and I'm sure I'm missing some little problem and my buddies who usually read over my code for me are out of town for the week. Yay for procrastination! Anyway, if anyone can spare 5 minutes to look it over. It's about 90% done, couple bools need to be made useful, but I need to figure out the following errors :
error C2228: left of '.append' must have class/struct/union type line 25
error C2228: left of '.chop' must have class/struct/union type line 35
error C2228: left of '.print' must have class/struct/union type line 45
Main file
#include <iostream>
#include "class.h"
using namespace std;
void main ()
{
int n;
int elem;
int pointedArray[10];
int *array = 0;
bool completion = false;
elem = 10;
for (n = 0; n < elem; n++)
{
cout << "Enter value for element " << n+1 << " of the array : ";
cin >> pointedArray[n];
}
array = &pointedArray[0];
Array ar1 (int array[], int elem);
completion = ar1.append();
if (completion == true)
{
cout << "Append successful!" << endl;
}
else
{
cout << "Append Unsuccessful!!" << endl;
}
completion = false;
completion = ar1.chop();
if (completion == true)
{
cout << "Chop successful!" << endl;
}
else
{
cout << "Chop Unsuccessful!!" << endl;
}
completion = false;
completion = ar1.print();
if (completion == true)
{
cout << "Print successful!" << endl;
}
else
{
cout << "Print Unsuccessful!!" << endl;
}
completion = false;
system ("pause");
}
Header File
#include <iostream>
using namespace std;
int i;
class Array
{
private:
int element;
int *pArray;
bool extend();
bool contract();
public:
Array ( );
Array (int array[]);
Array (int elem);
Array (int array[], int elem);
~Array () {}
bool append();
bool chop();
bool print();
bool success;
};
Array :: Array ( )
{
pArray = 0;
}
Array::Array (int array[])
{
pArray = &array[0];
}
Array::Array (int elem)
{
pArray = 0;
element = elem;
}
Array::Array (int array[], int elem)
{
pArray = &array[0];
element = elem;
}
bool Array :: append()
{
success = extend();
cout << "Please input new element value: ";
cin >> pArray[10];
return (true);
}
bool Array:: extend()
{
int temp[11];
for(i = 0; i < (element); i++)
{
pArray[i] = temp[i];
}
pArray = &temp[0];
return (true);
}
bool Array :: chop()
{
success = contract();
return (true);
}
bool Array:: contract()
{
int temp2[9];
for(i = 0; i < (9); i++)
{
pArray[i] = temp2[i];
}
element -= 1;
pArray = &temp2[0];
return (true);
}
bool Array :: print()
{
for (i = 0; i < element; i++)
{
cout << "The value of element " << i << " is " << pArray[i] << endl;
}
return (true);
}
With modifications per request
-- modified at 12:33 Tuesday 25th April, 2006
|
|
|
|
|
Surround your code snippet with <pre> tags, check indentation, make sure #include directives are visible, and lastly, click the Preview button first before posting.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"We will be known forever by the tracks we leave." - Native American Proverb
|
|
|
|
|
JarethAshaer wrote: error C2228: left of '.append' must have class/struct/union type line 25
error C2228: left of '.chop' must have class/struct/union type line 35
error C2228: left of '.print' must have class/struct/union type line 45
Makes me think that something is wrong with your declaration of ar1.
JarethAshaer wrote: Array ar1 (int array[], int elem);
get rid of the two int keywords in this declaration.
|
|
|
|
|
no go with the int. I forgot to put in that if I use the default constructor (I.E. Array ar1();) the program works.
|
|
|
|
|
I am not sure we are talking about the same thing. This is the code that I am referring to
<br />
...<br />
array = &pointedArray[0];<br />
Array ar1 (int array[], int elem);<br />
completion = ar1.append();<br />
...<br />
remove those int keywords.
|
|
|
|
|
I did. I changed it to Array ar1 (array[], elem); and it didn't work
also, if I just have Array ar1; the program works
|
|
|
|
|
First, looking at your code, I think if you examine the content of ar1 after you use the default constructor you will find that the 10 elements you wanted to add are not there. You may want to change your print statements to give better confirmation that your program worked.
Second, if you find what I said correct, I think you should find that
Array ar1(array, elem);
is the proper declaration for what it appears that you are trying to do.
Third, keep up the good work.
|
|
|
|
|
well, yes, the program worked, but I got long strings of memory cell locations. Scientific notation is a good sign something didn't work I just meant that the rest of the program was in working order.
|
|
|
|
|
Hi
especially i want to know what .lib file is ,what information it contains.
When does compiler generate .dll file and what we done so compiler generate .lib file?I really don't understand the differences.(for example gdi32.dll and gdi32.lib)
I am looking for your answers.
Thanks.
-- modified at 11:13 Tuesday 25th April, 2006
|
|
|
|
|