|
John M. Drescher wrote:
I have seen some of the code that is produced by obfuscators. It is almost impossible to follow
That's the whole point! yeah, I know you know
It basically becomes just as difficult as decompiling a standard Win32 application.
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Don't care, C# replaces Visual Basic and not C++. There was always more information about VB than about C++ and MFC. Now part of VB, database and WEB programmers are moving to C#, making a lot of noise. C++ Windows programmers remain with Windows API or MFC programming.
C++ is language specification; Visual C++ is Microsoft C++ implementation.
C# is both language specification and implementation.
MFC is not language, it is kind of library.
C++ is portable. MFC is not portable. C# is portable only in theory, actually it works only in Windows.
|
|
|
|
|
Alex Farber wrote:
C# replaces Visual Basic and not C++.
I disagree. C# is more similar to C++ than VB.NET, and both VB.NET and C# have been pushed very strongly by MS, while C++.NET has received almost no attention.
Alex Farber wrote:
Now part of VB, database and WEB programmers are moving to C#, making a lot of noise.
And C++ programmers as well...
Alex Farber wrote:
C++ Windows programmers remain with Windows API or MFC programming.
Some will, some won't. Most who switch to C# will retain the ability to program in C++. C++ is available under .NET, but hasn't received much attention. Most C++ programmers who use .NET will probably use C# because it's being pushed a lot harder by MS.
Alex Farber wrote:
C# is portable only in theory, actually it works only in Windows.
Not quite. It also works under Macs and FreeBSD.
[sorry about the other post. The damn thing submitted before I'd finished]
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Ryan Binns wrote:
while C++.NET has received almost no attention.
It is not pushed by the Microsoft marketing machinery. But it is widely used to access any DOT-NET thingies in C++ applications. But as this is silent work, simply done and not advertised publically, you do not hear a lot about it.
Ryan Binns wrote:
Most C++ programmers who use .NET will probably use C# because it's being pushed a lot harder by MS
We will see in a few years time .
Right now, there seems to be some sort of 'play around' phase: everyone tries C# out and reports its problems and findings. Only then project managers will decide what to use.
My opinions may have changed, but not the fact that I am right.
|
|
|
|
|
Hello,
I am developing an MFC dialog which registers a callback with a certain library. This library will call back at intervals giving new insformation to the dialog. This information should be displayed on the dialog's controls.
The callback comes from a different thread than the thread of my dialog, so my question is:
What method should I use to update my dialog? Should I send messages to the main thread and it do the work, or is it OK to update my controls from within the callback?
I appreciate your input.
Jeremy Pullicino
C++ Developer
Homepage
|
|
|
|
|
Jeremy Pullicino wrote:
Should I send messages to the main thread and it do the work, or is it OK to update my controls from within the callback?
It's perfectly OK to update your controls from a second thread. However, you can't use MFC to do it. You have to use the straight Win32 API to do it. Luckily, updating controls generally uses MFC wrappers that are fairly thin wrappers over the API, so it's not much more work.
Sending messages to the main thread will work just as well, and will allow you to use MFC.
Basically, you can do what you like, depending on whether you want to be able to use MFC or not.
Hope this helps,
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Ryan Binns wrote:
It's perfectly OK to update your controls from a second thread. However, you can't use MFC to do it. You have to use the straight Win32 API to do it.
Thanks for the feedback.
Just out of curiosity - why can't I use MFC to update my dialog from the second thread?
Jeremy Pullicino
C++ Developer
Homepage
|
|
|
|
|
Jeremy Pullicino wrote:
why can't I use MFC to update my dialog from the second thread?
MFC uses thread-specific data internally. Using MFC objects created in one thread in another thread uses inconsistent internal data, and can cause catastrophic errors, hence MFC incorporates checks to prevent this.
Just for a test, create a window in one thread and do this in another thread:
ASSERT(CWnd::FromHandlePermanent(pWnd->m_hWnd) == pWnd) In a single-threaded application, this will work perfectly as expected, but if pWnd was created in a different thread, FromHandlePermanent() will return NULL because the window map is thread-specific data, and the ASSERT will be triggered.
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
|
I want know how i can add highlight and change the text font in a DOC/VIEW application derived from a CRichEditView.I would be glad if anyone could help me out.
|
|
|
|
|
Hi all,
I have a list control with checkboxes and multi-select style.
when i select several items, and then check 1 fo the selected items, i expect the rest of the items to be checked as well...by default it doesn't happened
any1 knows a style of list to fix my problem?
thanks in advanced,
Yaron
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
YaronNir wrote:
any1 knows a style of list to fix my problem?
There isn't one. You will have to do this yourself whenever the user clicks on an item. Use GetSelectedCount() and GetNextItem() to loop through the selected items and set them all to the state you want.
If you're not using MFC, use the LVM_GETSELECTEDCOUNT and LVM_GETNEXTITEM mesages.
Hope this helps,
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
thanks for the reply!
i am not using MFC, so i will use the LVM_ messages you've mentioned.
you said to catch the user clicks on the item. but what if the user select the item via the keyboard???
is there a certain message that item was selected? no matter how (keyboard or mouse?)
thanks again
Yaron
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
YaronNir wrote:
is there a certain message that item was selected?
LVN_ITEMCHANGED , which will detect if an item has been selected/unselected by either mouse or keyboard, but I'm not sure if it works when an item is checked or unchecked. Perhaps you could test it
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Hi, thanks again for the reply.
i am using ATL/WTL, i have a dialog that correspond to the:
NOTIFY_HANDLER(IDC_MY_LIST_CTRL, LVN_ITEMCHANGED, OnListItemChanged)
and in the implementation:
LRESULT CAddContentDlg::OnListItemChanged(int idCtrl, LPNMHDR pnmh, BOOL& bHandled)
{
NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pnmh;
return 0;
}
can u show me some code to handle the multiple selection and checking cause i'm kinda having trouble of writing it correctly.......
thanks again
Yaron
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
Hi, thanks again for the reply.
i am using ATL/WTL, i have a dialog that correspond to the:
NOTIFY_HANDLER(IDC_MY_LIST_CTRL, LVN_ITEMCHANGED, OnListItemChanged)
and in the implementation:
LRESULT CMyDlg::OnListItemChanged(int idCtrl, LPNMHDR pnmh, BOOL& bHandled)
{
NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pnmh;
return 0;
}
can u show me some code to handle the multiple selection and checking cause i'm kinda having trouble of writing it correctly.......
thanks again
Yaron
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
I'll have a go
LRESULT CMyDlg::OnListItemChanged(int idCtrl, LPNMHDR pnmh, BOOL& bHandled)
{
NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pnmh;
HWND hwndLV = pnmh->hwndFrom;
int iState = ListView_GetCheckState(hwndLV, pNMListView->iItem);
int iItem = ListView_GetNextItem(hwndLV, -1, LVNI_SELECTED);
while(iItem >= 0)
{
ListView_SetItemState(hwndLV, iItem, INDEXTOSTATEIMAGEMASK(iState+1), LVIS_STATEIMAGEMASK);
iItem = ListView_GetNextItem(hwndLV, iItem, LVNI_SELECTED);
}
return 0;
} Hope this helps,
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Excellent man! works perfectly! many thanks!
keep up the good help work....
cheers
Yaron
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
You're welcome
YaronNir wrote:
Excellent man! works perfectly!
Cool! I didn't actually test that - just wrote it straight from the docs, so I'm happy that it works that well
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
I'm trying to learn the alternative way of writing an IF statement. The code below returns a 0, it should be an 8 since 3<5, what am I doing wrong?
Thanks
<br />
<br />
#include <iostream><br />
<br />
using namespace std;<br />
<br />
int main()<br />
<br />
{<br />
int a = 3;<br />
int b (5);<br />
int x(0);<br />
<br />
a < b ? x == a + b : x == 9;<br />
<br />
cout<<x<<"\n\n";<br />
<br />
return 0;<br />
}<br />
"The man who reads nothing is better educated than the man who reads nothing but newspapers."- Thomas Jefferson
|
|
|
|
|
You use the comparison operator (==) insted of the assignement operator.
Replace
a < b ? x == a + b : x == 9;<br />
<br /> by
a < b ? x = a + b : x = 9;<br />
<br />
|
|
|
|
|
DaveE9th wrote:
a < b ? x == a + b : x == 9;
[...] what am I doing wrong?
The result is false , whichever clause is executed:
x is neither equal to a+b (that is 8) nor is x equal to 9.
If you want to assign x a value, you need to write
a < b ? x = a + b : x = 9;
My opinions may have changed, but not the fact that I am right.
|
|
|
|
|
Thanks, your both right. I'm glad it's working now.
"The man who reads nothing is better educated than the man who reads nothing but newspapers."- Thomas Jefferson
|
|
|
|
|
DaveE9th wrote:
a < b ? x == a + b : x == 9;
You could also do this:
x = ( a < b ? a + b : 9 );
There are 10 kinds of people - those that get binary and those that don't.
|
|
|
|
|
x = ( a < b ? a + b : 9 );
This is the right way.
|
|
|
|