|
I Have solved this problem this way:
Thanks to a previous post!!
BOOL CTextView::PreTranslateMessage(MSG* pMsg)
{
switch (pMsg->message)
{
case WM_KEYDOWN:
{
switch (pMsg->wParam)
{
case VK_SPACE:
{
if (GetKeyState(VK_CONTROL) & (1 << sizeof(SHORT) * 8 - 1))
{
CString szAutoWords;
for (long n= 0; n < g_vszKnownWords.GetSize(); n++)
szAutoWords+= g_vszKnownWords[n] + _T("\n");
szAutoWords.MakeLower();
if (!szAutoWords.IsEmpty())
GetCtrl().AutoCShow(0, _tochar(szAutoWords));
return TRUE;
}
}
break;
case VK_F5:
case VK_F9:
OnExecute();
return TRUE;
}
}
break;
}
return CScintillaView::PreTranslateMessage(pMsg);
}
|
|
|
|
|
I have a picture control(static control) on my dialog box. then iam browsing for an image(any type like jpeg,bmp..) by using a browse button on my dialog box and i want to display the selected image in the picture control. the image should be fit in the control.
Please do explain with example?
Thanks in advance,
Regards
Kumar_Windows
|
|
|
|
|
|
kumar_windows wrote: hen iam browsing for an image(any type like jpeg,bmp..) by using a browse button on my dialog box and i want to display the selected image in the picture control. the image should be fit in the control.
could you tell me Which Interface or Api are you using to Display JPG,PNG format in PictureControl, as pictureControl only understand Bitmaps
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
i think he need to convert jpeg or png to bmp for use in static control
whitesky
|
|
|
|
|
WhiteSky wrote: i think he need to convert jpeg or png to bmp for use in static control
But he ask for something else, he want to resize the image, so i believe he must be using some interface or class from which he is reading such format!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
you can use from CImage or OleLoadPicture for read your graphic file and convert it to bitmap for use in static control
whitesky
|
|
|
|
|
|
|
ung.
<marquee scrollamount="1" scrolldelay="1" direction="up" height="10" step="1">--[V]--
[My Current Status]
|
|
|
|
|
VuNic wrote: ung.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
d+ ung =?
<marquee scrollamount="1" scrolldelay="1" direction="up" height="10" step="1">--[V]--
[My Current Status]
|
|
|
|
|
VuNic wrote: d+ ung =?
NOooo!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
ThatsAlok wrote: NOooo
or Moooooooooo!??
<marquee scrollamount="1" scrolldelay="1" direction="up" height="10" step="1">--[V]--
[My Current Status]
|
|
|
|
|
VuNic wrote: or Moooooooooo!??
I don't have any COW stable nearby, do you have any?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
Hi,
Can any one suggest me how to set the minimum password length for windows
programmaticaly?. We could manually enter it in the specified path (controlpanel\ administrative tools\localsecurity policy\password policy\minimumpasswordlength)
Any relevant API's , registry keys or any suggestions would be useful for me .
Thanks
"Every morning I go through Forbes list of 40 richest people in the world. If my name is not in there, I go to work..!!!"
|
|
|
|
|
You set it via Group Policy via a password policy.
This can be set domain wide or as a Local Group Policy (LPGO)
-- modified at 11:50 Tuesday 23rd May, 2006
NOTE: this is not programmatically but this is how most IT shops would pass this down to 100+ machines. I'm guessing you've been asked to write something for your support group but they should already be managing the workstations via some policy based mechanism or script tool. Mention Active Directory/ Group Policy / Netware etc...
|
|
|
|
|
please give detailed differences between deep copy and shallow copy (also in terms of memory allocation)?
which ( userdefined or default copy --- constructor/ overloaded assignment operator) performs what ( deep/ shallow copy)?
thanx in advance
kumar_windows
|
|
|
|
|
kumar_windows wrote: which ( userdefined or default copy --- constructor/ overloaded assignment operator) performs what ( deep/ shallow copy)?
depends how they've been implemented.
i don't know what is a deep copy nor shallow copy, but a good copy operation should duplicate each data owned by the object copied (whatever copy conctructor or operator= ).
TOXCCT >>> GEII power
[VisualCalc 3.0 updated ][Flags Beginner's Guide new! ]
|
|
|
|
|
toxcct wrote: i don't know what is a deep copy nor shallow copy
In C++ a common use of deep vs. shallow is in reference to pointer members of classes. A deep copy will allocate it's own memory and copy the data. A shallow copy will only copy the pointer (address).
"What classes are you using ? You shouldn't call stuff if you have no idea what it does" Christian Graus in the C# forum
led mike
|
|
|
|
|
in general, it is bad to copy only the addresses (pointers contents) because when one object desctructor is freed, it will invalidate the other object which points on that address...
TOXCCT >>> GEII power
[VisualCalc 3.0 updated ][Flags Beginner's Guide new! ]
|
|
|
|
|
toxcct wrote: in general, it is bad to copy only the addresses
Well you better get busy telling the rest of the industry that because there is a common design pattern known as "copy on write" that calls for doing just that.
At one time, maybe still... i don't know, CString used that design.
"What classes are you using ? You shouldn't call stuff if you have no idea what it does" Christian Graus in the C# forum
led mike
|
|
|
|
|
led mike wrote: Well you better get busy telling the rest of the industry that because there is a common design pattern known as "copy on write" that calls for doing just that.
Copy-on-write creates a copy of the resource when you try to change it. Most of the time it is recommended to use a reference count when using COW to prevent both excessive copies and invalid memory accesses. The post you were responding to was correct, IN GENERAL, it is a bad idea to simply copy the addresses. There are special cases and techniques that allow for doing such without problems, but they are special cases, not the general case.
led mike wrote: At one time, maybe still... i don't know, CString used that design.
Not CString, the STL string class does this. CString has always had a private copy of the data (when you copy a CString, it actually copies the bytes to a new buffer). STL-string uses a reference count on the buffer and only creates a private buffer if you try to change it. This is also the reason that it is recommended to use vector<char> if you are dealing with passing strings between threads.
To answer the original post more thoroughly, a shallow copy is what is done for you if no copy constructor nor copy-assignment operators are declared. Basically, pointers in your objects are copied (that is, not the data they point to). A deep copy is something you have to write yourself by implementing the copy-constructor/assignment operator to actually allocate its own memory and copy the bytes from the source to the destination (that is, your new object). The following code segments are examples:
<br />
class Shallow<br />
{<br />
private:<br />
char* m_MyString;<br />
public:<br />
Shallow() { m_MyString = new char[20]; }<br />
~Shallow() { delete [] m_MyString; }<br />
};<br />
<br />
class Deep<br />
{<br />
private:<br />
char* m_MyString;<br />
public:<br />
Deep() { m_MyString = new char[20]; }<br />
Deep(const Deep& d) { memcpy(m_MyString, d.m_MyString); }<br />
~Deep() { delete [] m_MyString; }<br />
const Deep& operator= (const Deep& d) { memcpy(m_MyString, d.m_MyString); }<br />
};<br />
<br />
void main()<br />
{<br />
Shallow a, b;<br />
Deep c, d;<br />
<br />
a = b;
<br />
c = d;
}<br />
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
Zac Howland wrote: IN GENERAL, it is a bad idea to simply copy the addresses.
Not sure what your point is. It seemed to me that statement suggests that something is inherently wrong with a "shallow-copy" design. If that is what is intended then I disagree.
Zac Howland wrote: Not CString,
Still not sure on that but you can find all sorts of reference to CString implementing copy-on-write on the net. Also the VC6 Strcore.cpp has a CString member function called "CopyBeforeWrite" that is called in many places like MakeUpper()/Lower() and MakeReverse() to name a few. So at some point it seems someone at least thought CString used a copy-on-write design.
"What classes are you using ? You shouldn't call stuff if you have no idea what it does" Christian Graus in the C# forum
led mike
|
|
|
|
|
hi,
i used template class and in this class i used map eith function pointer and string with value and key respective.
with this map i find my function address that i saved previosly and call my function but in this code i have problem with find()..
find return iterator which is map.end() so loop is break ...
in that casse only two function pointer is working but after that it gives end of map..
so pls help to find out this problem..
also i attached my code pls go throught it .
// map of operation methods
typedef bool (CLbxMorphCompareImpl<tbaseclass>::*OperationMethod)(const MorphUtil::CParsedMorph *, const MorphUtil::CParsedMorph *, const std::vector<unicode::ustring> &, long);
typedef std::map<unicode::ustring, operationmethod="" ,="" stdext::equstr=""> OperationMap;
OperationMap m_mapOperations;
template < typename TBaseClass>
CLbxMorphCompareImpl< TBaseClass>::CLbxMorphCompareImpl()
{
unicode::ustring ustr1 = unicode::ustring::create_from_asciiz("agree");
m_mapOperations[ustr1] = &CLbxMorphCompareImpl<tbaseclass>::OperationAgree;
unicode::ustring ustr2 = unicode::ustring::create_from_asciiz("not-agree");
m_mapOperations[ustr2] = &CLbxMorphCompareImpl<tbaseclass>::OperationNotAgree;
unicode::ustring ustr3 = unicode::ustring::create_from_asciiz("strict-agree");
m_mapOperations[ustr3] = &CLbxMorphCompareImpl<tbaseclass>::OperationStrictAgree;
unicode::ustring ustr4 = unicode::ustring::create_from_asciiz("strict-not-agree");
m_mapOperations[ustr4] = &CLbxMorphCompareImpl<tbaseclass>::OperationStrictNotAgree;
}
template<typename tbaseclass="">
long CLbxMorphCompareImpl<tbaseclass>::CompareEx(uint16_t * bstrLeftReference, uint16_t * bstrRightReference, uint16_t * bstrOperation)
{
bool bRet = false;
//TYPENAME must required in template..
typename DataTypeStockImpl::CLbxMorphCompareImpl<tbaseclass>::OperationMap::const_iterator itMethod = m_mapOperations.find(strEachOperation);
}
thanx a lot.
rakesh baldha
Thanks & Regards
rakesh
|
|
|
|