 |
|
 |
Apologies for the shouting but this is important.
When answering a question please:
- Read the question carefully
- Understand that English isn't everyone's first language so be lenient of bad spelling and grammar
- If a question is poorly phrased then either ask for clarification, ignore it, or mark it down. Insults are not welcome
- If the question is inappropriate then click the 'vote to remove message' button
Insults, slap-downs and sarcasm aren't welcome. Let's work to help developers, not make them feel stupid.
cheers, Chris Maunder
The Code Project Co-founder Microsoft C++ MVP
|
| Sign In·View Thread·PermaLink | 5.00/5 (3 votes) |
|
|
|
 |
|
 |
For those new to message boards please try to follow a few simple rules when posting your question.- Choose the correct forum for your message. Posting a VB.NET question in the C++ forum will end in tears.
- Be specific! Don't ask "can someone send me the code to create an application that does 'X'. Pinpoint exactly what it is you need help with.
- Keep the subject line brief, but descriptive. eg "File Serialization problem"
- Keep the question as brief as possible. If you have to include code, include the smallest snippet of code you can.
- Be careful when including code that you haven't made a typo. Typing mistakes can become the focal point instead of the actual question you asked.
- Do not remove or empty a message if others have replied. Keep the thread intact and available for others to search and read. If your problem was answered then edit your message and add "[Solved]" to the subject line of the original post, and cast an approval vote to the one or several answers that really helped you.
- If you are posting source code with your question, place it inside <pre></pre> tags. We advise you also check the "Encode HTML tags when pasting" checkbox before pasting anything inside the PRE block, and make sure "Ignore HTML tags in this message" check box is unchecked.
- Be courteous and DON'T SHOUT. Everyone here helps because they enjoy helping others, not because it's their job.
- Please do not post links to your question in one forum from another, unrelated forum (such as the lounge). It will be deleted.
- Do not be abusive, offensive, inappropriate or harass anyone on the boards. Doing so will get you kicked off and banned. Play nice.
- If you have a school or university assignment, assume that your teacher or lecturer is also reading these forums.
- No advertising or soliciting.
- We reserve the right to move your posts to a more appropriate forum or to delete anything deemed inappropriate or illegal.
cheers, Chris Maunder
The Code Project Co-founder
Microsoft C++ MVP
|
| Sign In·View Thread·PermaLink | 5.00/5 (2 votes) |
|
|
|
 |
|
 |
I've written a multi-threaded WTL util to stress test an in-house service.
Comms threads signal to the main thread that they've quit, so the main thread can delete their corresponding object.
They make the signal as so:
PostThreadMessage(m_dwParentThreadId, WM_THREADQUIT, 1, m_dwNetThreadId);
My problem is how to deal with the custom message I've defined .
WM_THREADQUIT is #define'd as WM_USER + 10
I wanted to use an entry in the message map to call a handler, e.g.: BEGIN_MSG_MAP(CMainDlg) MESSAGE_HANDLER( WM_INITDIALOG, OnInitDialog ) MESSAGE_HANDLER( WM_THREADQUIT, OnThreadQuit ) ... REFLECT_NOTIFICATIONS() END_MSG_MAP()
However, OnThreadQuit is never called.
The only way I can handle it is by calling the handler explicitly in PreTranslateMessage:
virtual BOOL CMainDlg::PreTranslateMessage(MSG* pMsg) { if( pMsg->message == WM_THREADQUIT ) { BOOL blHandled; OnThreadQuit(pMsg->message, pMsg->wParam, pMsg->lParam, blHandled); return TRUE; } return CWindow::IsDialogMessage(pMsg); }
I'm sure this isn't the correct way to do it ...
I'd love to know the correct way- can someone help!?
thanks
modified on Friday, November 6, 2009 6:46 AM
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
Hi ,
I am using CreateWindowsEx()API to create button on toolbar. The code is as
CreateWindowEx(WS_EX_OVERLAPPEDWINDOW,"Button","X",WS_VISIBLE | WS_CHILD |WS_CLIPCHILDREN ,2,0,25,25,m_hWnd,NULL,_Module.GetResourceInstance(),NULL);
I can add button on toolbar, but color of button is gray, I want this button with white background. So please send any solution to change button color.
Regards abm
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
 |
|
 |
Hello. I have created an ocx control in delphi and i put it on form of ATL Composite Control (Insert ActiveX Controls). Now i trying to access properties and methods, but i dont know how to do....
I tryed everythig but i always get error assert debug failed... Is there any way that i "attach" or "getcontrol" like you can do with standard controls in toolbox?
Thanks, komofilms
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
By default, type library information is compiled into my ATL dll project. While I do want the .tlb file, I don't want it compiled into the dll. How do I turn that off?
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
Hello kcynic,
The type library information is stored as a resource in your ATL-based COM executable (i.e. DLL or EXE). To remove it, open the resource script file for your ATL project (i.e. <project name>.rc).
In your .rc file, look for a resource typed as "TYPELIB". It will usually be of the following form :
1 TYPELIB "<project name>.tlb"
Simply comment out this line.
By the way, besides removing type libs from your project's resource, you can also add more type libraries into your resource, e.g. :
2 TYPELIB "<some other type library>.tlb"
In this case, you must either supply a full path to the new type library or indicate a path to it in the "Resources" section of your project settings.
- Bio.
|
| Sign In·View Thread·PermaLink | 5.00/5 (1 vote) |
|
|
|
 |
