|
Or you can just use:
BOOL WinHelp(
HWND hWndMain, // handle of window requesting Help
LPCTSTR lpszHelp, // address of directory-path string
UINT uCommand, // type of Help
DWORD dwData // additional data
);
This function did the trick for me a few months ago. Oh by the way, this is just the API function, but I think MFC has this function somewhere. Just search for it.
// Afterall I realized that even my comment lines have bugs
|
|
|
|
|
I've been going over microsofts site and I still carn't find a list of exactly whats different between standard edition and professional. Could anyone here shed some light on the subject for me please.
Thanks for your help
Darren
|
|
|
|
|
My Windows service app is monitoring process activity on Windows 2000 system. PSAPI is giving me a list of running processes, but I can't obtain full module path for processes running under user account different than System or service's account - process HANDLEs are treated as invalid when they come from another account. I suppose that some security setting is preventing me from doing this, but how can I override it? I've also tried using kernel mode driver for this, but with the same results...
|
|
|
|
|
I have a dialog with a webbrowser control (via the CWebBrowser2 class). Now I want to display a html page in the control by passing a string that contains the actual html page. Is this possible? And if so, how do I do this?
|
|
|
|
|
i was never able to get it to accept a string. i have always had to write the page text out to a temp file, then tell the browser to read that file.
-c
|
|
|
|
|
It's possible, but it's a little ugly. Here's some code I think I found in the MSDN. I was just poking around with it for a while, not using it in a production environment, so it's not too clean.
USES_CONVERSION;
IDispatch * a_poDisp = c_oWebBrowser.GetDocument();
if( a_poDisp )
{
IHTMLDocument2 * a_poDoc = NULL;
a_poDisp->QueryInterface( IID_IHTMLDocument2, (void**)&a_poDoc );
if( a_poDoc )
{
HRESULT hresult = S_OK;
VARIANT *param;
SAFEARRAY *sfArray;
CString sHtml = ???
BSTR bstr = SysAllocString(A2COLE(sHtml));
sfArray = SafeArrayCreateVector(VT_VARIANT, 0, 1);
hresult = SafeArrayAccessData(sfArray,(LPVOID*) & param);
param->vt = VT_BSTR;
param->bstrVal = bstr;
hresult = SafeArrayUnaccessData(sfArray);
hresult = a_poDoc->write(sfArray);
if( sfArray != NULL )
{
SafeArrayDestroy( sfArray );
}
a_poDoc->Release();
}
}
Chris Richardson
You can stash and you can seize
In dreams begin, responsibilities U2 - Acrobat[^]
Stop being PC and accounting for everyone and his momma's timeframe. Just enjoy your - Rohit Sinha in the content-challenged thread
|
|
|
|
|
|
I found a very easy way to do this. Just insert "about:" in front of the string and pass it as the url in the Nagivate method.
|
|
|
|
|
Is it possible to disable the frame, so the user cant resize it anymore?
I have a FormView project, and I dont want the user to be able to resize the frame. I'm not sure how this could be done.
|
|
|
|
|
Try this... it's based on a dialog resizing, but it must work in the same way in your environment...
void CDialogResDlg::OnSizing(UINT fwSide, LPRECT pRect)
{
if (!this->bAllowResizing)
{
if (pRect->bottom - pRect->top != 400) pRect->bottom = pRect->top + 400;
if (pRect->right - pRect->left != 400) pRect->right = pRect->left + 400;
}
CDialog::OnSizing(fwSide, pRect);
} hope this helps...
|
|
|
|
|
You can just take of the WS_THICKFRAME window style. For example, in MFC override your main frame's PreCreateWindow function and do something like this:
cs.style &= ~WS_THICKFRAME;
You can take off other styles there, too, if you want (like if you don't want them to maximize or minimize the window). Look up "window styles" for more info.
|
|
|
|
|
In my CDialog-derived class, I want to call a method after the dialog has been shown, with no input from the user. If I call my method from OnInitDialog, the dialog is not shown until my method returns.
I tried using PostMessage in OnInitDialog to start the method, but the message was not caught. SendMessage worked, but the dialog was not shown before the method call.
Is there a simple way to do this?
dlb
|
|
|
|
|
PostMessage() is the way to go. The fact that it did not work indicates the message map was not quite right.
#define PM_CHANGE_FLAT (WM_APP + 0x123)<br />
<br />
static const UINT UDM_BLOW_NOSE = ::RegisterWindowMessage(_T("UDM_BLOW_NOSE"));<br />
<br />
<br />
BEGIN_MESSAGE_MAP(CMyDlg, CDialog)<br />
ON_MESSAGE(PM_CHANGE_FLAT, ChangeFlat)<br />
ON_REGISTERED_MESSAGE(UDM_BLOW_NOSE, BlowNose)<br />
END_MESSAGE_MAP()<br />
<br />
<br />
BOOL CMyDlg::OnInitDialog() <br />
{<br />
<br />
PostMessage(UDM_BLOW_NOSE);<br />
PostMessage(PM_CHANGE_FLAT);<br />
<br />
return 0;<br />
}<br />
<br />
<br />
LRESULT CMyDlg::BlowNose( WPARAM, LPARAM )<br />
{<br />
return 0;<br />
}<br />
<br />
<br />
LRESULT CMyDlg::ChangeFlat( WPARAM, LPARAM )<br />
{<br />
return 0;<br />
}
|
|
|
|
|
Thanks for your quick reply
Where did CUpdateThread come from?
I would like to have my message responding method within the CDialog-derived class that is posting the message.
dlb
|
|
|
|
|
--dlb-- wrote:
Where did CUpdateThread come from?
My bad.
|
|
|
|
|
Hi, i need to know how to make my app check wether its connected to the internet. I need this cause my app needs to check for updates and i don't want the dial up dialog (for dial-up connections) appearing every 5 minutes. How can i stop it from popping up, so that it only checks for updates when it really is already connected to the internet?
Thanks
Kuniva
--------------------------------------------
|
|
|
|
|
calling the InternetGetConnectedState function should not popup a dialup box.
Jason Henderson My articles
"The best argument against democracy is a five-minute conversation with the average voter." - Winston Churchill
|
|
|
|
|
Have you tried any of these:
http://www.pcausa.com/resources/InetActive.txt
|
|
|
|
|
Hi,
Im writing a program in C++, using the windows.h header file to develop an application. Im capturing images from a camera and then saving them in a default folder.
I want to allow the user to be able to browse through their file directories and choose which folder they want the images to be saved to. But, I cant find a simple solution. I would have thought there would have been a defualt control that allowed you to do this. But all the ones I have seen require you to set imagelists and things for the bitmaps to use for the folders.
I would GREATLY appreciate any help with this problem. Ive looked around on msdn, and on this site too. What is the easiest way to do it? Apart from simply asking the user to paste the folder path into a text box.
Cheers for any help
|
|
|
|
|
rbeat100 wrote:
I want to allow the user to be able to browse through their file directories and choose which folder they want the images to be saved to.
Look up SHBrowseForFolder() in MSDN Library
Rickard Andersson8
Here is my card, contact me later!
UIN: 50302279
E-Mail: nikado@pc.nu
Interests: C++, ADO, SQL, Winsock, 0s and 1s
|
|
|
|
|
ShBrowseForFolder is what you are looking for, search around codeproject for samples, and/or how-to.
Max.
Maximilien Lincourt
For success one must aquire one's self
|
|
|
|
|
Thanks to you both for the quick responce
Ill give it a try.
|
|
|
|
|
try this code:
BOOL BrowseForDir(char *cpPathName, HWND hParent)
{
BOOL bRetval = FALSE;
BROWSEINFO sBI;
memset(&sBI,0,sizeof(BROWSEINFO));
sBI.hwndOwner = hParent;
sBI.pidlRoot = NULL;
sBI.pszDisplayName = cpPathName;
sBI.lpszTitle = "Select the folder To Save To:";
sBI.ulFlags = BIF_RETURNONLYFSDIRS;
sBI.lpfn = NULL;
LPITEMIDLIST pidl = SHBrowseForFolder(&sBI);
if (pidl)
{
SHGetPathFromIDList(pidl,cpPathName);
bRetval = TRUE;
}
return bRetval;
}
|
|
|
|
|
basementman wrote:
try this code:
Do you mean it doesn't work?
Can't try it but here is my code:
BROWSEINFOA bi;
memset(&bi, 0, sizeof(bi));
bi.hwndOwner = this->GetSafeHwnd();
bi.lpszTitle = "Select your dir";
LPITEMIDLIST itemList = SHBrowseForFolder(&bi);
if(!itemList)
return;
char* pathName = new char[1024];
if(!SHGetPathFromIDList(itemList, pathName))
{
::MessageBox(NULL, "AAARRGH!! Invalid path!!!", "Error", MB_OK | MB_ICONERROR);
return;
}
Rickard Andersson8
Here is my card, contact me later!
UIN: 50302279
E-Mail: nikado@pc.nu
Interests: C++, ADO, SQL, Winsock, 0s and 1s
|
|
|
|
|
Hi.
I have two classes derived from CObject. They are leaking memory somehow.
What's wrong?
Memory Leaks!
0 bytes in 0 Free Blocks.
273 bytes in 6 Normal Blocks.
0 bytes in 0 CRT Blocks.
0 bytes in 0 Ignore Blocks.
268 bytes in 3 Client Blocks.
Largest number used: 3260 bytes.
Total allocations: 4732 bytes.
EXPLORER.DLL Terminating!
DLG.DLL Terminating!
WEB.DLL Terminating!
The thread 0xEB4 has exited with code 0 (0x0).
<br />
<br />
class CModulExplorer : public CObject<br />
{<br />
DECLARE_SERIAL(CModulExplorer)<br />
public:<br />
CModulExplorer();<br />
virtual ~CModulExplorer();<br />
virtual void Serialize(CArchive& ar);<br />
<br />
HICON hSIcon;<br />
HICON hLIcon;<br />
BOOL bSystemFolder;<br />
CString sDefaultName;<br />
CString sNodeName;<br />
CString sPath;<br />
};<br />
<br />
class CModulWeb : public CObject<br />
{ <br />
DECLARE_SERIAL(CModulWeb)<br />
public: <br />
CModulWeb();<br />
virtual ~CModulWeb();<br />
virtual void Serialize(CArchive& ar);<br />
<br />
enum NavigationStyle {WNS_BLANK = 1014, WNS_LAST = 1015, WNS_DEFAULT = 1016};<br />
<br />
HICON hSIcon;<br />
HICON hLIcon;<br />
NavigationStyle ns;<br />
CString sDefaultName;<br />
CString sUrl;<br />
CString sNodeName;<br />
};<br />
<br />
class CMainFrame : public CMDIFrameWnd<br />
{<br />
DECLARE_DYNAMIC(CMainFrame)<br />
public:<br />
CMainFrame();<br />
<br />
public:<br />
CModulExplorer *m_pExplorerCls;<br />
CModulWeb *m_pWebCls;<br />
...<br />
}<br />
<br />
<br />
<br />
IMPLEMENT_SERIAL(CModulExplorer, CObject, 0)<br />
IMPLEMENT_SERIAL(CModulWeb, CObject, 0)<br />
<br />
<br />
CModulExplorer::CModulExplorer()<br />
{<br />
}<br />
<br />
CModulExplorer::~CModulExplorer()<br />
{<br />
}<br />
<br />
void CModulExplorer::Serialize(CArchive& ar)<br />
{<br />
}<br />
<br />
<br />
CModulWeb::CModulWeb()<br />
{<br />
}<br />
<br />
CModulWeb::~CModulWeb()<br />
{<br />
}<br />
<br />
void CModulWeb::Serialize(CArchive& ar)<br />
{<br />
}<br />
<br />
<br />
CMainFrame::CMainFrame()<br />
{<br />
CRuntimeClass* pClass = NULL;<br />
<br />
pClass = RUNTIME_CLASS(CModulExplorer);<br />
m_pExplorerCls = (CModulExplorer*)pClass->CreateObject();<br />
<br />
pClass = RUNTIME_CLASS(CModulWeb);<br />
m_pWebCls = (CModulWeb*)pClass->CreateObject(); <br />
}<br />
<br />
CMainFrame::~CMainFrame()<br />
{<br />
delete m_pExplorerCls;<br />
delete m_pWebCls;<br />
}<br />
|
|
|
|