|
I don't have the exact code, but you can do something like this:
CMyDlg dlg = this;
dlg.Create(dlg.IDD);
HWND hWnd = dlg.m_hWnd
EnableWindow(FALSE);
dlg.CenterWindow();
dlg.ShowWindow(SW_SHOW);
int nResult = dlg.RunModalLoop(MLF_SHOWONIDLE);
dlg.DestroyWindow();
EnableWindow(TRUE);
You can also check out MFC's code for DoModal.
Regards,
Alvaro
Hey! It compiles! Ship it.
|
|
|
|
|
Usually for this is used following method:
_CrtDumpMemoryLeaks();
From here:
http://msdn.microsoft.com/library/d...akdetection.asp
#define CRTDBG_MAP_ALLOC
#include <stdlib.h>
#include <crtdbg.h>
# other includes
Note The #include statements must be in the order shown here. If you change the order, the functions you will use may not work properly.
_CrtDumpMemoryLeaks();
I call at destructor of COM class.
Which is generated with standard COM attributes,
All Debug information is (probably) generated.
But this is not generates string numbers of leaks...
Why so?
Thanks.
__________ my stdafx.h
#define _CRTDBG_MAP_ALLOC
#include <atlbase.h>
#include <atlcom.h>
#include <atlctl.h>
#include <stdlib.h>
#include <crtdbg.h>
Outputs only "_CRT_NEW" leak strings locations...
Not useful...
|
|
|
|
|
hello im a kinda newby c++ programmer,im currently writing a socket client\server application under the windows platform.
i have established a connection between my client server app and also made my client send data,i know the client is sending corectly coz i tested it with netcat,however the server wont recive any of the text data that i am sending from the client. my problemb is with the recv(); i have seen working code that recives data in a console app but i just cant incorporate it into my mfc server.
it must only be a little mistake i am making but its really bugging me,any help or info regarding the recv function from a mfc point of view would be much appriciated
thanks 4 your time
chris
thes3cr3t1@yahoo.com
|
|
|
|
|
I don't understand your problem. What is your trouble with recv? Don't you receive data?
Do you send text data or binary data? Maybe you can provide the piece of code where you use recv.
|
|
|
|
|
int nBytes;
CString buffer;
nBytes = recv(Socket,buffer, sizeof(buffer), 0);
// check for errors
if (nBytes == SOCKET_ERROR) {
m_strStatus = "Recv Failed";
UpdateData(false);
}
else
{
// print the received message
m_strStatus = "Message Received";
m_strMessage = buffer;
UpdateData(false);
}
there is my code for the recv function,at the moment it wont compile,its complaining that it cant convert from class CString to char*.
im tryning to send text to the server,the text should be displayed in my editbox varible named m_strMessage.sometimes i do get some text in there but it isnt from the client i only assume its some sort of error code.
i have tried all sorts tryna get this to work for you it might pretty simple however im just a newby.
thank you for your time m8!
|
|
|
|
|
You have to wait until you receive data.
while(y=recv(conn,(char*)&mlMsgRecv, sizeof(mlMsgRecv),0))
{
...
}
Have a look at the following article which is a very good tutorial for the first socket steps:
http://www.codeproject.com/internet/winsockintro01.asp
|
|
|
|
|
thank you, mucha appriciated!;)
|
|
|
|
|
Hi !
My application has several instances of different objects. Some of these have to be persistant and have to be stored in a relationnal database.
I guess it would be better that my persistant objects don't know about the database, but I don't know how I should implement that. Should I have a global class knowing every persistant objects and being able to store, retrieve, delete any objet in the database ? Or should I rather have one object knowing the database for each type of persistant object ?
I would appreciate to get some hints or suggestions from you !
Thanks !
Jerome
|
|
|
|
|
If your objects are derived from MFC's CObject, why not just create a CMemFile, Archive the object to the memfile, and store the resulting buffer into an image/blob column in the database?
onwards and upwards...
|
|
|
|
|
Thanks for your answer, but I'm not using MFC !
Jerome
|
|
|
|
|
Then you need to add a Store and Load method to your object that will save/load the state from a buffer.
onwards and upwards...
|
|
|
|
|
hi,
i have to read from a file :
one|two|three
i want to extract one, two and three out of the string...
is there any way to do it??
can istringstream do it?? if so, how to do it?? someone pls help..
Thanks
Jass
|
|
|
|
|
|
http://www.codeproject.com/vcpp/stl/tokeniterator.asp[^]
this does exactly what you are trying to do.
as much as i know an updated version is in the boost library now: (www.boost.org[^]).
The only problem is that you have to install the whole shebang just for this.
if you want to do it the dangerous way, you can use the standard c string function strtok (i don't like it at all and it has many disadvantages)
hope this helps,
bernhard
"I'm from the South Bronx, and I don't care what you say: those cows look dangerous." U.S. Secretary of State Colin Powell at George Bush's ranch in Texas
|
|
|
|
|
The problem is, i can't use c string function for this assignment... so have to use c++ function to do this..
|
|
|
|
|
it's better and more straightforward anyways (if you are into stl)
"I'm from the South Bronx, and I don't care what you say: those cows look dangerous." U.S. Secretary of State Colin Powell at George Bush's ranch in Texas
|
|
|
|
|
you can always use strtok.
"A robust program is resistant to errors -- it either works correctly, or it does not work at all; whereas a fault tolerant program must actually recover from errors."
|
|
|
|
|
you can always use strtok(...)
"A robust program is resistant to errors -- it either works correctly, or it does not work at all; whereas a fault tolerant program must actually recover from errors."
|
|
|
|
|
im wondering how i map these i tried OnChar and OnKeyUp and OnKeyDown
but non of them do what i tell them to do instead it just moved the selected button on the tool bar i have here is the code i have for all 3 messages
switch(nChar)
{
case VK_UP:
curr_room.y -= 1;
break;
case VK_DOWN:
case VK_LEFT:
case VK_RIGHT:
break;
}
as you can see its imcomplete the but VK_UP doesnt even work how i want it
can someone tell me the proper way to get these keys to do work for me
thanks
|
|
|
|
|
I'm not sure to understand, could you specify these point?
* What do you want to do?
* In which class are you trying to catch the key input?
* Do you call the base class after catching the messages?
Every gun that is made, every warship launched, every rocket fired, signifies in the final sense a theft from those who hunger and are not fed, those who are cold and are not clothed - Dwight D. Eisenhower
|
|
|
|
|
i have a grid of images and only one can be selected so i want to move the selection box around with the arrow keys
im catching the key input in the main dialog
i tried both ways and neither worked
thanks
|
|
|
|
|
Have you tried to override PreTranslateMessage?
BOOL CMyDialog::PreTranslateMessage(MSG *pMSG)
{
if(pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_UP){
return TRUE;
}
return CDialog::PreTranslateMessage(pMSG);
}
Every gun that is made, every warship launched, every rocket fired, signifies in the final sense a theft from those who hunger and are not fed, those who are cold and are not clothed - Dwight D. Eisenhower
|
|
|
|
|
Hi,
how to detect 9.bit. I use ::ClearError() but it doesn't work correct ( I must detect particular BYTE where is 9.bit set to 1.
thanx
Martin
|
|
|
|
|
Most PCs don't support 9-bit communication, and I don't believe Windows does either. You can get a pseudo-9-bit operation by enabling constant parity (mark or space), and then the "ninth bit" is the parity bit - you can tell what it was by detecting whether or not parity errors occurred for a particular byte.
Hope this helps,
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
MSDN shows you can configure the DCB "Device Context Block" for anything from 5 to 8 bits. This must be a limitation MS put have in the IOCTL level for device drivers. When reading chars in fast, detecting a parity error for a byte is not possible.
My question (I know I am supposed to be answering) is who/what is sending 9 bits, and with what kind of UART?
Conrad - conradb@adroit.co.za
Always do badly to start off, that way when you get the hang of it suddenly, everyone is surprised.
|
|
|
|