|
|
|
c:\Machine Controller - Source Code\Machine Controller.cpp(529): error C3363: 'int StartListening::initStartListening(void)' : cannot create a delegate handler for 'System::Threading::ThreadStart' from a non-member function or a member of an unmanaged class
Does anyone know how to resolve this error.Thanks
|
|
|
|
|
staticplus wrote: 'System::Threading::ThreadStart'
That appears to be .NET BCL classes and therefore you are in the wrong forum. Go to the C++/CLI forum for C++ .NET Managed development.
staticplus wrote: Does anyone know how to resolve this error.
Yes, you must use a managed delegate as the thread function for a managed thread.
|
|
|
|
|
This is my code snipped where i get this error:
if ((HWND)lParam == hwndStartListening) {
EnableWindow(hwndStartListening, false);
StartListening *a = new StartListening();
Thread *test = new Thread(new ThreadStart(a,StartListening::initStartListening));
test->Start();
//initStartListening();
break;
}
can you tell me how to create a managed delegate as the thread function for a managed thread for the code above. Thanks a lot
|
|
|
|
|
I am using CListBox(MFC Class) which have some strings added to it.I want
to display different string in different font.Is this possible?How this could be done?
regards,
priyank
|
|
|
|
|
If you need different strings within the same control to be shown using different drawing styles (or fonts), you will likely need to do an owner-drawn control.
I have an article that custom draws in a Combo-Box, and there are others around as well, like for drawing font names in their respective fonts. They will likely translate well for what you have to do.
Try searching on this site for "Owner draw", "Owner drawn", "owner-draw", etc. for more details. Stay away from "Custom Draw", because that generally only applies to the newer Win32 controls (i.e. CListCtrl but not CListBox ).
Peace!
-=- James Please rate this message - let me know if I helped or not!<HR> If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! See DeleteFXPFiles
|
|
|
|
|
Take a look in your documentation.
If CListBox::SetItemHeight (...) exists... is because it will most probably be possibl to change sizes and fonts.
Read about the LBS_OWNERDRAWVARIABLE style as well.
And if you want examples... take a look here[^]
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
|
|
|
|
|
How to generate checksum for a file?Sourcecode or algorithm will really help...
Thanks
|
|
|
|
|
|
Hello everyone,
I have noticed a lot of COM samples that the function AddRef and Release function of COM inteface is not synchronized to make it thread safe when dealing with adding/decreasing reference count.
Is it needed to synchronize AddRef and Release? Or the COM runtime underlying implementation handles thread safe issue by itself (i.e. transparent to upper layer COM server developer)
I am using Visual Studio 2005 to develop native (unmanaged C++) COM. No other framework is used (e.g. ATL).
thanks in advance,
George
|
|
|
|
|
George_George wrote: Or the COM runtime underlying implementation handles thread safe issue by itself (i.e. transparent to upper layer COM server developer)
No. There is no thread safety built into COM. That doesn't even make sense. There are Thread Models built into COM. Do some reading on COM and STA or Apartment Thread Model.
I also suggest reading Advanced Windows by Richter to gain a basic understanding of threading issues.
|
|
|
|
|
Thanks led mike,
You mean we need to add thread safe synchronization approach to AddRef and Release to make counter value thread safe manually?
regards,
George
|
|
|
|
|
George_George wrote: You mean we need to add thread safe synchronization approach to AddRef and Release to make counter value thread safe manually?
Well you can do it manualy or you can use a library like ATL to do it for you.
|
|
|
|
|
Thanks led mike,
Since I implement COM DLL server from scratch, I need to implement thread-safe synchronization approach manually to AddRef and Release. Thanks again.
regards,
George
|
|
|
|
|
George_George wrote: Since I implement COM DLL server from scratch, I need to implement thread-safe synchronization approach manually to AddRef and Release.
Yes, unless of course you are implementing an Apartment model then it doesn't matter since all of the interfaces will only be accessed from a single thread.
|
|
|
|
|
Intersted, what is Apartment model?
regards,
George
|
|
|
|
|
|
Thanks led!
Good article.
have a good weekend,
George
|
|
|
|
|
Hi,
I want to convert different character encodings like koi8-r to ASCII.
Where can I find information about them?
I can see there are many charsets - utf-8, windows-1251 etc.
|
|
|
|
|
Daniel Kanev wrote: I want to convert different character encodings like koi8-r to ASCII.
You can't convert kio8-r to ASCII. The former covers Cyrillic alphabet, and the later Latin (the English subset of Latin, really). What exactly do you want to do?
|
|
|
|
|
Message Closed
modified 8-Mar-17 3:44am.
|
|
|
|
|
|
Hello every one,
I'm trying to generate log files in XML using MSXML4. Right now I'm trying to get it working correctly in a test application, so that when I get it right I could just implement the same thing in the actual project i need to work on.
This operation is intended to log the calling of functions in the application and the XML it needs to generate should be something like this
<pre>
<CallSequence>
<Call>
<ObjectType>Unit</ObjectType>
<ObjectName>ChemSepUO_382</ObjectName>
<Interface>ICapeUnit</Interface>
<Method>Calculate</Method>
<CallSequence>
<Call>
<ObjectType>Material Object</ObjectType>
<ObjectName>Mix out</ObjectName>
<Interface>ICapeThermoMaterialObject</Interface>
<Method>SetProp</Method>
<Arguments>
<Inputs>
<Row>
<Property>Volume</Property>
<Phase>Overall</Phase>
<Basis>Mole</Basis>
<Calc>Mixture</Calc>
</Row>
<Row>
<Property>My Property</Property>
<Phase>phaseValue</Phase>
<Basis>Molecule</Basis>
<Calc>Mkkkl</Calc>
</Row>
</Inputs>
<Outputs>
<Row>
<Value>0.000018075</Value>
</Row>
</Outputs>
</Arguments>
<ReturnCode>No Error</ReturnCode>
<CallSequence>
<Call>
<ObjectType>Unit</ObjectType>
<ObjectName>ChemSepUO_382</ObjectName>
<Interface>ICapeUnit</Interface>
<Method>Third Level of Recursion</Method>
<ReturnCode>No Error</ReturnCode>
</Call>
</CallSequence>
</Call> ...</pre>
Its the nesting of function calls (callsequence nodes in this case) which is causing the problem. The problem is that in the actual application I dont have access to the code that is calling those functions I need to log. So this nesting looks almost impossible for now.
The XML that is generated right now looks like this where function4 is actually called from Function1 but its not getting nested inside.
<pre><LOG>
<CallSequence>
<Call><MethodName>Function1</MethodName>
<Interface>ICapeThermo</Interface>
</Call>
<Call><MethodName>Function4</MethodName>
<Interface>ICapeThermo</Interface>
</Call>
</CallSequence></LOG></pre>
I'm in real hot water now... looks like I'm completely out of ideas...
Can u give me any idea or help in anyway?
Thanks for your time
Rocky
You can't climb up a ladder with your hands in your pockets.
|
|
|
|
|
As an aside, who came up with the requirement for using XML for logging? Based on the XML shown above, you have much more XML markup than content. Logging something like a crash/dump is one thing, but this looks like runtime-logging...
Logging should not be a drain on performance. But XML, and XML combined with MSXML does not exactly scream high-performance...
Peace!
-=- James Please rate this message - let me know if I helped or not!<HR> If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! See DeleteFXPFiles
|
|
|
|