|
The parent of message box created by CWnd::MessageBox() is the instance of window, that called the MessageBox method.
The parent of message box created by AfxMessageBox() is the main application window.
Robert-Antonio
"Life is very hard, when you apply E-R model to it."
|
|
|
|
|
HOw do i make sure that the client has received the data that i wrote on the socket before i send some other data...
i know it can be done my ack way. but the other side of the socket program does not send ack.
any way around this prob???
"When death smiles at you, only thing you can do is smile back at it" - Russel Crowe (Gladiator)
|
|
|
|
|
I think that there wouldn't be anyway, but to let the client acknowledge it. In case you couldn't change the client code to send back acknowledgement, the only way I count think of is read the current buffer status. This way you can at least know that it has already been retrieved. But again it might be lost. I haven't tried doing this but I saw a function called select() which identifies the status of a socket. The best way is still to let the client acknowledge it. Hope this help. :>
SDE
|
|
|
|
|
Thanx for your reply,
Your answer makes perfect sense that the client should reply with some ack. but that increases the round trip time. Since i am above TCP level and the ack is implemented within TCP itself then i guess we should not go for the ack method. TCP garentees that the packet has reached its destination by ack -ve ack concept.
I dont know how much sense i am making. but still i will try to understand the solution you talked about.i.e the buffer status.
"When death smiles at you, only thing you can do is smile back at it" - Russel Crowe (Gladiator)
|
|
|
|
|
Hi,
Environment: VC++ 7, IE 6.0, XML
Problem: How to get good formtted text in browser control.
Description: I am writing SDI Application which reads data from xml data and displays in browser control. Here I am splitting the window into two frames. First frame contains Questions and related fields, second frame contains browser control (it contains data with some blanks). When the user enters data in question related fields then it should populate in browser control. The populated data in browser control is causing to format problem when data exceeds the line (it is coming in next line from starting onwards). How can we solve this problem.
|
|
|
|
|
I have written a simple program that imports a DLL at compile time, and then displays a message box (MessageBox()) containing data from the imported DLL. The problem is that the data gets imported, but the message box doesn't get displayed, returning code 1407 'Cannot find window class'. But when I don't import the DLL, the message box displays fine.
Anyone have any ideas?
|
|
|
|
|
What kinda dll is it ?
"When death smiles at you, only thing you can do is smile back at it" - Russel Crowe (Gladiator)
|
|
|
|
|
Its an implicitly loaded DLL. The DLL code is as follows (NB its not my code, I got it out of a book):
#include <windows.h>
#define MYLIBAPI extern "C" __declspec(dllexport)
#include "MyLibFile.h"
int g_nResult;
int Add(int nLeft, int nRight)
{
g_nResult = nLeft + nRight;
return(g_nResult);
}
The header file is:
#ifndef MYLIBAPI
#define MYLIBAPI extern "C" __declspec(dllimport)
#endif
MYLIBAPI int g_nResult;
MYLIBAPI int Add(int nLeft, int nRight);
And the main code that includes the MessageBox() is as follows:
#include <windows.h>
#include "..\MyLibFile\MyLibFile.h"
int WINAPI WinMain(HINSTANCE hinstExe, HINSTANCE, LPTSTR pszCmdLine, int)
{
int nLeft = 10, nRight = 25;
TCHAR sz[100];
wsprintf(sz, TEXT("%d + %d = %d"), nLeft, nRight, Add(nLeft, nRight));
MessageBox(GetActiveWindow(), sz, TEXT("Calculation"), MB_OK);
DWORD Error = GetLastError();
wsprintf(sz, TEXT("The result from the last Add is: %d"), g_nResult);
MessageBox(NULL, sz, TEXT("Last Result"), MB_OK);
return(0);
}
|
|
|
|
|
Oops, '/*Module: MyLib.h*/' should read '/*Module: MyLibFile.h*/'
|
|
|
|
|
Hi,
Did you get ?
With Regards,
R.Selvam
|
|
|
|
|
No, when I run it I get nothing, just a 1407 error message, and then the program terminates.
|
|
|
|
|
JGStanier wrote:
MessageBox(GetActiveWindow(), sz, TEXT("Calculation"), MB_OK);
Which window??? should it not be NULL like the second messagebox?
"When death smiles at you, only thing you can do is smile back at it" - Russel Crowe (Gladiator)
|
|
|
|
|
Yes, sorry, I was trying something and forgot to replace it with NULL. Still get an error message saying it can't find the window class though. I guess it isn't linking the windows.h file.
|
|
|
|
|
I am currently trying to get the return value and output parameters of a stored procedure using ADOs _CommandPtr. As I have researched it should be as simple as the code below:
/////////////////////////////////////////////////////////////////////
_CommandPtr m_pCommand;
_RecordsetPtr rsRecord;
_ParameterPtr pParam;
_variant_t vNull, vValue, vNew;
vNull.vt = VT_ERROR;
vNull.scode = DISP_E_PARAMNOTFOUND;
m_pCommand->ActiveConnection = m_pConnection;
m_pCommand->CommandType = adCmdStoredProc;
m_pCommand->CommandText = _bstr_t("au_info_all");
pParam = m_pCommand->CreateParameter(_bstr_t("@ReturnCode"), adInteger,
adParamReturnValue, sizeof(int), vNew);
m_pCommand->Parameters->Append(pParam);
m_pCommand->Parameters->Append(
m_pCommand->CreateParameter
(
_bstr_t("@au_lname"),
adVarChar,
adParamInput,
40,
_variant_t("Green")
)
);
rsRecord = m_pCommand->Execute(&vNull, &vNull, adCmdStoredProc );
intTest = pParam->GetValue().lVal;
strTest.Format(_T("%d"), intTest);
::MessageBox(NULL, _bstr_t(strTest), _T(""), MB_OK);
///////////////////////////////////////////////////////////////
But the value that I got is always 0. This is not the same case when I use Query Analyzer. Is there anything else that needs to be done?
Thank you.
SDE
|
|
|
|
|
Having compared your code with the one that I use, it looks perfectly fine,
except that I instantiated an instance of my command pointer before use:
<code>
TESTHR( pCmd.CreateInstance(__uuidof(Command)) );
pCmd->CommandText = _T("sproc_thingy");
pCmd->CommandType = adCmdStoredProc;
..
..
</code>
This my be your problem.
I Dream of Absolute Zero
|
|
|
|
|
Thanks.
I have seen a solution to it.
In order for output parameters to be retrieved properly, the ActiveConnection's Cursor type should be set to adUseClient
before calling the execute method.
Thank you for the reply. :>
SDE
|
|
|
|
|
hi,
I place an Edit control on a dialog.
Because it is the first control in the tab order, it gets the focus.
This means that all the text in the edit is selected.
What I want is that the caret is on the last position and no text is selected at all.
CEdit has a member ::SetSel to do this, but when should I call it?
When I call it in the OnInitDialog(), all the text is still selected.
|
|
|
|
|
Hi,
try ON_EN_CHANGE or ON_EN_KILLFOCUS
With Regards,
R.Selvam
|
|
|
|
|
Right before the OnInitDialog() method returns, post a user-defined message. The handler for that message should call SetSel(0, 0) .
A rich person is not the one who has the most, but the one that needs the least.
|
|
|
|
|
I need to route jobs to multiple trays in a printer. One such way that i got to know is to set the default source in the DEVMODE. But even there in the description of the default source, it is given 'Reserved; must be zero.'.
Is there any other way of routing jobs to a particular tray in the printer. This is without displaying the print dialog box. Development environment is VC++ 6.0.
Please help
Regds
Vikram Attiganal
|
|
|
|
|
What is the difference between Tab Control and Property Sheet?Is there any advantages and dis between these two?
|
|
|
|
|
Humm, dont know the difficulties in Tab Control but i find propertysheet&page very easy to implement and manage.
"When death smiles at you, only thing you can do is smile back at it" - Russel Crowe (Gladiator)
|
|
|
|
|
I have a MFC based dialog application which uses ShellExecute() to launch executables. After calling ShellExecute with for example:
ShellExecute( hwnd,"open",
"C:\\program files\\winamp\\winamp.exe" ,
"c:\\song.mp3",
"c:\\program files\\winamp\\",
SW_SHOWMINNOACTIVE );
I have tried SW_SHOWMINNOACTIVE and SW_MINIMIZE and after the call to launch the executable my dialog application loses focus. I have tried using SetFocus() after the call and nothing I try sets the focus back to the dialog which called the executable.
How do you get the calling application to retain focus after a call to ShellExecute?
Thanks,
Steve
|
|
|
|
|
change
ShellExecute( hwnd,"open",
"C:\\program files\\winamp\\winamp.exe" ,
"c:\\song.mp3",
"c:\\program files\\winamp\\",
SW_SHOWMINNOACTIVE );
to
ShellExecute( GetDesktopWindow(),"open",
"C:\\program files\\winamp\\winamp.exe" ,
"c:\\song.mp3",
"c:\\program files\\winamp\\",
SW_SHOWMINNOACTIVE );
"When death smiles at you, only thing you can do is smile back at it" - Russel Crowe (Gladiator)
|
|
|
|
|
I tried your suggestion and it yields the exact same result.
I was about to edit my post but you responded so promptly. Thanks.
My dialog application is using the whole desktop. When I call ShellExecute the task bar comes to the top over the bottom of my application and stays that way until I click on it.
Any other ideas?
|
|
|
|