|
Are you using VC6? HtmlHelp isn't available for VC6 from CWinApp.
Tim Smith
I know what you're thinking punk, you're thinking did he spell check this document? Well, to tell you the truth I kinda forgot myself in all this excitement. But being this here's CodeProject, the most powerful forums in the world and would blow your head clean off, you've got to ask yourself one question, Do I feel lucky? Well do ya punk?
|
|
|
|
|
Ah, yes, I am using VC6. I succeed using WinHelp to display the *.hlp file, but I think the style is not so nice as the *.chm one. Is there any way I can do it? Or I have to switch to VC7?
|
|
|
|
|
You don't have to switch to vc7 - just override WinHelp method in your mainframe class. Here's the piece from old program (written using vc6) using HtmlHelp:
void CMainFrame::WinHelp(DWORD dwData, UINT nCmd)
{
CWinApp* pApp = AfxGetApp();
ASSERT_VALID(pApp);
ASSERT(pApp->m_pszHelpFilePath != NULL);
CWaitCursor wait;
if (IsFrameWnd())
{
CFrameWnd* pFrameWnd = (CFrameWnd*)this;
pFrameWnd->ExitHelpMode();
}
SendMessage(WM_CANCELMODE);
SendMessageToDescendants(WM_CANCELMODE, 0, 0, TRUE, TRUE);
CWnd* pWnd = GetTopLevelParent();
pWnd->SendMessage(WM_CANCELMODE);
pWnd->SendMessageToDescendants(WM_CANCELMODE, 0, 0, TRUE, TRUE);
HWND hWndCapture = ::GetCapture();
if (hWndCapture != NULL)
::SendMessage(hWndCapture, WM_CANCELMODE, 0, 0);
TRACE0("*** HtmlHelp(");
DWORD dwHtmlData = 0;
UINT nHtmlCmd;
switch (nCmd)
{
case HELP_CONTEXT:
TRACE0("Context");
nHtmlCmd = HH_HELP_CONTEXT;
dwHtmlData = dwData;
break;
case HELP_CONTENTS:
TRACE0("TOC");
nHtmlCmd = HH_DISPLAY_TOC;
break;
default:
TRACE0("other");
nHtmlCmd = HH_DISPLAY_TOC;
}
CString strHelpFile = ...;
TRACE("): %s %x %d (wh:%d)\n", strHelpFile, dwHtmlData, nHtmlCmd, nCmd);
if (NULL == ::HtmlHelp(m_hWnd, strHelpFile, nHtmlCmd, dwHtmlData))
{
AfxMessageBox(AFX_IDP_FAILED_TO_LAUNCH_HELP);
}
}
Tomasz Sowinski -- http://www.shooltz.com
- It's for protection - Protection from what? Zee Germans?
|
|
|
|
|
Thank you for the code, but when I tried to compile, VC6 complains that
HH_HELP_CONTEXT: undeclared identifier
HH_DISPLAY_TOC : undeclared identifier
HtmlHelp : is not a member of '`global namespace''
HtmlHelp : undeclared identifier
should I include any *.h or some library to my project? Thank you a lot in advance!
|
|
|
|
|
You should include htmlhelp.h (best place would be stdafx.h) and link with htmlhelp.lib.
Tomasz Sowinski -- http://www.shooltz.com
- It's for protection - Protection from what? Zee Germans?
|
|
|
|
|
Got it. I have my *chm displayed when F1 is pressed.
One more question. (bear with me please) I have to give the full path of the chm file, even though it is in the same directory of the *exe. is there any way I can bypass this?
|
|
|
|
|
Here is the code I use. It is a subroutine.
static void GetHtmlHelpFileName (HINSTANCE hInstance,
LPTSTR pszHelpFile, int nMaxChar)
{
TCHAR szBuff [_MAX_PATH];
::GetModuleFileName (hInstance, szBuff, _MAX_PATH);
LPTSTR pszExt = _tcsrchr (szBuff, '.');
_ASSERTE (pszExt != NULL);
_ASSERTE (*pszExt == '.');
*pszExt = 0;
_tcscat (pszExt, _T (".chm"));
_tcsncpy (pszHelpFile, szBuff, nMaxChar);
pszHelpFile [nMaxChar - 1] = 0;
return;
}
Given the HINSTANCE (NULL for main image), it will fill the string with a help file name by replacing the extension with ".chm".
Tim Smith
I know what you're thinking punk, you're thinking did he spell check this document? Well, to tell you the truth I kinda forgot myself in all this excitement. But being this here's CodeProject, the most powerful forums in the world and would blow your head clean off, you've got to ask yourself one question, Do I feel lucky? Well do ya punk?
|
|
|
|
|
... and here's mine. Of course, this one uses MFC:
CString CMyApp::GetHtmlHelpFileName()
{
CString strHelpFile = m_pszHelpFilePath;
strHelpFile.Replace(".HLP", ".CHM");
return strHelpFile;
}
Tomasz Sowinski -- http://www.shooltz.com
- It's for protection - Protection from what? Zee Germans?
|
|
|
|
|
it works like charm. Thank you so much!
|
|
|
|
|
It could be that complicated. I've been always using:
<br />
WinExec("HH.exe whatever.chm", SW_SHOW);<br />
And that's it...
|
|
|
|
|
It worked well when I execute "HH myhelp.chm" in winDOS environment. But I have to give the full path of the chm file when I coded in program. I cannot use a string variable in the double quotes. If I only put myhelp.chm there, it will tell me that that file cannot be opened, while the return error code is not ERROR_FILE_NOT_FOUND.
Anyway, it turns out that this line of code will do in CMainFrame::OnHelpTopics :
::HtmlHelp(this->m_hWnd, szBuff, 0, HH_DISPLAY_TOPIC);
where szBuff has the file name and its full path name.
|
|
|
|
|
Made a little tray utility, which when double clicked displays
the dialog window. It concludes of three tabs -
history, configure and about.
Well, when the dialog window opens, the history is just plain gray.
when I tab onto the configure and back to the history I can see
its contents.
Tried to change the order of the tabs to:
about, history, configure
same problem apeared - about page is totaly gray. only when I switch
back to it from one of the other tabs, the contents are displayed to me.
some one know what might be the problem ?
do I need some call to a function when showing a dialog brought up
from its tray form ?
I appriciate your help,
thanks in advance.
Kieth
life with out an f is a lie
|
|
|
|
|
How about checking for the restore condition in the size handler and then setting active tab to the one you want? Or maybe just forcing a repaint on restore.
|
|
|
|
|
I've installed the WinXP debug symbols, they work fine with VS.NET but VS 6.0
cannot load the debug symbol. Do you know if there is any incompatibility
or what do I need to do to let VS 6.0 to load the symbols ?
|
|
|
|
|
How do i round a number to the nearest integer?
|
|
|
|
|
int i;
double d;
i = (int)d; // cut decimals
i = (int)(d+.5); // round upwards
/Magnus
|
|
|
|
|
float fVal ;
..
..
//Assuming we need to round fVal
int nNum = (int) fVal ;
int nRoundedVal = ((fVal-nNum)> 0.5f) ?nNum+1:nNum ;
|
|
|
|
|
The key to remember is that cast a real number (double or float) to an integer results in truncation. Therefore, to round to the nearest integer here is what you do :
int integervalue = (int)( doublevalue + 0.5 );
Write some test code a try it.
|
|
|
|
|
Hello,
I use the right mouse button to start to rotate dynamically an object
until the user clicks again on the right button when he is satisfied of the
rotation. And it hase worked fine since years.
Anyway, I would like to add a contextual popup CMenu on the right mouse
button .
But I want to keep my good old rotation at the mouse. So I want to :
- display the popup menu and keep it displayed.
- if the user moves the mouse I go on rotating the object ("under" the menu)
until ...
- he clicks the right button : then I want to ignore the menu
- OR he clicks the left button because he has chosen something from the
menu, the I ignore the rotation.
My problem, is that I do not know how to do that : when I add the the CMenu
in classic MFC programming, I have no more control on the position of the
mouse....
Has a guru an idea? To get some message when the mouse moves?
Thank you all
Pierre Couderc
Pierre Couderc
|
|
|
|
|
Hi,
I sometimes have problems when retreiving the CommMask with the GetCommMask function.
Most of the times the funtion returns with success, but sometimes, for example when I've run an application (Hyperterminal for example) on the serial port and then run my application, the GetCommMask returns in failure. When retreiving a GetLastError I get "WARNING: WaitCommEvent() Failed with the following error: The I/O operation has been aborted because of either a thread exit or an application request".
Pleeeeease help me.
Dejan
|
|
|
|
|
If you just open the communication port. "Personally" I don't think you
need to worry about GetCommMask() returned value since you need to set
to receive events: SetCommMask, right?
If you need to verify current Comm Mask event, you need to care only after
your own SetCommMask call!
Hope this help you,
Good luck
"One good thing about getting older, you don't lose the ages you've been!"
|
|
|
|
|
Thanx Ernest,
but the SetCommMask() return value is TRUE (function succeded).
The GetCommMask() funtion returns false, I can't ignore this because I don't get the the bit set that signals a BREAK signal which it should, and which I get when it functions "the normal way" i.e. when the GetCommMask() funtion returns true.
/Dejan
|
|
|
|
|
Hi
I need some infotmation on how to communicate with USB devices. However, I have not the smallest clue how to begin. What API function do this job?
Any information or sample code (pure c or vc++) would be very nice
regards
Gregor
modified 12-Sep-18 21:01pm.
|
|
|
|
|
I guess those devices have drivers. Maybe you can use them directly to communicate with the devices.
[VISUAL STUDIO 6.0] [MFC] [WIN98/2]
Bluute tette!
|
|
|
|
|
That entirely depends on the USB peripheral you're trying to communicate with. For instance, if it's a memory stick or a camera you would use various standard Win32 API calls.
I've just finished designing a custom USB peripheral that uses an off-the-shelf USB interface chip. In this case, the chip's manufacturer (FTDI) provides a DLL and import library with various functions one can call. Almost too easy!
|
|
|
|