|
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?
|
|
|
|
|
well did ya try putting the hwnd to null.
humm well besides this i am out of idea, may be the winamp is tring to put itself up. May be some settings in the winamp itself.
does the same problem accours with other applications??
Well i am sorry, i am out of ideas.
"When death smiles at you, only thing you can do is smile back at it" - Russel Crowe (Gladiator)
|
|
|
|
|
Yes, I tried the putting hwnd to NULL and yes it does it for all executables.
Must be a strange behavior of a dialog based application.
Thanks for your suggestions.
Steve
|
|
|
|
|
Have you tried using CreateProcess() instead of ShellExecute() ?
A rich person is not the one who has the most, but the one that needs the least.
|
|
|
|
|
No I have not but I will try anything at this point.
|
|
|
|
|
I have written a program which will accept only 20 connections to the server port. If connection goes beyond 20 then below mentioned code will be executed which is in while loop
memset(cSendBuf,' ',23);
memset(&sd, '\0', 23);
printf("\nRejecting Excess Client %s ...\n",inet_ntoa(sockAddr.sin_addr));
strcpy(sd.cstrmsg,"Rejecting Excess Client");
strcpy(cSendBuf,"");
printf("sd.cstrmsg is ;%s\n",sd.cstrmsg);
memcpy(cSendBuf,sd.cstrmsg,23);
int x=send(sock_id,cSendBuf,23,MSG_NOSIGNAL);
printf("x is %d\n",x);
close(sock_id);
continue;
Problem is socket closes before data is sent to client, so client fails to receive data (even though close is after send). Is there is any way to wait till client receives data and then close the socket or other solution like that. If i put sleep(2); before close then it works fine. Using sleep is not a right way to wait.
Waiting for the reply.
|
|
|
|
|
You should create the socket in blocking mode.
|
|
|
|
|
below is code to create, bind, listen socket.
please tell me where i have to change the code (i am new to socketing).
sockAddr.sin_family=AF_INET;
sockAddr.sin_addr.s_addr=INADDR_ANY;
sockAddr.sin_port=htons(iPortNo);
addrLen=sizeof(struct sockaddr_in);
if((serverSocket=socket(AF_INET,SOCK_STREAM,0))== -1)
{
printf("Failed to create Socket\n");
return -1;
}
else
printf("Socket created successfully\n");
rc = setsockopt(serverSocket, SOL_SOCKET, SO_REUSEADDR,(char *)&optval, sizeof(optval));
if(bind(serverSocket,(struct sockaddr_in*)&sockAddr,sizeof(sockAddr))==-1)
{
printf("Failed to bind at port %d\n",iPortNo);
return -1;
}
else
printf("Binding at port %d done successfully\n",iPortNo);
if(listen(serverSocket,1000) == -1)
{
printf("Failed to listen at port %d\n",iPortNo);
return -1;
}
else
printf("Listening at port %d\n",iPortNo);
while(1)
{
pthread_mutex_init(&tCounter.mutex,NULL);
sock_id = accept(serverSocket,(struct sockaddr_in*)&sockAddr,&addrLen);
..........................
..........................
}
Waiting for the reply
|
|
|
|
|
Yes it is a blocking socket. I noticed two potential problem:
1) you use close instead of closesocket.
2) You should set the option SO_LINGER to non-zero, so closesocket will wait for the transmit queue to be empty.
Sorry for the delay in the answer, I am very busy lately.
Regards
Paolo
|
|
|
|
|
Hi,
How to insert property sheet into a form view.I am using Embedded VC++. Can u give me some sugg?
Thanks
JP
|
|
|
|
|
I dont know about eVC++, but i would do it this way. Put a static frame on the formview dialog, then in the initialization fot the formview i will create the propertysheet, add the pages to it, get the rectangle are of the static rectangle and move the propertysheet to that rect. Thats it,
also note that the parent of the propertysheet should be the formview window handle.
Hope i solved ur problem in some way.
"When death smiles at you, only thing you can do is smile back at it" - Russel Crowe (Gladiator)
|
|
|
|
|
|
|
Hi,
I have a dialog based application in which i have created a toolbar . now i want to display tooltips for each of the items in the toolbar.
I have tried the following :
CToolTipCtrl Tips;
Tips.Create(this);
Tips.AddTool(GetDlgItem(ID_TEST),"Click to start transferring e-mails");
Tips.Activate(TRUE);
In PretranslateMessage:
Tips.RelayEvent(pMsg);
i have also tried:
CWnd *pwnd=AfxGetApp()->m_pMainWnd->GetDlgItem(IDR_TOOLBAR);
Tips.Create(this);
Tips.AddTool(pwnd->GetDlgItem(ID_TEST),"Click to start transferring e-mails");
Tips.Activate(TRUE);
but to no success .... can you please help me...
Thanking you
Regards
Satadru Karjee.
|
|
|
|
|
|
Hi everybody,
Here is a brain teaser for all. I have a class hierarchy as below.
The code compiles with a warning (C4355). During run time i get a run time error
R6025 - Pure virtual function call.
#include <iostream.h>
class CBase
{
public:
CBase()
{
}
~CBase()
{
}
virtual void Display() = 0;
};
class CTemp
{
public:
CTemp()
{
}
CTemp(CBase &pBase)
{
// Call the Overrriden function here.
pBase.Display();
}
~CTemp()
{
}
};
class CDerived : public CBase
{
public:
CDerived()
: tempObj(*this)
{
}
~CDerived()
{
}
CTemp tempObj;
virtual void Display()
{
}
};
void main()
{
CDerived obj;
}
The error here is because the base class pointer is calling a Pure virtual function,
which does not have any implementation.
How should i make the code work, without making much code change ?
Or are there any compiler options, which will circumvent the problem ?
Iam using Visual Studio 6.0 as the IDE for compilation.
Any help will be greatly appreciated.
Thanks in advance,
Saleem.
|
|
|
|