|
Ravi Bhavnani wrote:
But it's not an alternative, as the word "or" implied!
True enough, but I understood your response to mean "hard-code the fully qualified path" (ie: "C:\mydir\myfile.chm"), instead of a concat-ed string from GetModuleFileName values.
either way, I think the question has been answered.
|
|
|
|
|
Actually "C:\mydir\myfile.chm" is not a valid filespec.
either way, I think the question has been answered
I couldn't agree more.
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Maybe topic 0 doesn't exist? Try using HH_DISPLAY_TOC (pass 0 or NULL as the last arg) to see if it displays the TOC.
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Okay. TOC does display my chm. Also the book had neglected to mention one vital step so I was getting only 1 pane. I persisted in comparing their finished project with the one I step-followed, and found the omission. I now have three panes. Onto more explorations...
Appreciate your help,
ns
|
|
|
|
|
Glad u found the errata!
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
I got a borderless dialog. So i can't resize it with mouse dragging the borders and the corners. I want to add this feature and this is the problem. Can any one help me ?? Also please tell me about the messages generated while the window size is changed by mouse from the corners and sides. I mean what are the lparam and wparam walues when the window is dragged from left, right, up, down, and corners.
|
|
|
|
|
When the window have a border, the non-client area receives the messages
...
CWnd::OnNcMouseMove // WM_NCMOUSEMOVE
CWnd::OnNcHitTest // WM_NCHITTEST
...
since your window doesn't have a border, you will have to simulate the non-client message, and use the WM_LBUTTONDOWN WM_MOUSEMOVE WM_LBUTTONUP (among others) to manage the resizing of your window, sending WM_SIZE, WM_SIZING, and other messages.
Max.
|
|
|
|
|
The WM_NCHITTEST message is sent before every mouse message, that is how windows knows whether it is dealing with a normal mouse message or a non-client mouse message. By simply overriding the default behavior for WM_NCHITTEST, and returning a NC message value, windows will generate the WM_NCMOUSExxx messages.
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
You will need to override the WM_NCHITTEST message. When you reach the area of the window that you would like to be condidered the border for resizing, simply return HT_LEFT, HT_TOP, HT_TOPLEFT etc depending on the circumstance. When you return one of these values, the DefWndProc mechanism will start the resizing process for you.
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
Cool , I really did'nt exactly know that!
Max.
|
|
|
|
|
I learned a lot about this stuff when I emulated the entire mouse processing logic over a remote connection. I found that every time a mouse message is called, there is a WM_NCHITTEST / WM_SETCURSOR pair that gets generated right before the WM_MOUSExxx message is processed.
The WM_NCHITTEST message is used to determine which type of message to send, non-client or normal, and the WM_SETCURSOR message is used to update the cursor as it moves over different regions of the windows display.
I have thought about writing an article about this whole process for CodeProject, but I am not sure how many people are still interested in learning the internals of Windows.
Another interesting message sequence is the chain of messages that is generated by the default message handler for WM_SYSCOMMAND.
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
Paul Watt (kilowatt) wrote:
I have thought about writing an article about this whole process for CodeProject, but I am not sure how many people are still interested in learning the internals of Windows.
Despite the current dot-net-web-service-everything-as-xml-passed-through-five-frameworks-before-reaching-the-same-api-as-everything-else fad, there are still those of us who use and abuse straight Win32 daily. Well-written articles/tutorials/references/rundowns are *always* appreciated...
Shog9
------
So they took me down to the gallows
And this boy, he said to me:
"Why do you smile, when the rope's around your neck?"
I said, "I tell you boy, when i get back..."
|
|
|
|
|
But why the following is not working for a very simple dialog box app:
UINT CSasaDlg::OnNcHitTest(CPoint point)
{
UINT hittest = CDialog::OnNcHitTest(point);
switch(hittest)
{
case HTRIGHT:
AfxMessageBox("Hurray! you click right side");
}
return hittest;
}
|
|
|
|
|
Because you will not get a HTRIGHT status for a dialog with a non-resizable border. You will only get the HTRIGHT, HTLEFT, HTTOP, HTBOTTOM and all of the combinations in between for a window with a resizable border.
If you change the HTRIGHT to HTBORDER, you will see it work.
Good Luck
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
Does anyone know the answer to this one.
I have a CListCtrl and I want to make the rows different colours.
Can I do this without making it Owner draw? i.e just using SetTextColor
When I insert the items at the moment, all of them are the same colour even though I make multiple calls to the SetTextColor function with different RGB value.
Please could someone help.
Really appreciate it.
Richard
|
|
|
|
|
You have to use owner draw, SetTextColor works for the whole list, there's no item index parameter. it's not that hard to use owner draw, if you only want to change the color of an item.
There might be someone who already create a CListCtrl derived control that do that, did you check here on CodeProject ?
Max.
|
|
|
|
|
Thanx Max.
I have done owner draw many times. This is a simple app and I thought I could get away from owner draw.
I just wanted to know for sure.
Anyway thanks for ur time.
Richard
|
|
|
|
|
You can do that with custom draw (not the same as owner draw). I have an article on custom draw here in the list control section.
--Mike--
"I'd rather you just give me a fish today, because even if you teach me how to fish, I won't do it. I'm lazy." -- Nish
Just released - 1ClickPicGrabber - Grab & organize pictures from your favorite web pages, with 1 click!
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
|
|
|
|
|
How do I put a picture (from a resource) in a ListCtrl background ??
Thanks,
Cris ...
|
|
|
|
|
Unfortunately, you can only use picture files (NOT resources) with the standard list control . To display a picture from a resource you'd need to go owner-draw (or temporarily extract the resource picture to disk file ).
Faith. Believing in something you *know* isn't true.
|
|
|
|
|
Can anyone recommend a simple way of decomressing an archive. I've had a look at zlib and ZipArchive and they are a bit too bloated for the functionality i'm looking for. Just a very basic method of decompressing an archive into a folder?
Cheers
Asim Hussain
e: asim@jawache.net
w: www.jawache.net
|
|
|
|
|
|
Hi!
does anyone can tell me why acrobat isn't closing after I print pdf file programmatically.
I have used two ways to print pdf files,
1) ShellExecute()
ShellExecute(NULL,"print","filename.pdf","","",2);
2) system() by passing command line for printing pdf files
<br />
fileName = "e:\\CUM_AuntAnnes_1A_19960329.pdf";<br />
CPrintDialog printer(FALSE);<br />
printer.GetDefaults();<br />
CString command = " acrobat /t ";<br />
command += "\"";<br />
command += fileName;<br />
command += "\" "; <br />
command += "\"";<br />
command += printer.GetDeviceName();<br />
command += "\" ";<br />
command += "\""; <br />
command += printer.GetDeviceName();<br />
command += "\" ";<br />
command += "\"";<br />
command += printer.GetPortName();<br />
command += "\""; <br />
system(command);<br />
Either way print the pdf but left Adobe Acrbat reader opened. So the user have to close it manually. I don't want the user to close it manually.
Is there links or examples to print pdf with adobe acrobat and close acrobat programmatically? Or other better ways to print pdf?
Thank you
|
|
|
|
|
can u not kick it off as a process and then send it a WM_CLOSE message when its finished?
"even if my world is weird it's my world" biz stuff about me
|
|
|
|
|
Here is an another way that I tried,
<br />
<br />
SetShellExecuteInfoStructure(lpExecInfo,print,fileName);
int success = ShellExecuteEx(&lpExecInfo);
if(lpExecInfo.hProcess !=NULL)<br />
{<br />
if(afile->type.CompareNoCase(".pdf")==0)<br />
{<br />
::Sleep(25000);<br />
PostMessage(reinterpret_cast<unsigned int>(lpExecInfo.hwnd),WM_CLOSE,NULL);<br />
}<br />
::WaitForSingleObject(lpExecInfo.hProcess, INFINITE);<br />
::CloseHandle(lpExecInfo.hProcess);<br />
}<br />
I tried it like that and it is not working. I dont know what else I need to do. Infact, I dont' really know how to post the message, I'm a beginner in programming..
Do I have to do something else after I post the meassage in this way???
what else do I have to do?
|
|
|
|