|
That is a tall order, not really that simple.
Take a look at this article http://www.codeproject.com/dialog/visualfx.asp.
The author essentially puts all views in a splitter.
Let me know if I can be of any help after you read it.
Vaclav
PS English is not my native language however in an informal enviroment like this group is you do not need to start "excuse me..."
I can speak only for myself but this is a very friendly bunch.
Just say "Hi" in future.
Cheers
|
|
|
|
|
Hey,
I have realized you are the one I tried to help with the dinamically creation of views and its relationships. Did you get it?
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
|
|
|
|
|
First of all....
Several Views = Always the same number of views??? OR
Several Views = Random numbers of views (as much as needed)????
The views are created all in once and then want to change the active? or the views are created one per one (i.e. clicking a button "create" or doubleclicking in an element?)
You want to have only one CFormView with a button for every other view? or a relation of buttons in every window that allow you to switch to every other view?
If the view is closed, you want to create it? or you can only go to that view when it is opened?
It's possible and relative easy (depending on your answers may be more complicated)
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
|
|
|
|
|
Hi,
nice to hear from you.
Well I am currently developing an application which has three documents and they all have pretty much same "static" views. Presently I do not need dynamic / new views and have put such creation on back burner. But I do remeber your solution and have a copy of it in my project - thanks.
I do like mentioned visual framework but I keep running into problems with it. Right now I have changed the way the documents are manipulated ( document alters the text file) and one of the views has a rich text control attached to display the text file.
And it asserts on creation of the view... It worked fine when the file got procesed in the view itself. So I am debugging,
Cheers
Vaclav
|
|
|
|
|
I faced out with such assertions during my project. It can be that you are trying to initialize the values of the control in the constructor of the view. Does will crash because the view is being created but it is not yet. So the controls that needs relationships with the frame which contains them, doesn't have the handlers in this moment and an assertion comes.
I solved it creating/initializating/charging datas for the controls in the OnInitialUpdate ();
maybe works for u too
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
|
|
|
|
|
I'm learning C++/MFC (Visual C 3.0). I've successfully written a MFC program that has menus, and one of the menus brings up a dialog box.
When the 'OK' is selected on the dialog box, I want the non-trivial application code to run. It takes 20+seconds. Then another dialog box is needed.
How do I call/cause the application code to run, and when it has completed, how do I bring up the second dialog box?
===========================================================
the first Dialog box code snippet where I can capture the 'OK':
nRet=dlg.DoModal();
// Handle the return value from DoModal
switch ( nRet )
{
case IDOK:
// Do something
Thanks in advance
Dan
|
|
|
|
|
daniel33433 wrote: ...when it has completed, how do I bring up the second dialog box?
Since you are using a modal dialog box, DoModal() does not return until the dialog has been dismissed.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
For info on starting another process, see here[^]
Once you get the other process running, if you want to wait for it to finish,
you're getting out of newbie territory.
If you want the spawning app to remain responsive, it needs to process window
messages while waiting for the spawned app to complete. There's lots of ways
to do this.
Here's an example of one method for you to study.
This example
1) creates another process (I used Notepad as an example)
2) disables the main window of the calling app so the user can't do anything there
(note that this example was tested from the main window class. You may need to
enable/disable your app's main window a little differently, depending on where this code
is used)
3) enters a modal loop to wait for the spawned process to terminate. To keep
the calling app responsive in the meantime, queued window messages are dispatched.
4) enables the main window of the calling app so the user can continue
*Edit* Replace those stupid smilies with capital 'P's LOL
nRet=dlg.DoModal();
switch ( nRet )
{
case IDOK:
{
STARTUPINFO StartupInfo;
memset(&StartupInfo, 0, sizeof(STARTUPINFO));
StartupInfo.cb = sizeof(STARTUPINFO);
StartupInfo.dwFlags = STARTF_USESHOWWINDOW;
StartupInfo.wShowWindow = SW_SHOWDEFAULT;
PROCESS_INFORMATION ProcessInfo;
if (::CreateProcess(_T("C:\\WINDOWS\\notepad.exe"),
NULL,
0,
0,
FALSE,
NORMAL_PRIORITY_CLASS,
0,
0,
&StartupInfo,
&;ProcessInfo
))
{
EnableWindow(FALSE);
while (true)
{
DWORD dwWaitRet = ::MsgWaitForMultipleObjects(1, &;ProcessInfo.hProcess, FALSE, INFINITE, QS_ALLEVENTS);
if (WAIT_OBJECT_0 == dwWaitRet)
{
break;
}
else if (WAIT_OBJECT_0 + 1 == dwWaitRet)
{
MSG msg;
while (::PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE))
AfxGetApp()->;PumpMessage();
}
}
::CloseHandle(ProcessInfo.hProcess);
::CloseHandle(ProcessInfo.hThread);
EnableWindow(TRUE);
}
}
} I hope this gives you some ideas to work with. There's many ways to do this.
This example is relatively simple and doesn't involve multiple threads.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi -
I'd like to create online backups of my Visual Studio directories. I work from a location with a reeeeeaaaallllllyyyyy sllllloooowwww connection, so I was thinking of creating as minimal backups as possible. Has anyone solved this problem?
I was thinking that I only need the .vcproj, the .rc, the source code (.cc and .h) to be able to completely recreate the project.
Am I on the right track here?
Thanks!
|
|
|
|
|
I back up every couple of hours or after a major code problem gets solved/overcome.
In order to make it all fit in a reasonable space, I just delete the .ncb file, release folder , and debug folders. Those seem to be the biggest users of disk space (for medium to large projects at least) IMO.
|
|
|
|
|
ok, that fits the bill perfectly - thanks!
|
|
|
|
|
Hello,
I have UDP app that works fine, except on Windows Vista.
The error is WSAEINVAL (10022) on sendto function, and the package did not send
Anyone know this problem?
Thanks,
Cris.
|
|
|
|
|
Tough to guess without knowing the code
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Cris wrote: The error is WSAEINVAL (10022) on sendto function...
WSAEINVAL = "An unknown flag was specified, or MSG_OOB was specified for a socket with SO_OOBINLINE enabled."
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
This is my code:
<br />
SOCKET m_maSocketOut;<br />
struct sockaddr_in m_SockAddrOut;<br />
unsigned long m_lInet;<br />
.<br />
.<br />
<br />
void init(CString strServer)<br />
{<br />
unsigned long lInet=0;<br />
<br />
memset(&m_SockAddrOut, 0, sizeof(m_SockAddrOut));<br />
<br />
m_maSocketOut = socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP); <br />
m_SockAddrOut.sin_family = AF_INET;<br />
m_SockAddrOut.sin_port = htons(port);<br />
<br />
struct hostent FAR* hp = gethostbyname((char FAR *) (const char *) strServer);<br />
<br />
if (hp == NULL)<br />
{<br />
lInet = inet_addr((const char * ) strServer); <br />
if (lInet != INADDR_NONE) <br />
{<br />
validIP = TRUE; <br />
byAddress = TRUE; <br />
}<br />
}<br />
else<br />
validIP = TRUE;<br />
<br />
if (validIP)<br />
{<br />
if (byAddress)<br />
{<br />
m_SockAddrOut.sin_addr.s_addr = lInet;<br />
m_lInet = lInet;<br />
}<br />
else<br />
{<br />
m_SockAddrOut.sin_addr.s_addr = *((unsigned long far *) hp->h_addr);<br />
m_lInet = *((unsigned long far *) hp->h_addr);<br />
}<br />
<br />
if (m_maSocketOut != NULL)<br />
{<br />
bind(m_maSocketOut, (SOCKADDR*)& m_SockAddrOut, sizeof(m_SockAddrOut));<br />
WSAAsyncSelect(m_maSocketOut, hWnd, WM_EXTERNA, FD_READ | FD_CLOSE);<br />
}<br />
}<br />
}<br />
<br />
void sendData(char szData[], int len)<br />
{<br />
int result = sendto(m_maSocketOut, (char FAR *) &szData, len, <br />
NULL, (PSOCKADDR) &m_SockAddrOut, sizeof(m_SockAddrOut));<br />
m_SockAddrOut.sin_addr.s_addr = INADDR_ANY;<br />
<br />
if (result < 0)<br />
{<br />
int erroCode = WSAGetLastError();<br />
}<br />
}<br />
Important: This error code is only on Windows Vista, but not all instalations . I don't know which the exat situation, but I observed in Business and Ultimate version.
Any idea?
|
|
|
|
|
Could it be a UAC thing?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
No, the UAC configuration is not enabled.
|
|
|
|
|
I have solved the problem... removing the bind() function execution.
Acording with the MSDN documentation:
"The bind function is used on an unconnected socket before subsequent calls to the connect or listen functions. It is used to bind to either connection-oriented (stream) or connectionless (datagram) sockets. When a socket is created with a call to the socket function, it exists in a namespace (address family), but it has no name assigned to it. Use the bind function to establish the local association of the socket by assigning a local name to an unnamed socket."
I understood that the bind function is not necessary, because I only want to send datagrams with a SOCKET to server and receive the responses by the same SOCKET, and the WSAAsyncSelect function grants the data response to the app.
This is correct?
Thanks,
Cris.
|
|
|
|
|
I've been looking through the MSDN documentation, but I haven't found how to add topics to html help in a VS2003 project. In particular, some how dialog controls must be maped to IDs in the HTML help project file. (I found how to get from there to the html files.) Could anyone explain how this happens?
Nathan
|
|
|
|
|
Hi all,
I am trying to use this class http://www.codeproject.com/cs/files/CABCompressExtract.asp?df=100&forumid=336576&fr=26[^] in my dialog class. But as soon as I declare the object, it failed to compiled with the following error:
c:\testcompress\compresst.hpp(466) : error C2661: 'new' : no overloaded function takes 2 parameters
c:\testcompress\compresst.hpp(465) : while compiling class-template member function 'void *__cdecl Cabinet::CCompressT<class Cabinet::CCompress>::Alloc(unsigned int)'
Error executing cl.exe.
Here is my function call:
void CTestCompressDlg::OnButton1()
{
UINT u32_CabID = 12345;
UINT u32_SplitSize = 0x7FFFFFFF;
char s8_CompressFile[MAX_PATH];
Cabinet::CCompress i_Compress;
i_Compress.CreateFCIContext(s8_CompressFile, u32_SplitSize, u32_CabID);
}
And here is the snippet on the failing line:
namespace Cabinet
{
template <class T> class CCompressT
{
public:
...
protected:
static void* Alloc(UINT size)
{
return operator new(size);
}
...
}
}
Anyone has any idea why, please? Thanks a lot in advance.
|
|
|
|
|
Maybe try
return new BYTE(size);
or
return new unsigned char(size);
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
They didn't work either.
Btw, the demo compiles fine. How could it be?
|
|
|
|
|
Same compiler error? It works for me on VS 2005.
Do you need to include new.h?
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi Mark,
Just to be clear, this is what I did:
1. Create a dialog based app
2. #include "ExtractResourceT.hpp"
#include "CompressT.hpp"
3. Create a button with OnButton1() function as above
4. Compile
Are you telling me that those steps works in VS2005?
(Mine is VC++ 6).
PS. "include new.h" generated even more errors relating to new.h
|
|
|
|
|
I recall that Visual C++ generates code with a debug feature in which new is #Define d as something else in debug builds. Does it compile in release mode?
Nathan
|
|
|
|