|
One solution is GetModuleFileName(). Another solution is GetCurrentDirectory().
Kuphryn
|
|
|
|
|
Kuphryn,
This is exactly what I was looking for.
Thank you
|
|
|
|
|
|
Thanks for the help...much appreciated.
SAK
|
|
|
|
|
If you are just writing a simple console app, you can use argv[0].
--Dean
|
|
|
|
|
Dean,
Good information...Thanks
|
|
|
|
|
Except -- argv[0] does not return a fully-qualified path name if the .EXE is run from the same directory (from the current directory).
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br />
Peter Weyzen<br />
Staff Engineer<br />
Santa Cruz Networks
|
|
|
|
|
1. MFC dialog app is created
2. 2nd modeless dialog is created with extended style WS_EX_APPWINDOW, it's then shown and updated. The parent is set to null or desktop with SetParent(NULL) or SetParent(GetDesktopWindow())
3. Main dialog window is minimized, and as it is, the taskbar space for the non-modal disappears and the non-modal dialog is also minimized
4. NO, i repeat NO messages at all are sent to the non-modal dialog such as you would expect (ex. WM_SIZE message).
My Question is simple, what the heck is going on? How does one stop MFC from stealing the non-modal dialog's messages and reducing it automatically and removing it's taskbar space?
So far no one has been able to answer this
hey
|
|
|
|
|
i have a problem with maximizing an MDI-Child window. I tried to use the ShowWindow(SW_MAXIMIZE) method (in OnItitalUpdate()), but nothing happend....
|
|
|
|
|
In your child frame class, add the following override:
BOOL CChildFrame::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
if( !CMDIChildWnd::PreCreateWindow(cs) )
return FALSE;
cs.style = WS_CHILD | WS_VISIBLE | WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU
| FWS_ADDTOTITLE | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_THICKFRAME;
return TRUE;
}
|
|
|
|
|
Hey basementman, i tried your recommendation - no success - nothing happend
|
|
|
|
|
Perhaps i should mention that I use CFormView as BaseClass.
|
|
|
|
|
To Maximize a MDI-Child on Opening.
BOOL CChildFrame::PreCreateWindow(CREATESTRUCT& cs)<br />
{<br />
if( !CBCGPMDIChildWnd::PreCreateWindow(cs) )<br />
return FALSE;<br />
cs.style |= WS_MAXIMIZE|WS_VISIBLE;<br />
return TRUE;<br />
}
And then, don't forgert to remove ResizeParentToFit() in OnInitalUpdate() from your CFormView based Class!
Regards
Der Albert
|
|
|
|
|
Put ShowWindow(SW_SHOWMAXIMIZED); in CChildFrame::PreCreateWindow()
in CChildFrame::OnCreate(...)
Pfff . time to go home ...
|
|
|
|
|
Sorry, copied the wrong block.... THis is the one:
void CChildFrame::ActivateFrame(int nCmdShow)
{
// TODO: Modify this function to change how the frame is activated.
nCmdShow = SW_SHOWMAXIMIZED;
CMDIChildWnd::ActivateFrame(nCmdShow);
}
|
|
|
|
|
hi
Haw can I get status of socket in process, while closing, connecting and so on?
GetTcpTable return MIB_TCP_STATE_ESTAB always or more often than not
Thank you
|
|
|
|
|
Are you referring to an IP statistics? One solution is GetIpStatistics().
Kuphryn
|
|
|
|
|
yes. no useful information.
thank you
|
|
|
|
|
One solution is getsockopt(). For this api, you will have to call it for each socket status, i.e. connect, send, etc.
Kuphryn
|
|
|
|
|
How can I get a thread handle of a remote process below windows Me. I can get the Thread ID by enumerating process but I want it's assocaiated handle
Thanks
Ceri
|
|
|
|
|
I know nothing here -- but this seems like the kind of thing you shouldn't be able to do. Actual handles should be private to the application, unless they make em global?
[just speaking out of my butt -- sorry]
|
|
|
|
|
Some handles in windows are global to the OS, like mutexes, thread and process handles.
Ceri
|
|
|
|
|
Hi,
I try to get data from a password protected webpage and need a little help.
At first I want to describe the situation in the browser.
When I call the webpage, I got a page with a little login screen. This is realized by some javascript code. I fill in the username and password, click on 'login' and voila, there are my wanted data.
I looked at the javascript code an noticed the names of the fields. I tried to call the webpage directly with:
http://<address>?<NameOfUserField>=<username>&<NameOfPasswordField>=<password>&action=<actionname>
... and it works fine. Now I had to do the same in my MFC-Projekt but I failed. I was unsuccessful with the following two attempts
#################
## First Attempt
#################
********************************************************************************************************
...
CInternetsession InternetSession(_T("AppName"),1, INTERNET_OPEN_TYPE_PRECONFIG);
char Url = "<address>?<NameOfUserField>=<username>&<NameOfPasswordField>=<password>&action=<actionname>";
CString strServerName; // Server
CString strObject; // directory
INTERNET_PORT nPort; // port
DWORD dwServiceType; // accesstype
AfxParseURL(Url, dwServiceType, strServerName, strObject, nPort)
DWORD dwHttpRequestFlags = INTERNET_FLAG_RELOAD;
CHttpFile *pHttpFile = pHttpConnection->OpenRequest(CHttpConnection::HTTP_VERB_GET,// or HTTP_VERB_POST
strObject, NULL, 1, NULL, NULL,
dwHttpRequestFlags);
pHttpFile->SendRequest();
CString sz;
while (pHttpFile->ReadString(sz)){
...
}
********************************************************************************************************
#################
## Second Attempt
#################
...
CInternetsession InternetSession(_T("AppName"),1, INTERNET_OPEN_TYPE_PRECONFIG);
char Url = "<Only_Address_without_parameter>";
CString strServerName; // Server
CString strObject; // directory
INTERNET_PORT nPort; // port
DWORD dwServiceType; // accesstype
AfxParseURL(Url, dwServiceType, strServerName, strObject, nPort)
DWORD dwHttpRequestFlags = INTERNET_FLAG_RELOAD;
CHttpFile *pHttpFile = pHttpConnection->OpenRequest(CHttpConnection::HTTP_VERB_GET,// or HTTP_VERB_POST
strObject, NULL, 1, NULL, NULL,
dwHttpRequestFlags);
CString szHeader = _T("<NameOfUserField>=<username>&<NameOfPasswordField>=<password>&action=<actionname>");
pHttpFile->AddRequestHeaders(szHeader);
pHttpFile->SendRequest();
CString sz;
while (pHttpFile->ReadString(sz)){
...
}
********************************************************************************************************
Any Idea's?
ciao
Norbert
|
|
|
|
|
hi,
i am trying to save a CString to a file. I'm doing this like this:
<br />
CStdioFile cfFile(strPath, CFile::modeCreate | CFile::modeReadWrite | CFile::shareDenyNone);<br />
CArchive ar(&cfFile, CArchive::store);<br />
<br />
cfFile.WriteString(strContents);<br />
<br />
ar.Close();<br />
<br />
cfFile.Close();<br />
This works, but it always places weird characters after the end of the contents of the string.
I'm deleting the file first before saving it, and I know the contents of the CString are correct. Any ideas?
thanks
|
|
|
|
|
Berkut wrote:
This works, but it always places weird characters after the end of the contents of the string.
How do you know the "writing" code is faulty? What are you using to verify the weird characters?
|
|
|
|