|
 |
Thanks, i have tried successfully. And another question, in some of my code, i use another interface witch is provided by ms, the code looks like following: CComPtr pI; HRESULT hr = pI.CoCreateInstance(CLSID_SomeInterface);
Here, if the code was used in my Atl dll project, i would got hr with E_NOINTERFACE error; but if i use that code in a normal project(Not atl com dll), hr will be S_OK.
why?
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
>> And another question, in some of my code, i use another interface witch is provided by ms... Do you mean that in your ATL COM object class, you implement the MS interface ? E.g. :
class ATL_NO_VTABLE CMyClass : public ... public ISomeMSInterface, public ...
Or do you mean that the actual code :
>> CComPtr pI; >> HRESULT hr = pI.CoCreateInstance(CLSID_SomeInterface);
is called in some function of your ATL COM object source codes ? E.g. :
STDMETHODIMP CMyClass::SomeMethod() { CComPtr pI; HRESULT hr = pI.CoCreateInstance(CLSID_SomeInterface); ... }
- Bio.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
 |
|
 |
To confirm, the creation of object of coclass CLSID_SomeInterface is actually called in some function of your ATL COM object source codes, e.g. :
STDMETHODIMP CMyClass::SomeMethod() { CComPtr pI; HRESULT hr = pI.CoCreateInstance(); ... }
- Bio.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
Yes. I packed this code in a static library as .lib. But, it's strangely that if i direct use the static library, the code will work well( CoCreateInstance returns S_OK). but, if i use the static library in my atl com object and i call that code via the com dll, the CoCreateInstance would returns E_NOINTERFACE.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
The use of a static library makes no difference as far as the creation of COM objects is concerned. Here's what I suggest :
1. Make sure that the correct interface ID is passed in. You'll have to check your source codes to be sure of this.
2. Make sure that the correct version of the target COM DLL is loaded. In debug run mode, use the VC++ "Modules" menu item.
Best of luck, Bio.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
Of course, they are OK. Although the problem still remains, but i think it should due to my own fault. Just take it easy.
Thanks
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
 |
|
 |
This forum is for questions not advertising. If people are interested they will find your article. Stick to the protocols.
|
| Sign In·View Thread·PermaLink | 1.00/5 (1 vote) |
|
|
|
 |
|
 |
Sorry and thank you. Now the message type has been changed to "News" instead of "Question".
My intent was to spread the word to those who may need it. This include those who use the MFC technolgy, COM and ATL, hence the 3 copies I posted at the three forums.
Respectfully.
Easy Profiler : Now open source ! http://www.codeproject.com/KB/cpp/easyprofiler.aspx
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
Ahmed Charfeddine wrote: My intent was to spread the word to those who may need it.
As I said in my previous message, if people are interested they will find it for themselves; the forums should not be used for advertising. You triple post is also triple abuse - stick to the protocols.
|
| Sign In·View Thread·PermaLink | 1.00/5 (2 votes) |
|
|
|
 |
|
 |
OK I deleted the message.
Easy Profiler : Now open source ! http://www.codeproject.com/KB/cpp/easyprofiler.aspx
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
Hi
I have created ATL toolbar in which i creat windows using CreateWindow() with sattic control. I load bmp into this windows by using LoadBitmap. But when I move toolbar , bitmap image get disapper/ flicker.
How to avoid flicker of window with bitmap is loaded into it.
thanks abm
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
#include <algorithm>
#include <fstream>
#include <sstream>
int main() { std::fstream fs("d:/test.txt"); std::stringstream ss; ss << "hello" << std::endl; std::copy(std::istream_iterator<char>(ss), std::istream_iterator<char>(), std::ostream_iterator<char>(fs)); fs.close(); return 0; }
The code not work, I have some questions: 1. What does this mean: std::istream_iterator() ? 2. Is the position of the stream iterator depent on the current postion of the stream itselft? Thanks. 3. How to make the code work?
modified on Wednesday, November 4, 2009 9:13 AM
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
Firstly - a CP/HTML thing - you need to escape the < characters in the template parameter spec of the iterators (looking at the source of the page, they should be <char>, yes?).
Try declaring fs as a std::ofstream or making sure that the destination file exists - with that change, the code works fine.
std::istream_iterator<char>() is a sentinel value that represents the end of any input stream. Once an istream_iterator<char> steps past the end of the file, it has the same value as std::istream_iterator<char>().
A stream iterator interacts with the stream position. It's a bad idea to manipulate the stream while there are active stream iterators.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
 |
|
 |
Hello everybody!
Now I installed the WTL8,and clicked "D:\AppWiz\setup80.js" to setup.
I can only use WTL Wizard in VS2005,but I can't see the WTL wizard when I create a new project in VC6.0 ?
thanks for your reply !
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |