|
Probably yet another "Liquid Nitrogen" candidate
|
|
|
|
|
|
|
Hi ,
I am using the below code for retrieving the length of a file. I have list of file names in a CStringArray object.
bool Search(CString szBinName,CString szBinSize,CStringArray& arr)
{
int nSize = arr.GetSize();
CString str,temp;
bool bRet;
bRet = false;
for(int i=0;i
|
|
|
|
|
I believe CFile::shareExclusive|CFile::shareDenyNone don't go together.
|
|
|
|
|
I have tried putting only one of the CFile::shareExclusive|CFile::shareDenyNone , still it crashes.
|
|
|
|
|
What does ex.GetErrorMessage() give you?
|
|
|
|
|
It gives me the below value for ex.GetErrorMessage
ex ={Cause=0 OS Error = m_IOsError}
|
|
|
|
|
1. Format your code with the "pre" tags. We can't see your complete "for" statement
2. Why are you passing the file size as CString?
3. What is the value of i when it crashes?
|
|
|
|
|
Hello All,
I have injected a DLL into program and get all packets through send/recv/WSASend/WSARecv and can resend it.
But if I hook the WSARecv and get the packet, how can I send it to program ? post a message or do something ?
Thanks !
|
|
|
|
|
You can IPC APIs itself.
You can use pipes itself[^]
Величие не Бога может быть недооценена.
|
|
|
|
|
Hi,
I created one popup menu and loaded in CFaceplate.cpp(dialog class)
void CFacePlate::OnContextMenu(CWnd* pWnd, CPoint point)
{
// TODO: Add your message handler code here
CMenu mnuPopup;
mnuPopup.LoadMenu(IDR_FPMENU);
CRect rBarRect;
rBarRect.left = rBarRect.top = 0;
rBarRect.right = 1000;rBarRect.bottom = 300;
// Get a pointer to the first item of the menu
CMenu *mnuPopupMenu = mnuPopup.GetSubMenu(0);
ASSERT(mnuPopupMenu);
if( rBarRect.PtInRect(point) )
mnuPopupMenu->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON, point.x, point.y, pWnd);
}
And this IDR_MENU contains four menu.I written code for this menu in CMAinframe as
void CMainFrame::OnUpdateFpgroup(CCmdUI* pCmdUI)
{
((CMainFrame *)AfxGetMainWnd())->SendMessage(WM_COMMAND,ID_GROUPVIEW,NULL);
}
It works fine.
But i used this same concept in CTuningView(View class).I can get the popup menu,but when i press the menu-Fpgroup,it doesnot go to CMainframe fucntion.I checked by placing F9.
Pls help me.
Anu
|
|
|
|
|
Well, in order to resolve your issue, you will have to provide detailed description, otherwise answer would be just a wild guess.
What kind of dialog, where is it created (what class invokes it)? Is it possibly CFormView derived view?
If there are two views, how are they being managed? Are they displayed in a splitter for example?
JohnCz
MS C++ MVP
|
|
|
|
|
I forgot ask about another thing: Why are you testing point in some arbitrary rectangle? Window would not receive WM_CONTEXTMENU message if mouse was outside of the client area.
Why are you sending a command from command update UI handler?
JohnCz
MS C++ MVP
|
|
|
|
|
Ok..let me clear everything.
In my dialog i have things like Name,Description,Values.,etc.So when i press the name i want to get popupmenu.As well as i have different views (it is related to the details in dialog eg:in Detailview,it wil display all the details for that particular Name,another view have graph of that particualr name) derived from CView only. I will switch to one particular view by pressing one menu in popup menu.
For invoking the menu fucntion,i degfined fucntion in CMainframe class.It works fine in that dialog.
Now Iam in that detailview page,now i right click i got tht popupmenu,i press Graphview,it does not go to that page.When i debugged,i got to know it didnot go to the function definiton in Mainframe class.
I know tht im missing somethin.but i can't identify that.
|
|
|
|
|
I will be straightforward and do not get upset.
Many posts start the same way yours did. You describe things assuming that I post responder knows every detail of your project. Unfortunately, nobody has a crystal ball, therefore reading intensions is not possible.
Second thing: I have asked some questions and most likely by answering them you would clarify your problem more. You have chosen to ignore all of my question and yet you expect me to answer yours.
Please help me to help you.
What I know is you are using what you describe as a dialog. From your description, it maybe is a CFormView.
Based only on assumption (modeless dialog) and unknown type of the application, not knowing how you invoke views (switching, creating new) , and assuming that you are using default MFC command message routing, I will be able only to point your mistakes that are obvious.
First, get rid of line sending command message from CMainFrame::OnUpdateFpgroup. I presume this is an update command UI handler. It is used to enable/disable or set/clear check or radio mark for a specific menu.
You are getting it after menu invoked by TrackPopupMenu is dismissed, only because you bypass or violate MFC routing mechanism.
You should use command message handler not update UI handler. Choose COMMAND not UPDATE_COMMAD_UI when you insert handler.
When you call TrackPopupMenu, you pass CWnd pointer received by the handler. Again frame window receives this message only because command routing is confused.
Most likely you do the same in a view, and that is causing undesirable behavior. Last parameter of the TrackPopupMenu call tell what window is supposed to handle this message. To properly route command you should pass a pointer to a first window that has a chance to handle it. If it does not, routing will continue. From top command i.e. Main frame down to first active child (frame or view) document, doc template (OLE stuff if registered) application).
Hence, in both cases, your call to TrackPopupMenu should be written like this:
CMenu mnuPopup;
mnuPopup.LoadMenu(IDR_POPUP_EDIT);
CMenu *mnuPopupMenu = mnuPopup.GetSubMenu(0);
ASSERT(mnuPopupMenu);
mnuPopupMenu->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON, point.x, point.y, AfxGetMainWnd());
Get rid of checking if point is in the rectangle.
JohnCz
MS C++ MVP
|
|
|
|
|
I have an annoying but simple issue:
I wrote a program that responds to mousewheel messages. The program works ok but there is one annoying thing: When i start it, it does not respond to mousewheel messages. When i activate an arbitrary other program (by clicking on it in the taskbar) and then go back to my program it will respond to mousewheel messages. So it seems that my program is activated when it is started but not 'enough' to get the mousewheel-messages going.
Is there anyone that can give light to this issue? Also suggestions on how to test things are welcome - just give me a possible clue
Rozis
|
|
|
|
|
Use a program like Spy++ that comes along with Visual Studio and check what messages, if any, are being sent to your application for a mouse wheel event.
|
|
|
|
|
Ok this is good hint. I'll try it..
But I Remembered I tried this before but I couldn't make sense of it. There was one message more in the 2 cases but that one did not give me any clue. Give me a day or so and i'll report my findings here..
Rozis
modified on Wednesday, November 25, 2009 8:28 PM
|
|
|
|
|
I know well how to ask the user to choose a file:
BOOL GetFileName(HWND wn,char*file,char*t,char*f,short write/*=1*/) {short j;
strcpy(file,tit);
ofn.lStructSize=sizeof(OPENFILENAME);
ofn.hwndOwner=wn;
ofn.lpstrFilter=f;
ofn.lpstrCustomFilter=0;
ofn.lpstrFile=file;
ofn.nMaxFile=128;
ofn.lpstrFileTitle=tit;
ofn.nMaxFileTitle=256;
ofn.lpstrInitialDir=0;
ofn.lpstrTitle=t;
ofn.Flags=write?OFN_OVERWRITEPROMPT:OFN_FILEMUSTEXIST;
j=(write?GetSaveFileName(&ofn):GetOpenFileName(&ofn))?1 : 0;
return j;}
But how can I ask the user to choose a folder? Currently I ask the user to choose any file which is in the desired folder, for example:
i=GetFileName(wn,Line,line_,"find any file in your Poser installation's root folder",filterall,0);
|
|
|
|
|
|
Weird, I've seen this before, but I'm not certain why it will do that.
One of my application dialog is shown as a distinct window in vista's task bar (I cannot test on XP now).
It's a simple CDialog derive dialog that contains some CMFCPropertyGridCtrl , some CMFCButton and a CTreeCtrl .
No weird code in the OnCreate or in the OnInitDialog .
Dialog is created from the main frame like this :
void CMyMainFrame::OnMyDialog()
{
MyDialog dlg;
dlg.DoModal(this);
}
Thanks.
This signature was proudly tested on animals.
|
|
|
|
|
The child dialog has a property called Application Window .
Set this to False .
|
|
|
|
|
Yep, that's it. don't know why/how this was set to True.
Thanks.
This signature was proudly tested on animals.
|
|
|
|
|
Hello all,
I came across a question regarding modeless dialog box and i am confused regarding the answer. The question goes like this
A Modeless dialog box must not be created over
1) Heap 2) Stack 3) Globally 4) Locally Static
which is the appropriate option to choose. Will locally static have the same scope as that of globally declared objects. As its clear that for a modeless dialog box the object must be accessible throughout the program
Regards
Sujay
|
|
|
|