Forgot your password?
Sign in with
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Python questions
View PHP questions
All Message Boards...
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Design and Architecture
Internet of Things
C / C++ / MFC
ATL / WTL / STL
Objective-C and Swift
Hardware & Devices
Hosting and Servers
.NET (Core and Framework)
Site Bugs / Suggestions
Spam and Abuse Watch
The Insider Newsletter
The Daily Build Newsletter
Most Valuable Professionals
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
What is 'CodeProject'?
Ask a Question
Bugs and Suggestions
Article Help Forum
Comments by hans.sch (Top 13 by date)
@Phil J Pearson - arg_dummy is an empty array which corresponds to the empty parameter list. If I remove it, the compiler complains because Invoke requires 2 parameters. The second parameter to Invoke is of type 'object??'. And in fact arg_dummy is null because I don't assign it a value.
@Maxim, thank you for your reply!
The line `IntCallback^ callback = gcnew IntCallback(MyCallback);` generates compiler error C3352: 'int (__cdecl *__cdecl cb)(int)': the specified function does not match the delegate type 'int (int)'. It only compiles when I declare 'int (__clrcall MyCallback)(int)' but when I do that, I have to propagate the __clrcall attribute into native code, and would have to compile the native code with /clr which may or may not work, but which I don't want to do for reasons beyond this discussion.
Thank you for the explanation! "can't specialize by number of template arguments" did surprise me. With your trick I can continue to explore templates. Just found that with a "requires" clause you can even specialize on the value of the template arguments :-) But I'll leave that for a later post.
This is not about inverting a bit pattern, rather it is about learning about templates. In the long run, other stuff will take the place of bit inversion. My question is not whether it makes sense (I agree it doesn't) but whether it can be done.
I want to write a template implementation that does 'A' for for all types, except for a certain category of types (categorized by IsSuitableType<t>::value) for which it does 'B' - but 'B' won't compile for non-suitable types. 'A' could be an empty function body (if it were not that the function must return a value).
Thanks Philippe for the quick reply. The issue is that I don't want a compiler error when using an inadequate type but I want the 'dummy' implementation be used. The background is that the call to Invert goes into a template function, and for inadequate types, it simply doesn't get called, so I don't care about the return value. All I need is that it compiles error free.
To see the compiler error in the sample, add the dummy implementation above the specialized one.
I know the 'dummy' code won't compile if T::T() is not public, but I'll deal with this later...
Thanks for the quick reply. Since I want to write a string to the edit that is not contained in the list, CB_SELECTSTRING is not an option.
Quoting from MSDN at http://msdn.microsoft.com/en-us/library/windows/desktop/ms632644%28v=vs.85%29.aspx: "For a combo box, the text is the contents of the edit-control portion of the combo box."
I may have to explicitly find the edit-control portion... I'll try that tomorrow.
Update: I retrieved the handle of the edit control of the combo box (used Spy++ to make sure this is what I want) and sent the WM_SETTEXT directly to the edit. It doesn't help: The string that is displayed is always one from the list.
Thank you for the quick reply. The DropDownList style doesn't solve my problem because it doesn't allow the user to type a string that is not contained in the dropdown list. And, of course, it doesn't let me set such a string via WM_SETTEXT.
Look up the topic "minidump" in the Visual Studio help system. I came across this topic recently, so there is no advice I can give except to read the documents.
Karsten, I agree with you but my boss doesn't, so I'll have to stick to what we have (or we don't have, as far as the installer is concerned) :-(
This is quite a good idea. I am using connection points, so I can call IDispatch::GetIDsOfNames. When the function returns something that is neither S_OK nor DISP_E_UNKNOWNNAME, I assume the client is dead, and I call my cleanup code. But how do I clean up the server-side COM object? I tried calling Release() but it didn't delete the object because the refcount was still 4, and I tried to delete it (using the 'delete' operator) but then I get an access violation when WinMain calls CoUninitialize before it exits.
A "connection" is established by a call to CoCreateInstanceEx(). When I close down the connection (this happens when I assign 0 to the CComPtr - calls Release() behind the scenes) the server knows one client has said goodbye, and when the last client is gone, the server process terminates. Unfortunately this doesn't happen when the client crashes.
I get your point. However junking MFC is no option. I have to follow company guidelines, and besides, our code base makes heavy use of MFC. No, I must do with CDialog, CWinApp, etc.
Maybe it is disabled by your company's policies? Ask your network admin.
Last Updated 1 Jan 1900
All Rights Reserved.