|
I found the error by myself. But now I have anonther problem:
Now all items are inserted in the right place, but when I use the flag "MF_POPUP" they are not inserted into the popup-menu
|
|
|
|
|
try this one:
TCHAR szString[256];
m_Menu.CreatePopupMenu();
/* insert items in m_Menu using the AppendMenu function */
pMenu = GetMenu();
pMenu->EnableMenuItem(ID_MENU_POPUP, MF_ENABLED);
pMenu->GetMenuString(ID_MENU_POPUP, szString, sizeof(szString), MF_BYCOMMAND);
pMenu->ModifyMenu(ID_MENU_POPUP, MF_BYCOMMAND | MF_POPUP, (UINT)m_Menu.m_hMenu, szString);
/* end */
ID_MENU_POPUP is the menu ID of the menu item where you want a popup menu to be inserted.
Make sure you destroy m_Menu after using it. Use the DestroyMenu function for this one.
|
|
|
|
|
I have a simple component written in c++ that uses Apache Xalan/Xerces to do XSL Processing - for the sake of getting to the heart of the problem I am having I have hard coded it to a small XML/XSL pair (strings in the code).
When I create an ASP page which uses this component it works fine the first time (outputs transformed XML) - but any number of times I try after that it is failing (outputs nothing). I have debugged into the Apache code and it seems to be failing at a custom smart pointer (as much trouble as help!) creation deep within the code for creating a source tree out of the XML (remember it works fine the first time) (XalanSourceTreeParserLiaison.cpp line 167).
Now the strange part is that if I create a VB test app to use my component it works fine every time.
The really unfortunate thing is that the Apache code has a try {} catch {} surrounding the code that fails but it is catching (...) (above it there are comments saying "need to fix this") so I cannot see what exception is being thrown.
Any thoughts? My assumption is that this has something to do with threading... But that's just my guess.
|
|
|
|
|
it turns out that inside of the Xerces code (which Xalan uses as an XML Parser - everyone act surprised) there is use of static function scope variables. These get initialized upon creation and stay around until the process they were created in dies.
the Xalan/Xerces system needs to be initialized/terminated, and in the termination process a number of objects that have been hanging around are deleted... one of them is a mutex object that was _pointed_ to by one of the aforementioned static function scope variables. This static function variable is returned by its function unchanged if it already has a value or with a new address (housing a new mutex object) if it is NULL. the returned handle to the mutex is fed to ::EnterCriticalSection() which will barf if the handle is invalid.
to recap - after you call Terminate() the handle isn't valid and since it is static and ASP doesn't unload dlls immediatly (it just loads that baby up and keeps on getting new handles to instantiations of the objects of it) the pointer to the handle is still around. so the next time that an ASP page is accessed which creates this object an exception is thrown within Xalan and no transformation takes place.
The solution is to Initialize() and Terminate() the Xerces/Xalan system at the process creation/deletion level which I did by adding the appropriate code to DLLMain and removing it from elsewhere. Now things work great and the only thing I have to worry about is the fact that from the time the DLL is loaded into memory by ASP to the time it is finally removed I have the Xerces system up and ready to go (potentially taking up memory....).
|
|
|
|
|
When I call MAPISendMail(..), it will only execute correctly if I have Outlook running. If Outlook isn't running I get a MAPI_E_LOGIN_FAILURE error returned. I've tried MAPILogon to create a session, still no luck. Any ideas?
|
|
|
|
|
Hey Kevin...how are you calling MAPISendMail?? You can specify as a calling parameter to popup a MAPI logon box to authenticate yourself...
Erik
I hit faked him with my win32 API .chm and the peabrain goes for it. I follow it up with a salvo of left's and right's sending him down hard. It's lunch time and he's getting a Champ Sandwhich Special. I said, How's that Mr. VB?! Is that 'I wanna use COM in that Server enough for you?!'
...Ever since then, I've been the Champ.
|
|
|
|
|
Hi there,
i'm curious about how does static_downcast and dynamic_downcast works ???
Thanks for any answer !
Have a nice day !
|
|
|
|
|
I have a class derived from CObList. When serializing this class it writes to the disk just fine. However
when reading from the file, the serialization aborts with an unexpected file format.
I'm getting "Warning: Cannot load CGroups from archive. Class not defined." in the debug window, coming
from a TRACE call in arccore.cpp.
My question is that, according to all the information I am gathering from sites, calling CObList::Serialize( ar ) from
within my CGroups::Serialize( ar ) method should perform the proper serialization of the object and even
store the CGroups object information in the file so that on a read the CArchive knows what object it is
retrieving.
Yet, arccore.cpp still returns for me the message above and the serialization bottoms out.
Does anyone have any leads as to a culprit for this problem?
Thanks!
"Why are we hiding from the police, Daddy?"
"We use VI, son. They use Emacs."
|
|
|
|
|
CGroup::Serialize code, please
Tomasz Sowinski -- http://www.shooltz.com.pl
|
|
|
|
|
void CGroups::Serialize(CArchive& ar)
{
CObList::Serialize( ar );
if (ar.IsStoring())
{
ar << m_GroupCode << m_GroupDescription;
}
else
{
ar >> m_GroupCode >> m_GroupDescription;
}
if(AfxIsValidAddress(*(void**)m_Categories, sizeof(void*), FALSE))
m_Categories->Serialize( ar ); //another CObList
}
"Why are we hiding from the police, Daddy?"
"We use VI, son. They use Emacs."
|
|
|
|
|
I'd set a breakpoint in arccore.cpp, line 318. Each object serialized via operator << is preceeded by the class name. Your problem is related to file layout - when application reads file, class name is missing/invalid. Looks like calls to CArchive methods related to writing and reading differs in order - maybe you screwed something in CYourDoc::Serialize?
BTW: Why are you using AfxIsValidAddress? I'm not sure if this is your problem, but testing for validity of the object this way seems strange. It's *your* code and you should know if m_Categories is valid or not. AfxIsValidAddress only checks if object is withing the program's memory space.
Tomasz Sowinski -- http://www.shooltz.com.pl
|
|
|
|
|
Hey,
if (ar.IsStoring())
{
ar << m_GroupCode << m_GroupDescription;
}
else
{
ar >> m_GroupCode >> m_GroupDescription;
}
This looks pretty dangerous. I've learned that it's not a good practice to trust the compiler to handle expressions like these in the right order (which one will be serialized or deserialized first, m_GroupCode of m_GroupDescription?)
I'd say:
if (ar.IsStoring())
{
ar << m_GroupCode;
ar << m_GroupDescription;
}
else
{
ar >> m_GroupCode;
ar >> m_GroupDescription;
}
Structured programming vs. chaotic mind boggling
|
|
|
|
|
Hi,
I have a big speed problem...
I'm working on a database and I access it on a SQL server on local network..
It takes me about 1 minute to write 7000 records... That's way to slow!
I thought at first it could be the network speed that would make it slow but I made tests with an MS Access database on the same network and without changing a line of code, writing 7000 records takes less than a second!!! So the network is not the problem...
Could the problem be in my code? Or is it MSSql that is to slow?
Somebody have an idea on that?
It would be very appreciated!
Thanks
Frederico
|
|
|
|
|
How you are inserting records?
With Insert or with a Store Procedure?
Do Inserts is slow in SQL Server, is More quick To execute a Store Procedure that make the insert.
Carlos Antollini.
|
|
|
|
|
I'm using MFC class CRecordset.
I create a class derived from CRecordset and bind all fiels to the database fields.
Then I create an instance of that class and establish the connection through an ODBC an a CDatabase object.
CTableOneSideData* cxOneSide = new CTableOneSideData(cxDatabase);
//open the table
if(cxOneSide->Open(NULL))
{
if (cxOneSide->CanAppend())
{
//insert values into fields
}
cxOneSide->Update();
}
Could you tell me more about Store Procedure?
Thanks a lot.
Frederico
|
|
|
|
|
I know that several Windows standard fonts, like Times New Roman have app. 500~700 symbols for different charsets. How can i use all the symbols in VC++. I know i may specify SYMBOL_CHARSET or DEFAULT_CHARSET, how can i use them both at the same time?
|
|
|
|
|
Hello, the codegurus around the world.;)
Try to use CRichEditCtrl to change the character set on the selected text.
CRichEditCtrl::SetSelectionCharFormat
However, I never use this, but it might work.
Have a nice day!
-Masaaki Onishi-
|
|
|
|
|
I have a TreeList view, where the first column is a tree view and the second cloumn is a list, with each list item corresponding to a tree item.
I can change list item label via button control (to increase or decrease the value) or edit it value using a dialog box. When I use the button control, I find the the label on the list is not refreshed, I need to deselect it before the values changes. And when I use the dialog to change the value, it does nto change at all.
How can I make the label on the list change 'instantaneously'?
Thanks in advance
|
|
|
|
|
After changing your value, try:
UpdateData(false);
Hope it will help!
Regards
Frederico
|
|
|
|
|
i've tried that btu it still doesn't work.
|
|
|
|
|
Hi all,
I created a wizard generated project using CHtmlView. Everything works well, but unlike IE, the "Enter" key does not work as a shorcut to submit a form. Does anybody know how to fix that? I'm using Windows 2000 Pro SP2
|
|
|
|
|
Dear Gurus,
I have run into a problem that I think you might be able to help me with.
I have developed a program that leaves a blank tab in the taskbar (No title at all) when it is running. Now my problem is that I donot want people to be able to minimize the software by rightclicking on the blank tab in the taskbar. Can someone show me how to disable the right click options on this blank tab?
Or is there a way to get rid completely of this blank tab in the taskbar.
Please Help I have been fighting with this problem for over two weeks now on my own.
Thanks in advance,
Raymond Bentoera
|
|
|
|
|
Have you tried adding WS_EX_TOOLWINDOW to your Windows Style. This should prevent the window from appearing in the taskbar.
Michael
|
|
|
|
|
Check this KB article: Q205158 "HOWTO: Prevent a Window from Appearing on the Taskbar"
Tomasz Sowinski -- http://www.shooltz.com.pl
|
|
|
|
|
Please Mr. Sowinsky,
Can you please give me the exact URL. Becaus I gate a page that is about graphics and sprites.
Thanks in advance,
Raymond Bentoera
|
|
|
|