|
I don't know who I'm quoting at the moment, but I need to let you know:
"Programming nowdays is a contest of making the best idiot proof program, against the universe making bigger idiots!"
(2 thums up to the one who thought of that sentence )
A student knows little about a lot.
A professor knows a lot about little.
I know everything about nothing.
|
|
|
|
|
I managed to put together a very cool looking
.chm file using the program FAR. How can I
execute the .chm from my program? I used the
code:
CreateProcess(NULL, "help.chm, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi);
But it didn't work, even though it works for all the
other .exe files that I have. Is there something
special I need to do to run a .chm file?
Please, please, any response any one can give me
will be greatly appreciated.
Sincerely,
Danielle (an overworked graduate student)
|
|
|
|
|
ShellExecute(NULL, _T("Open"), _T("help.chm"), NULL, NULL, 0);
|
|
|
|
|
you also had a non-matching parenthesis in your code.
|
|
|
|
|
It worked.
Thank you very much. ;)
|
|
|
|
|
ShellExecute will work, but you need to use the HtmlHelp Api.
This will also help you launch directly a specific topic inside the chm help file.
HtmlHelp(m_hWnd, AfxGetApp()->m_pszHelpFilePath, HH_HELP_CONTEXT,
<topid_id>);
Also, you need to do this to replace the '.hlp' extension to .chm. in your initinstance.
CString strHelpFile = _pszHelpFilePath;
strHelpFile.Replace(_T(".HLP"), _T(".chm"));
free((void*)m_pszHelpFilePath);
m_pszHelpFilePath = tcsdup(strHelpFile);
You can download htmlhelp lib and header files from microsoft's site, if you don't have it already.
Hari Krishnan
|
|
|
|
|
pranavamhari wrote:
HtmlHelp(m_hWnd, AfxGetApp()->m_pszHelpFilePath, HH_HELP_CONTEXT,
);
You have missed 4th parameter of HtmlHelp. Can you tell me what to give here when using HH_HELP_CONTEXT command. I am giving mapid but getting this message
"HH_HELP_CONTEXT called without a [MAP] Section."
Any remedy to this?
Hashim Saleem
|
|
|
|
|
Now instead of using HH_HELP_CONTEXT, I am doing this
<br />
::HtmlHelp(NULL, <br />
"C:\\MyHelpFile.chm::/Welcome.htm>MyWindow",<br />
HH_DISPLAY_TOC,<br />
NULL) ;<br />
I am achieving my purpose. But tell me is it the right way instead of
HH_HELP_CONTEXT.
Hashim Saleem
|
|
|
|
|
I've tried to put background image into CListCtrl, but i completely ran out of ideas how to do this!!!
I cannot use owner drawn control because I need big icons.
I cannot use CListCtrl::SetBkImage() because it cannot stretch bitmap;
Maybe this is done somehow by using custom draw, but I failed. Can somebody give me link to working sample with background image?
Give me any suggestions!
|
|
|
|
|
when you OnSize, dynamically resize the bitmap to the client area rect, then CListCtrl::SetBkImage(), there are good chapters on bitmap manipulation in Charles Petzold's programming windows 95 and Programming windows with MFC by j. procise
|
|
|
|
|
|
Im currently working on an addin for visual studio 6.0 and I need to retrieve the selected item in the classview, the item could be the name of a class, method or attribute.
Any suggestions? Im totally stucked
|
|
|
|
|
There's a special UI tool in O'reilly's "Win32 API Programming with Visual Basic" on the compliment CD, that lets you grab any child window's handle by clicking on it.
You could get that book, then use the tool on the CD to get that class tree control's window handle, and view it's messages. It no doubt sends notify messages to its parent.
|
|
|
|
|
I'm relatively new at SDI programs (and I haven't touched MDI yet), but I have worked with MFC dialogs a lot. It would be convenient to be able to create a dialog resource (probably one without a frame) and then be able to use that as my view. Is this possible to do? If so, how would I go about doing this?
If this is not possible to do, where would I create windows such as CButtons and CEditBoxes? I tried doing this in the OnPaint function, but I just get flicker. Thanks for any help you can give me!
Douglas A. Wright
dawrigh3@kent.edu
|
|
|
|
|
If you want want to use a dialog as your main view either use AppWizard to create a dialog based application or, if you really want an SDI app, in the final stage of AppWizard change the base class of your view class to CFormView.
OnPaint is called every time the window needs redrawn, so is not the place to create controls. You could overload the Create method for the view and create them there.
You probably should get hold of a book on MFC programming - I found an earlier edition of this one very useful when I was learning the basics (I still refer to it a lot).
Niall.
|
|
|
|
|
Why not create the controls through the recource editor and hard code them in your class or use the appwizard for creating controls!
I prefer hardcoding all controls.
A student knows little about a lot.
A professor knows a lot about little.
I know everything about nothing.
|
|
|
|
|
Hi,
I have many dialog boxes in my application, and I need to transfer the data to another dialog box, in other words how do I access the data stored in a variable in a dialog from another one.
Hope my question is quite clear,
Thanks
Deepak Samuel
|
|
|
|
|
One solution is messages. Send a message to the parent window and have it dispatch does the data transfer.
Kuphryn
|
|
|
|
|
when you want to access a public member variable of dialog A from dialog B just do that:
((CDialogA*)GetParent())->m_member_variable = ...
in case of CDialogA being the parent of dialog B
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Where we have to write this code "((CDialogA*)GetParent())->m_member_variable = ...";
please help me....
Thanks a heap...
|
|
|
|
|
I am trying to learn how to open and communicate through a communication port (COM) but I am new and don't know were to start. Can anyone reply with a helpful website seggestion or maybe even a book... THX
[It is possible to represent everything in this universe by using 0 and 1]
I'm going to live forever or die trying.
|
|
|
|
|
Here is one reference from MSDN on serial port.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnfiles/html/msdn_serial.asp
Kuphryn
|
|
|
|
|
Here are some links on codeproject:
Link 1: [^]
Link 2: [^]
Link 3: [^]
// Afterall, I realized that even my comment lines have bugs
When one cannot invent, one must at least improve (in bed).-My latest fortune cookie
|
|
|
|
|
Dear Friend
I used file operation method to get a grip with communication port and as it's my first time I've lots of problem and couldn't continue so...
I'd be appreciated if you could advise me
Regards
BOOL CMainFrame::InitSerialPort()
{
DCB dcb;
BOOL fSuccess;
char *pcCommPort = "COM1";
m_hComPort = CreateFile( pcCommPort,
GENERIC_READ | GENERIC_WRITE,
0, // comm devices must be opened w/exclusive-access
NULL, // no security attributes
OPEN_EXISTING, // comm devices must use OPEN_EXISTING
0, // not overlapped I/O
NULL // hTemplate must be NULL for comm devices
);
if(m_hComPort == INVALID_HANDLE_VALUE)
{
// Handle the error.
CString str;
str.Format("CreateFile failed with error %d.\n", GetLastError());
AfxMessageBox(str);
return FALSE;
}
fSuccess = GetCommState(m_hComPort, &dcb);
if (!fSuccess)
{
// Handle the error.
CString str1;
str1.Format("CreateFile failed with error %d.\n", GetLastError());
AfxMessageBox(str1);
return FALSE;
}
dcb.BaudRate = CBR_9600; // set the baud rate
dcb.ByteSize = 8; // data size, xmit, and rcv
dcb.Parity = NOPARITY; // no parity bit
dcb.StopBits = ONESTOPBIT; // one stop bit
fSuccess = SetCommState(m_hComPort, &dcb);
if(!fSuccess) //////////// this line hs been repeated ////////
{
// Handle the error.
CString str2;
str.Format("CreateFile failed with error %d.\n", GetLastError());
AfxMessageBox(str2);
return FALSE;
}
return TRUE;
}
|
|
|
|
|
Check out the previous post and the links there:
[^]
// Afterall, I realized that even my comment lines have bugs
When one cannot invent, one must at least improve (in bed).-My latest fortune cookie
|
|
|
|