|
It looks like it is simply overloading the << operator for arbitrary template types. Looking at the code, this means the << operator should work for any type T that the ostream operator << overloads.
So you should be able to do something like this:
<br />
ozstream :bob:;<br />
int i;<br />
char ch;<br />
double d;<br />
<br />
:bob: << i;<br />
:bob: << ch;<br />
:bob: << d;<br />
and it will Do The Right Thing. If you try to use << on a weird type that cannot be passed to an ostream, it will give you an error.
Even a broken clock is right twice a day.
|
|
|
|
|
I know that I need to use WNetAddConnection2 to map a network resource but when I use WNetCancelConnection, and then try to map again I get an error 1312. I noticed that I can use WNetUseConnection to make my mapping but how do I disconnect a mapped resource on my pc? Thanks
Tom Wright
Programmer
tawright915@yahoo.com
|
|
|
|
|
I'm trying to figure a way to print the flexgrid. Is there away?
Thanks
|
|
|
|
|
Hi,
when I make a shortcut to my application and choose a different icon, explorer shows me all icons from my resource. I want only 1 or two icons being possible for the explorer, how?
Thanks for your help!
|
|
|
|
|
sounds like impossible mission?
|
|
|
|
|
I want to launch my help file so I did:
void CTestView::OnHtm()
{
HtmlHelp(AfxGetMainWnd()->GetSafeHwnd(), "ice.chm", HH_DISPLAY_TOPIC,0);
}
But nothong happens when I press Help....???
Appreciate your help,
ns
|
|
|
|
|
Try specifying the fully qualified filespec (eg: C:\SomeDir\ice.chm ). In general, it's a good idea to always use fully qualified filespecs, since you can never rely on the default directory.
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Ravi Bhavnani wrote:
use fully qualified filespecs
or just find out the directory that the exe is running in (::GetModuleFileName ) and then use relatve paths.
|
|
|
|
|
GetModuleFilename will certainly allow you to determine the app's directory and therefore create a fully qualified filespec. But it's not an alternative, as the word "or" implied!
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
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.
|
|
|
|