|
I don't quite understand what you're trying to do. Do you want the new dialog to update the controls ON the form view or use the same logic to calculate what should be displayed and apply that change to controls on the dialog? If it is the first, you can't do that if the dialog is modal - the message pump for the form view does not run while a modal dialog is displayed. You can make the dialog modeless but it still should not directly updates controls on the form view. Post a message to the form view from the dialog telling the form view what to do and let it do the update itself. If it is the second, create a method that takes a control pointer as a parameter and call it from both places. As long as the method only operates on the passed in control pointer, it is fine.
Hope that helps since you're question was not clear
Judy
|
|
|
|
|
Thanks. The dialog is modeless now. I decided to use a 'Sendmessage' method to update list control on form view.
I've just created (for the form view) a message map:
ON_MESSAGE(UWM_UPDATE_L, &CBazaproduktówView::OnUpdateL)
and defined:
#define UWM_UPDATE_L (WM_APP + 1) .
There is also a function, that handles an event:
LRESULT CBazaproduktówView::OnUpdateL(WPARAM wParam, LPARAM lParam)<br />
{<br />
UpdateListyTowarow();
return 0;<br />
}
When I use Sendmessage(UWM_UPDATE_L) form the form view everything is fine! But... program crashes if I use it in the dialog:
CFrameWnd * pFrame = (CFrameWnd *)(AfxGetApp()->m_pMainWnd);<br />
CView * pView = (CView*)pFrame->GetActiveView();<br />
pView->SendMessage(UWM_UPDATE_L);
Bang!
What's wrong? I don't understand.
|
|
|
|
|
Two things. 1) Use the debugger - it will go right to the line having the problem when the program crashes. You'll be able to see what's wrong. 2) You're missing the last two parameters to SendMessage - it should be pView->SendMessage (UWM_UPDATE_L, 0, 0)
Judy
|
|
|
|
|
When I'm using this code
CFrameWnd * pFrame = (CFrameWnd *)(AfxGetApp()->m_pMainWnd);<br />
CView * pView = (CView*)pFrame->GetActiveView();<br />
pView->SendMessage(UWM_UPDATE_L, 0 ,0);
in any function/event of my form view, everything is fine. When I use it in the dialog - program crashes. Debuger didn't show me any interesting info about this problem. I'm a bit confused.
|
|
|
|
|
overheat wrote: Debuger didn't show me any interesting info about this problem
I find that highly unusual. Did you go back up the call stack, examining each and every parameter to your functions? Did you try putting a breakpoint in the function that crashes before the line that crashes and single-stepping? Since the problem is in the update function, did you single-step through that function? You haven't shown enough code to help - there is nothing wrong in what you've shown. There's probably something in that function you call from within the update that is the problem. Does it crash if you use PostMessage instead of SendMessage?
|
|
|
|
|
In one project I was wanting to do something like you say but mixing DialogBoxes that have to interact with other views gave me a lot of problems. At the end I changed the structure and use all view-derived classes. The structure was 1 ScrollView as Main view, and then so many CFormView derived forms of 3 possible different types as elements in the main view were, and all could be opened at once.
I got it saving a CElementView pointer in every element, to access the different views and its parameters through the pointer. If you think it is something similar with what you want to reach. Take a look to this message[^], it can maybe help you.
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
“The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
|
|
|
|
|
Hello
-----
LONG MCIWndOpen(
hwnd,
szFile,
wFlags
);
I'm going to use above function in my unicode app. But it seems to not work with unicode as szFile parameter. Is there any way to have it to work with unicode OR convert my file path to ansi? (It's just in unicode at present)
|
|
|
|
|
The docs state "Unicode: Declared as Unicode and ANSI messages", whatever that means.
If you convert the string to ANSI and the call succeeds, then you have your answer
Not much strong typing in that ancient API.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
It should work fine with Unicode. Searching the SDK turns up the following:
From "Vfw.h" (searching for "MCIWndOpen"):
------------------------------------------
#define MCIWndOpen(hwnd, sz, f) (LONG)MCIWndSM(hwnd, MCIWNDM_OPEN, (WPARAM)(UINT)(f),(LPARAM)(LPVOID)(sz))
From "Vfw.h" (searching for "MCIWNDM_OPEN"):
--------------------------------------------
#ifdef UNICODE
#define MCIWNDM_OPEN MCIWNDM_OPENW
#else
#define MCIWNDM_OPEN MCIWNDM_OPENA
#endif
From "Vfw.h" (searching for "MCIWndSM"):
----------------------------------------
#ifdef __cplusplus
#define MCIWndSM ::SendMessage /* SendMessage in C++*/
#else
#define MCIWndSM SendMessage /* SendMessage in C */
#endif /* __cplusplus */
From "WinUser.h" (searching for "SendMessage"):
-----------------------------------------------
#ifdef UNICODE
#define SendMessage SendMessageW
#else
#define SendMessage SendMessageA
#endif // !UNICODE
Steve
|
|
|
|
|
hi
Could someone please tell me how can i open a txt file with a press of a button (MFC)?
not with the infile >>> i mean open "text file"
and another question if i may....
Is there any way i can transform a cpp file to a txt file (keeping the same content) ?
and if it can be done .... how i can do it?
any help would be reallly appriciated
thanks in advance
|
|
|
|
|
lahom wrote: i open a txt file with a press of a button (MFC)
Create an event handler for the button press and call CreateFile
lahom wrote: Is there any way i can transform a cpp file to a txt file (keeping the same content)
A .cpp file IS a text file. Just change the extension
Judy
|
|
|
|
|
lahom wrote: Could someone please tell me how can i open a txt file with a press of a button (MFC)?
in your button's on click (actually BN_CLICKED) handler function.
{
CFileDialog dlg(TRUE, _T("txt"), NULL, OFN_FILEMUSTEXIST,
_T("Text Files (*.txt)|*.txt|All Files (*.*)|*.*||"), NULL);
if(IDOK == dlg.DoModal())
{
CString strFileName = dlg.GetPathName();
try
{
CStdioFile file(strFileName, CFile::typeText | CFile::modeRead);
CString strLine;
while(file.ReadString(strLine))
{
}
file.Close();
}
catch (CFileException* pex)
{
pex->ReportError();
pex->Delete();
}
}
}
lahom wrote: Is there any way i can transform a cpp file to a txt file (keeping the same content) ?
.cpp files are plain text files in contents.
Simply, copy the file with .txt extension.
|
|
|
|
|
You must make a event for your button and then you can use of CFile class.
|
|
|
|
|
lahom wrote: Is there any way i can transform a cpp file to a txt file (keeping the same content) ?
see rename function and CopyFile api is of any use??
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You/codeProject$$>
|
|
|
|
|
Hi all,
I am planning to develop a website which have a simulator where allows users to design thier nail design online. This will be something drag and drop the design to the fingernail in 3D mode.
I would like to ask can this implement in C# with Managed DirectX? And, how do I implement this using C# wi9th Managed DirectX?
Thanks.
|
|
|
|
|
|
Some suggestions:
1. Take your meds
2. Stop spamming
3. Check your local hardware store, they know everything there is to know about nails
|
|
|
|
|
I got some sounds from network(about 5 remote stations),I wanna to mix them with directsound.
now ,I only get the WAVEFORMATEX .How do I play mix and play?
notes:
There are some CWavefile examples in the directsound sdk,but all are
mixing wavefile on the harddisk.
|
|
|
|
|
You can use an individual secondary buffer to play each of the streams.
DirectSound will mix them all (to the primary buffer) for you.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
hi,Thank u .
There is a failure when it CreateSoundBuffer.
My App use many wave*** apis for catch speech .maybe they conflict each other.
Am I right?
|
|
|
|
|
doudou-shen wrote: There is a failure when it CreateSoundBuffer
What's the error code? What does the code look like? Have you
properly initialized the buffer descriptor?
I don't know of any conflicts with Windows multimedia APIs, nor
have I experienced any.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hello,
I have come across few applications which use MS FlexGrid written in MFC. Can someone tell me what the function SetTextArray(column, "string") does? If it sets the text in a column, don't we need to specify the row there?
I have searched for tutorials and could not find anything helpful. So please suggest a good tutorial which explains what the functions are used for...
The problems that exist in the world today cannot be solved by the level of thinking that created them.
- Albert Einstein
|
|
|
|
|
i dont think you can get any doucment for the flexgrid.
But regarding SetTextArray(arg1,arg2),
arg1 is the cell number and arg2 is the data that u want to display.
Cell numbering starts from the topleft corner and ends with bottom right corner.Like 0 1 2 3
4 5 6 7
8 9 10 11
Hope this answer helps you,
Sunil.
|
|
|
|
|
Thanks for the reply.
The problems that exist in the world today cannot be solved by the level of thinking that created them.
- Albert Einstein
|
|
|
|
|