|
Hi!
I'm developing an application using MFC.In the application I've some static controls and some created at runtime.
When the application starts,I want to set the focus to the editbox(created at runtime).
I've used SetFocus and SetTabIndex for this but everytime the focus is being set to the first control created statically.
Kindly help me with this.
Thanks
|
|
|
|
|
This is not an MFC problem. If you set the focus to anything other than the default, then your dialaog init function must return FALSE: otherwise the system will set it to the default keyboard focus.
INTP
"The more help VB provides VB programmers, the more miserable your life as a C++ programmer becomes."
Andrew W. Troelsen
|
|
|
|
|
Hi!
I've implemented context sensitive help on right click of the mouse button.
But after few clicks the application gives Assertion in wincore.cpp.
Kindly help me with this.
Thanks.
|
|
|
|
|
|
thanks for the email, but you'll get better responses if you post the code so that everyone can see it. I am trying to help, but I'm no DavidCrow or toxcct.
Here's what topagarwal sent me:
Message box:<br />
Unhandled exception at 0x7c34055c (MFC71UD.DLL) in CAMU485.exe: User breakpoint.
Code :
m_pMainWnd = &dlg;
INT_PTR nResponse = dlg.DoModal();
which line is it blowing up at? I don't think you should be making nResponse an INT_PTR variable. try using int and see what happens. If that works and you still need a pointer, how about making an INT_PTR variable that points to the address of nResponse? I'm not sure what you're trying to do here, so we'll probably need more information
My articles
www.stillwaterexpress.com
BlackDice
|
|
|
|
|
I have a property page with radio buttons group derived from CFormView and cannot figure out how to set default radio button - either in the "dialog" or at run time.
My variables are CButton and SetCheck(1) asserts in OnCreate.
Thanks for your help
Vaclav
|
|
|
|
|
I think you should do all this in OnInitDialog() in place of OnCreate.
Jitendra.
|
|
|
|
|
Sorry,
my code does not have OnInitDialog as much as it should.
I'll look into that.
Thanks
Vaclav
|
|
|
|
|
1.)
CButton* pRadio = (CButton*)GetDlgItem(ID_OF_RADIO_BUTTON);
radioState = pRadio->SetCheck(1);
2.)
CButton m_RadioButton; //Declare in .h file
int m_bRadio;
//In Constructor
m_bRadio = 1;
//Write in DoDataExchange function
DDX_Control(pDX, ID_OF_RADIO_BUTTON, m_RadioButton);
DDX_Radio(pDX, ID_OF_RADIO_BUTTON, m_bRadio);
http://www.priyank.in/
|
|
|
|
|
Vaclav wrote:
...in OnCreate.
Why not OnInitialUpdate() ?
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Thanks for all the suggestions. Here is an update on my problem:
1. OnInitUpdate does not get executed. Don't know why.
2. If I do this,
CButton* pRadio = (CButton*)GetDlgItem(ID_OF_RADIO_BUTTON);
radioState = pRadio->SetCheck(1);
and put in in OnCreate I 'll get assertion failure because the m_hWnd is still null at that point of program execution.
I think that is the root of my problem - no m_hWnd.
The above code seems to duplicate variable CButton already defined in the accompanining dialog resource anyway.
Do I understand it correctly that you have used two variables associted with CButton - the control itself and than the state?
PS
The following code as is cannot work because SetCheck "returns" void.
radioState = pRadio->SetCheck(1);
Vaclav
|
|
|
|
|
Problem solved!
I did not read the fine print - poor excuse!
I can set the default radio button ( SetCheck(1)) in any page AFTER the PropertyView OnCreate is finished with AddPage !
Thanks for all you suggestions, it helped.
Vaclav
|
|
|
|
|
Hello everybody,
I am a newbie in Windows Programming (I began yesterday), and I have to find two methods for a project but I don't find functions I need and it's very urgent (I have 2 weeks).
1 - Detect when a directory or file started being shared
2 - Share a directory
I work with Visual c++ 6.0...
I have find the function : ReadDirectoryChangesW... for the first question but I am not sure it works for sharing...
|
|
|
|
|
NetShareEnum for share a directory, NetShareCheck and NetShareAdd
|
|
|
|
|
Thank you for your response, it helps me a lot!
But, NetShareCheck tells only if a specific directory is shared, I need rather a function which notified me that a directory starting being shared.
I think particulary about an association of ReadDirectoryChangesW and NetShareCheck...
I am going on my search.
Thank you again, and if you have another idea, I am open on every suggestion which could help me to progress!
|
|
|
|
|
Man, I'm glad I'm not you!
It is possible to determine if a directory is shared on the network. But what they appear to be asking for is a monitoring program. What I mean by that, is a program that is constanly checking if a directory has started being shared (not a program that knows the information when it firsts starts).
Now there is the possibility that the server may log this information (I dought it), if it does then the access to the information is probabaly undocumented (Welcome to Windows programming). Before you ask how to retrieve the information, you need to know if the information is there to be retrieved (ask the administrator or a network guy). If the server does not log the information, then they are asking for a monitoring program (if they know it or not).
Monitoring probably means calling NetShareEnum and noting the time when your program first started checking and noting when any change has occured, there-after.
Good Luck!
INTP
"The more help VB provides VB programmers, the more miserable your life as a C++ programmer becomes."
Andrew W. Troelsen
|
|
|
|
|
Hello thank you for your response,
I understand what you mean, but I am going to reformulate my question because my problem is less tricky than you thought (hummm...I hope).
So, my problem is to detect on my computer and only on my computer when a directory start to be share.
Between us...I would prefer to have more time and more documentation, source, etc.
Thank you, for your response, If this precision help you to understand my problem, I'll be glad to have your help
|
|
|
|
|
Does FindFirstChangeNotification() help?
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Yes it does,
I think it's possible to use on of these functions :
ReadDirectoryChangesW,
FindFirstChangeNotification(),
NetShareCheck,
NetShareAdd.
Now, I am going to test and see...
None of these functions answer precisely to my request, but I think it's possible to do sthg...
let's go coding...
If you have something else...I am listening all day long, thank you!
|
|
|
|
|
Hi,
I want to get the source of a web page.
Currently im using Cwebbrowser2 but i fail to retrieve the information.
i tried to use GetDocument().
<br />
m_Browse.GetDocument()<br />
What goes wrong?
Pls advice.
If possible , pls give an example code.
thanx
|
|
|
|
|
www.funducode.com/projideas/Project3/Project3.htm
http://msdn.microsoft.com/workshop/browser/webbrowser/tutorials/wbtutorial.asp
Hope it helps.
http://www.priyank.in/
|
|
|
|
|
Hi Guys... I am stuck in a problem.
To suppress the error "The host name in the certificate is invalid or does not match.", I have added a flag "INTERNET_FLAG_IGNORE_CERT_DATE_INVALID" in my code. But still getting message.
---------------------------------------------------
CString csPostString = strQry;
CString csObject;
INTERNET_PORT nPort;
DWORD dwServiceType;
DWORD dwHttpRequestFlags;
csUrl = strSiteUrl.c_str();
AfxParseURL(csUrl, dwServiceType, csServerName, csObject, nPort);
if ( dwServiceType == AFX_INET_SERVICE_HTTP )
dwHttpRequestFlags = INTERNET_FLAG_EXISTING_CONNECT | INTERNET_FLAG_NO_AUTO_REDIRECT;
else if ( dwServiceType == AFX_INET_SERVICE_HTTPS )
{
dwHttpRequestFlags = INTERNET_FLAG_EXISTING_CONNECT |
INTERNET_FLAG_NO_AUTO_REDIRECT |
INTERNET_FLAG_RELOAD |
INTERNET_FLAG_NO_CACHE_WRITE |
INTERNET_FLAG_SECURE |
INTERNET_FLAG_IGNORE_CERT_DATE_INVALID |
INTERNET_FLAG_IGNORE_CERT_CN_INVALID;
}
else {
SendError(-1, "Bad URL to connect to server" );
return false;
}
TRY
{
pConnect = session.GetHttpConnection( csServerName, nPort );
pFile = pConnect->OpenRequest(CHttpConnection::HTTP_VERB_POST,
csObject, NULL, 1, NULL, NULL, dwHttpRequestFlags);
// step 3.
pFile->QueryOption( INTERNET_OPTION_SECURITY_FLAGS, dwHttpRequestFlags );
dwHttpRequestFlags |= SECURITY_FLAG_IGNORE_UNKNOWN_CA;
// Set the new security flags
pFile->SetOption( INTERNET_OPTION_SECURITY_FLAGS, dwHttpRequestFlags );
pFile->AddRequestHeaders(szHeaders);
pFile->SendRequest(NULL, 0, (LPVOID)(LPCTSTR)csPostString, csPostString.GetLength());
}
CATCH(CInternetException, eInet)
{
if (eInet->m_dwError = 1238)
{
AfxMessageBox("Error");
}
eInet->GetErrorMessage(szErrorCause, sizeof(szErrorCause));
SendError(eInet->m_dwError, szErrorCause);
goto cleanup;
}
AND_CATCH(CException, eGeneric)
{
eGeneric->GetErrorMessage(szErrorCause, sizeof(szErrorCause));
SendError(-1, szErrorCause);
goto cleanup;
}
END_CATCH
|
|
|
|
|
Hello,
I would like to know if we can use winsock functions in a Dll?
If yes please give an example for the same.
Mythri
|
|
|
|
|
Why wouldn't you be able to?
8bc7c0ec02c0e404c0cc0680f7018827ebee
|
|
|
|
|
i am enumerating the services present in my computer using
::EnumServicesStatus(scman,SERVICE_WIN32,SERVICE_STATE_ALL,
lpservice,bytes,&bytesNeeded,
&servicesReturned,&resumeHandle);
// scamn is handle returned by OpenSCManager()
but i am getting an error
_AFX_INLINE CStringData* CString::GetData() const
{ ASSERT(m_pchData != NULL); return ((CStringData*)m_pchData)-1; }
in the debugger .pls sort out my problem
|
|
|
|