|
Why are you saying this ?
Is there a reason for this or simply a "used to be said" rule ?
I can't create worker thread for non UI work, as it would require too many synchronization objects, etc...
|
|
|
|
|
Consider this....
Window A, owned by thread 1
Window B, owned by thread 2
In Windows A, you need to set a property of Window B, so you call SendMessage(WindowB, ....). In handling that message, Window B needs information from Window A. This translates to SendMessage(WindowA, ....). Result? can be deadlock, can be OK
You might think multi-threading with synchronisation objects is tricky. However, multi-threading with windows uses many *hidden* synchronisation points, so you can have latent bugs that are very difficult to detect. This link[^] highlights some of the pitfalls.
All I'm saying is that multiple windows owned by different threads are in general not the best design choice...
Stuart Dootson
'Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p'
|
|
|
|
|
I need some kind of a "slim" combobox control. I want to use it for local edit in a listview control. Standard Windows' combobox cannot be resized beyond some minimum size.
WBR, Mahoney.
|
|
|
|
|
hi!
i have written an activex control for MS Word that stores some binary data. now when after placing my control into word doc i store binary data (vary
between 25KB to 10MB). control persists it. when i close it and reopen the
document it is there. but when i place another control and store data into
it, the data stored into the first control is truncated, not the whole data
but only few KBs. i m using BSTR to store binary data using SysAllocStringByteLen. I tried to find out the reason but couldn't. Is there any
Guru to give me a hand. I am in too much tension about this problem.
Plz help me.
Thanks in advance.
Ahmad Jalil Qarshi
|
|
|
|
|
I am writing Browser Helper Object. I want to access and make change to the URL in the address bar on the NavigateComplete event. I can get the URL but cannot make change to it (the URL in the address bar does not reflect the change). Could you help me to solve this problem?
Thanks.
|
|
|
|
|
I using vc++ to create a console project that codes below:
The codes is according to some conditions:
1. sort elements count greater than SORT_MAX.
2. all elements is equal.
2. predicate 'greater' overriden pair of brackets to compare two elements, when two elements are equal that returns true.
#include "stdafx.h"
#include <afxwin.h>
#include <algorithm>
using namespace std;
class greater {
public:
greater()
{
}
bool operator ()(int x1, int x2)
{
ASSERT(x1 == 12); // There is aim to assert pointer over
if (x1 > x2)
return false;
return true;
}
};
int main(int argc, char* argv[])
{
// UINT arr[] = {12, 14, 31, 9, 6, 30, 11, 65, 30
// };
UINT arr[] = {12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12
};
int nSize = sizeof(arr)/sizeof(UINT);
greater gt;
sort(arr, arr+nSize, gt);
for (int i = 0; i < nSize; i++)
printf("%d\n", arr[i]);
return 0;
}
//////////////////////////////////////////////////////////////////////////////
// i'm debugging into for(;_P(*_F, _Piv);++_F) which in template function _Unguarded_partition, Why is infinite cycle here?
// i guess the problem has associated with above 1. 2. conditions.
template<class _ri,="" class="" _ty,="" _pr=""> inline
_RI _Unguarded_partition(_RI _F, _RI _L, _Ty _Piv, _Pr _P)
{for (; ; ++_F)
{for (; _P(*_F, _Piv); ++_F)
;
for (; _P(_Piv, *--_L); )
;
if (_L <= _F)
return (_F);
iter_swap(_F, _L); }}
|
|
|
|
|
2. predicate 'greater' overriden pair of brackets to compare two elements, when two elements are equal that returns true.
This is the problem. std::sort expects a comparison predicate that implements what in techical terms is called a strict weak ordering[^]: your class greater violates (at least) the irreflexivity condition, i.e. when comparing an element against itself it returns true when it should return false. As you don't play nice with std::sort , this routine won't work.
In less technical terms, the comparison predicate must behave like the numerical < or > relationships do. In your case you have two options:Hope this helps.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
Want a Boost forum in Code Project? Vote here[^]!
|
|
|
|
|
Thanks for lot of helps, Ya that is strict weaking ordering function!
|
|
|
|
|
I have gotten _Document pointer from withing my ActiveX control using GetContainer() function. it works fine for _Document object. now i want to access _Application pointer from this _Document pointer but couldn't. i am using following code.
CComQIPtr<MSWord::_Document> spDoc(pContainer);
ATLASSERT(spDoc);
MSWord::_ApplicationPtr spApp = spDoc->GetApplication();
ATLASSERT(spApp);
where pContainer is IOleContainer pointer which i got through GetContainer.
plz help me.
Thanks in advance
Ahmad Jalil Qarshi
|
|
|
|
|
|
Hi
I wrote code using MS Visual C++ 6.0 and used different kinds of containers and algorithms from the STL. Can I take my code to be compiled and run in Unix without fuss?
Thanks!
|
|
|
|
|
|
Why not download GCC (which includes STL, IIRC) from here[^] and try it GCC is the most widely used compiler on Linux/Unix, so this Windows version is the easiest to try!
You may have some problems - some parts of MSVC6 STL (and MSVC for that matter!) aren't compliant with the C++ standard. There's a few things in std::string that aren't right and all the member template functionss defined in the standard aren't member template functions in MSVC STL. However, there shouldn't be too many
Stuart Dootson
'Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p'
|
|
|
|
|
STL is the Standard Template Library. It's part of the definition of the C++ language, so any correctly written code should work on all compliant implementations of STL.
|
|
|
|
|
To all the experts:
I would like to display an open-file-dialog by a click on the ellipsis button ("...") in the property browser. I have a simple ATL/MFC control and would like to give the user the possibility to enter the path to some file the control needs at desing time by clicking in the "..." button on the right side of the property name. Some stock properties like "Back Color" etc. have simliar functionality (they show a color picker instead of an open-file-dialog).
So what I really need to know is how to display something after a click in the "..." button.
I know how to activate the file-open-dialogs, so my problem is more the property/propety-page part.
I'd appreciate any comment since I have been searching for a solution in C++ almost one entire day
|
|
|
|
|
knaster bax wrote:
I know how to activate the file-open-dialogs,
if your ATL is MFC enabled you can use CFileDialog Class and if your ATL is without MFC then [GetOpenFileName] api will help
[Vote One Here, Complete my Survey....]
Alok Gupta visit me at http://www.thisisalok.tk
"I Think Believe this Will Help"
|
|
|
|
|
Thanks for the answer, but I'm afrait, that was not my question.
I'm wondering how to implement an "..." button or maybe a whole custom property editor for my ActivX-Control (ATL 7.0 + MFC-Support).
So what additions do I have to make to a property, that my IDE (VB6, VB.NET) displays this button on the right side in the property browser?
|
|
|
|
|
Hi,
I created one skin application like winamp using WTL. If my application is opened and dialog is displayed in desktop, at the time we move some other application ( yahoo messanger) over my application means, in my dialog background imgage and text are erased and redrawn slowly.
Your suggestions are always welcome.
inbha.
|
|
|
|
|
Hi everybody, i am writing some functions for arithmetic operations with Huge numbers(more than 1000 digit), i am using CString class and i treat CString objects like numbers,for example :
CString s1,s2,s3;
s1="625";
s2="25";
s3=Divide(s1,s2); // now s3="25"
I have to convert Huge numbers to binary, so using simple algorithm(dividing by 2,...) is too slow, so i decided to convert these numbers first to Hex then from Hex to binary,(as converting to Hex to Bin is very fast as you know)
i thought it would make my func faster but it takes approximately the same time ?? Does anybody know why ?? or have any ideas??
Regards
m0n0
|
|
|
|
|
Hello, I'm having a problem accessing the upperbounds of an inner CArray ...
say I have 2 CArray's:
CArray <CSkeletonClass, CSkeletonClass &> m_projectClasses;
and with in CSkeletonClass:
class CSkeletonClass {
public:
CArray <CSkeletonMethod, CSkeletonMethod&> methods;
CArray <CString, CString&> variables;
}
I'm trying to access the methods array and get the upperbounds ... but using it like this
ex. m_projectClasses[counter].methods.GetUpperBounds() doesn't get the correct result ...
and if that doesn't work, then I have no idea if they are even getting in to the array because I insert them like this
ex. m_projectClasses[counter].methods.Add(someMethod);
HELP!!!
|
|
|
|
|
Sometimes, my CHyperLink breakes and it stops at this check. What can i do to stop this from happening?
|
|
|
|
|
CHyperLink uses ShellExecute() to launch the URL in your default browser. So ShellExecute() is failing, probably because the control doesn't have a valid URL.
--Mike--
Visual C++ MVP
LINKS~! Ericahist | 1ClickPicGrabber | CP SearchBar v2.0.2 | C++ Forum FAQ
Strange things are afoot at the U+004B U+20DD
|
|
|
|
|
...But the URL is ok...and sometimes it works and sometimes is just doesn't, with the same link. I never saw this before:S..
it's obviously ShellExecute(). It returns 0..
|
|
|
|
|
I have a wtl project with date time picker control on it.
simple question hopefully.
how do I get the time or date back from it once the user changes it?
I want to compare the current time with what the user enters.
|
|
|
|
|
i have placed my own activex control in container(MS Word). now i want to print the current document in which i have place my activex control from within the activex control. i have gotten the container pointer using the following code.
IOleClientSite *pClientSite = NULL;
this->GetClientSite(&pClientSite);
CComPtr<IOleContainer> pContainer;
HRESULT hr = pClientSite->GetContainer(&pContainer);
if (hr == S_OK)
{
CComPtr<IDispatch> m_pApplication;
pContainer->QueryInterface(__uuidof(IDispatch), (LPVOID*)&m_pApplication);
CComQIPtr<MSWord::_Application> spApp(m_pApplication);
ATLASSERT(spApp);
}
m_pApplication gets the IDispatch interface pointer.
but when i try to get the application pointer of Word it return 00000 in spApp.
Plz help me how to get application pointer of Word. using this Container pointer.
Thanks in advance
|
|
|
|
|