|
Programmers Paradise has the Visual Studio.net Professional upgrade for $195.99 after a $300 rebate. Any better offers out there?
Do not quite understand why Code Project is offering the full version of Visual Studio.net for $799, when most of us only need the upgrade, and we do not need the "extras" from Dundas and Wintellect. Perhaps Code Project can give us a great deal on the upgrade too?
|
|
|
|
|
Is there a unique MFC protection that keeps an object to another class from modifying its private data?
I have a CStringArray in the my document class (single-document). I pass the CStringArray object to class function belonging to another object that I instantiate inside of the document class.
For example:
#include myOutsideClass;
void CMyClassDoc::change()
{
myOutsideClass *pClass = new myOutsideClass;
pClass->modify(myCStringArrayObject);
}
-----
// Definition of modify()
void CMyOutsideClass(CStringArray &array)
{
array.RemoveAll(); // remove all data from object array
array.Add("testing"); // insert "testing" into object array
}
-----
Notice I pass the CStringArray object into modify using reference. Function modify(CStringArray &array) can read data from the object array. However, it cannot make permanent changes such as RemoveAll(), Add(), and/or SetAt().
Is there a internal protection algorithm that keeps another object from making permanent changes to a member object? I tried declaring the CStringArray inside of CDocument in public. That does not work either. The program crashes with an *access violation* error.
Thanks,
Kuphryn
|
|
|
|
|
Did you run the program in Debug mode?
please try run in Release mode!
or in Debug mode:
-----------------------------
if( array.GetSize() > 0 )
array.RemoveAll();
|
|
|
|
|
Okay.
I think I know what's going on. I am working with CString object and string object. The program does not copy data from the CString object into the string object correct.
For example:
CString cStr = "testing";
string temp;
temp = cStr; // this does not produce an error. However, it does not work
temp = cStr.getat(1) // same as above
What do I need to cast the cStr so the temp assigment = will work correctly?
Kuphryn
|
|
|
|
|
CString cStr = "testing";
string temp = "";
char p[80];
strcpy(p,"testing");
temp = p;
memset(p,0,sizeof(p));
// or temp = cStr;
AfxMessageBox( temp.c_str() );
char szBuffer[80];
strcpy(szBuffer, temp.c_str() );
AfxMessageBox( szBuffer );
-------------------------------
both show messageBox "testing"
|
|
|
|
|
|
Thanks!
I have one question.
In the line:
// CString myString;
CEditCtrl::GetLine(1, myString.GetBuffer(255), 255);
Is 255 the maximun number of characters in *that line*?
I would like to get everything on that line.
In general, is the size (255 in this case) referring to bytes or characters (characters * bytes = maxsize?).
Kuphryn
|
|
|
|
|
How can I have a full screen window (with or without a border) like those we have in expert mode in many applications like MS Word and Photoshop (also used in screen savers I think)?
Regards
(a.k.a. Wal2k) www.wal2k.com
|
|
|
|
|
Not used by screen savers at all, but the way to do it is simply to resize your window so the caption is above the visible window and the status bar is below it. I believe you can programatically hide/show the taskbar, but I'm not sure how.
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
"I'm somewhat suspicious of STL though. My (test,experimental) program worked first time. Whats that all about??!?!
- Jon Hulatt, 22/3/2002
|
|
|
|
|
Christian Graus wrote:
I believe you can programatically hide/show the taskbar, but I'm not sure how.
Just find it with ::FindWindow("The_class_name_of_taskbar", NULL) and then you cab show/hide it programaticly.
------------------------------------
Rickard Andersson, Suza Computing
ICQ#: 50302279
I'm from the winter country SWEDEN!
------------------------------------
|
|
|
|
|
Well, that much is obvious, but I thought there was a more *specific* way
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
"I'm somewhat suspicious of STL though. My (test,experimental) program worked first time. Whats that all about??!?!
- Jon Hulatt, 22/3/2002
|
|
|
|
|
HWND FullScreenWindow = ::CreateWindowEx(WS_EX_TOPMOST,
_T("MyRegisteredWindowClass"),
NULL,
WS_POPUP,
0,
0,
GetSystemMetrics(SM_CXSCREEN),
GetSystemMetrics(SM_CYSCREEN),
NULL,
NULL,
TheApplicationInstanceHandle,
NULL);
ShowWindow(FullScreenWindow, SW_SHOW);
or something like that
---
CPUA 0x5041
Sonork 100.11743 Chicken Little
It may be that your sole purpose in life is simply to serve as a warning to others.
|
|
|
|
|
I think this does it, TOPMOST is the key .. thanks pal.
Also thanks for all the others.
(a.k.a. Wal2k) www.wal2k.com
|
|
|
|
|
When I do the SetCurSel on the combobox, is there a notification that I receive. I want to handle the change of selection the same way for both programatic and user change.
But, the user change notifications CBN_SELENDOK and CBN_SELCHANGE are not happening when i use SetCurSel.
Should I use another API to select the item to make the notifications occur or is there another notification that is end for programatic changes.
Thomas
modified 29-Aug-18 21:01pm.
|
|
|
|
|
Thomas George wrote:
When I do the SetCurSel on the combobox, is there a notification that I receive. I want to handle the change of selection the same way for both programatic and user change.
But, the user change notifications CBN_SELENDOK and CBN_SELCHANGE are not happening when i use SetCurSel.
Should I use another API to select the item to make the notifications occur or is there another notification that is end for programatic changes.
Thomas
modified 29-Aug-18 21:01pm.
|
|
|
|
|
Huh?
What's the duplicate post for?
Nish
One little CD gone,
Then two CDs gone,
Then 5 more gone,
For a total 7 gones,
If I was a CD R,
I'd wanna cry,
Cause I'd be just a goner,
For a nasty CD burner.
[funny how frustration wakes up the poet in me]
|
|
|
|
|
Unfortunately, all you can do is manually trigger the handler whenever you change the selection. If this is something you need to do a lot, you might want to consider making a custom combo box class, otherwise you'll just have to live with it.
--------
Sip my mind.
|
|
|
|
|
Any idea why this message map would crash my program (sometimes exit without crashing) only in release mode, not in debug mode
ON_COMMAND_RANGE(1001, 6999, OnButtonClick)
Even if I declare OnButtonClick to be empty like so:
OnButtonClick(WPARAM wParam, LPARAM lParam) {}
It crashes as soon as I click one of the dynamically created buttons with an ID in that range.
-Jack
To an optimist the glass is half full.
To a pessimist the glass is half empty.
To a programmer the glass is twice as big as it needs to be.
|
|
|
|
|
handlers for ON_COMMAND_RANGE only take a single UINT parameter.
BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd)
ON_COMMAND_RANGE(ID_FILE_MENUITEM1, ID_FILE_MENUITEM3, OnFileMenuItems)
END_MESSAGE_MAP()
void CMainFrame::OnFileMenuItems(UINT nID)
{
CMenu* mmenu = GetMenu();
CMenu* submenu = mmenu->GetSubMenu(0);
submenu->CheckMenuRadioItem(ID_FILE_MENUITEM1, ID_FILE_MENUITEM3,
nID, MF_BYCOMMAND);
}
-c
Conscience is what hurts when everything else feels good.
Smaller Animals Software, Inc.
|
|
|
|
|
Thanks a ton. I dunno where I got those params from.
-Jack
To an optimist the glass is half full.
To a pessimist the glass is half empty.
To a programmer the glass is twice as big as it needs to be.
|
|
|
|
|
those params are what you use when you do an ON_MESSAGE handler.
-c
Conscience is what hurts when everything else feels good.
Smaller Animals Software, Inc.
|
|
|
|
|
Found this in MSDN "The COM Programmer's Cookbook". It is a #define to find an instance pointer from an interface in vanilla C.
#define IMPL(class, member, pointer) \
(&((class *)0)->member == pointer, ((class *) (((long) pointer) - offsetof (class, member))))
What I have some difficulties understanding is the cast (&((class *)0) . What exactly does that do here?
Thanks
/moliate
|
|
|
|
|
It casts the pointer returned to be the type that is passed in by the class variable, because it is first cast to long for a subtraction. Presumably it is that type of pointer to start with.
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
"I'm somewhat suspicious of STL though. My (test,experimental) program worked first time. Whats that all about??!?!
- Jon Hulatt, 22/3/2002
|
|
|
|
|
I´m feeling really stupid here, but I still don´t get it. The problem is still the first comma expression. If the interface is the first in a struct, would it not compile down to 0 , leaving a nasty null pointer exception? And what will the result be for the == operation if class->member does not equal pointer ? And isn't the pointer returned the one in the second comma expression?
I really want to understand this, but I have only used commas in simple for-loops before...
/moliate
|
|
|
|
|
#define IMPL(class, member, pointer) \ (&((class *)0)->member == pointer, ((class *) (((long) pointer) - offsetof (class, member))))
I saw the first bit the first time around and didn't think about it much, but it certainly seems to me that it's trying to dereference a NULL pointer and access a member of it, ( before checking if the address of the member == the pointer ), which surely should crash ?
Where is this used ? Where does it come from ?
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
"I'm somewhat suspicious of STL though. My (test,experimental) program worked first time. Whats that all about??!?!
- Jon Hulatt, 22/3/2002
|
|
|
|