|
I'm currently building a custom control from scratch in Win32 API (no MFC). It's a divder control (something like the MFC splitter).
I defined some notification events to be sent to the parent window like DVN_DELETEDPANE, but I don't know what number to give to the constant. It will be put in NMHDR.code to be sent with WM_NOTIFY to the parent control. I want to know how to define them so they don't conflict with existing values for other controls.
Thank You
David
|
|
|
|
|
this probably won't help you much but you might want to just define your own message instead of using WM_NOTIFY. when MS updates the common controls new constants for NMHDR.code might be added so i don't think there is any way of knowing for sure there won't be any conflicts in the future...
|
|
|
|
|
I understand, but then how to define a custom WM_???? that doesn't conflict with other conrols using WM_USER or WM_APP as I see common controls also use WM_USER + N do define their custom messages.
|
|
|
|
|
the only things i can think of are put
#ifndef divctrl_notify
#define divctrl_notify (wm_app+1)
#endif
in the divctrl header and if it conflicts with other msgs you've defined, define divctrl_notify as something else before you include the header.
a better way might be to just use WM_COMMAND like other windows controls and let the notification codes be anything you want (the notification codes for the different win ctrls seem to all conflict anyway). just make sure you check the id of the ctrl (so you what type of ctrl it is) before parsing the notification codes and there shouldn't be a problem (i think??).
|
|
|
|
|
The problem is that this is a DLL to add support for UI making in another application. The ID of the control is not know to the DLL window procedures, it just parses the correct messages and sends the info back to the calling app through callback support.
Anyways, thanks for the information, I'll see what I can do to get around the problem, I think I have a solution that will work even though there is a conflict.
|
|
|
|
|
ClickHeRe wrote:
The problem is that this is a DLL to add support for UI making in another application
i see. RegisterWindowMessage() might help.
|
|
|
|
|
Read this:
http://blogs.msdn.com/oldnewthing/archive/2009/08/21/9877791.aspx[^]
The two key portions are:
"WM_NOTIFY is basically a sender-defined version of WM_USER"
"It is an unwritten convention that the notification codes for the common controls are all negative numbers. This leaves positive numbers for applications to use for their own purposes."
|
|
|
|
|
Hi,
I will be needing an image ticker (basically, a control that scrolls images from right to left over and over again)for a project that I am starting. I need it to be customizable (speed, specify image paths, ...). I was wondering if anyone knew of any such control that already exists so that I don't have to reinvent.
Of course, since I am posting here, I would prefer if it was written in c++, but since the project is just now about to get on its way, I am also open to the possibility of doing it in c#.
Thanks in advance,
ps: I have already searched for one, but didnt find one. I am posting just in case I missed something, and someone can help.
-----------------
Genaro
\\\|
_ _
@ @
_\\
--|
_/
|
|
|
|
|
Do like that:
Disk ---->Load---->[DIB]
Define a number of vertical bands of the DIB image you want to use
and put consequently those bands to your destination DC using StretchDIBits().
It's fast and ... it works
SkyWalker
|
|
|
|
|
Thanks Skywalker,
but I am not sure how to do what you adviced. I looked up DIB and StretchDIBits(), but I cannot find an example of how to "string" images together.
If I understand correctly, your idea is to create a single image from all the images that I want to use and then just scroll that image in a ticker-like manner?
If you have some sample code, that would be greatly appreciated.
Thanks a lot,
-----------------
Genaro
|
|
|
|
|
Get the code from my article here at CP:
http://www.codeproject.com/opengl/anyTex.asp[^]
The code there is used for something else, but you can use the
code there with minor modification for what you need.
Just keep in contact if after that you still need some coding example.
SkyWalker
|
|
|
|
|
I'm not sure how I would go about using your class to do what I want. A good example of what I would like to do is http://www.codebrain.com/java/codebrainslider/index.html[^]
The only thing is that I would like to implement it in c++. Let me know if this is possible. Thank you,
-----------------
Genaro
|
|
|
|
|
Ok, tomorrow morning (Europe's time), I'll send you a small demo application
with an image ticker placed at the top of the screen (of course, you can place it wherever you want).
SkyWalker
|
|
|
|
|
I just add a member variable by right-clicking a class, I haven't assigned a value to it yet nor use it and when I ran the program, a windows message box prompt saying that my program caused an error and need to be closed. Than another message box appeared after that:
Debug Assertion Failed
path of my program
FILE: dbgheap.c (i don't have this file on my prog)
LINE: 1017
EXPRESSION:_BLOCK_TYPE_IS_VALID(pHead->nBlockUse)
What's this?
|
|
|
|
|
you would do well to add member variables, etc, by hand. The IDE stuff works most of the time, but it's not really programming, and sometimes it just falls apart. I learned that the hard way when the IDE made a mess of a COM project, and I had to quickly learn how to add methods to COM by hand.
benjnp wrote:
FILE: dbgheap.c (i don't have this file on my prog)
No, this is part of the runtime. You'd be amazed how many files 'not in your project' get included when you hit 'compile'
Looks like you are accessing memory that is not valid to me.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Oh, so there's nothing I can do about it by now. I must learn how to add a member variable the hard way.
|
|
|
|
|
Well, it's hardly difficult. You check for an area that has the access you want, or add one at the bottom ( you should default to private member variables ), and you add it. It just looks like this ( in the .h file, inside the class definition )
int m_myInteger;
string m_theString;
etc.
Not a big deal, IMO. To add a method, you just add the signature in the .h file
void MyMethod(int s);
then in the .cpp file you do this
void MyClass::MyMethod(int s)
{
// do something.
}
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Yup, sometimes, I override the MFC automation process by adding variables myself. But I think the error that I just encountered is a bit unusual. Just forget it, I'll just have to try get around it. Thanks
|
|
|
|
|
Try rebuilding all so that all files get re-compiled. If you are creating an object of that class in one file and deleting it in another file, you'll get that error (or similar) if one of the files didn't get compiled after adding the variable.
In normal situations you shouldn't need this because it's automatically handled through file dependencies, but I've ocasionally seen the IDE fail in that respect. A 'Rebuild All' usually fixes the problem in those cases.
Also, make sure you only have one header file for that class, or if for some reason you have duplicated it, make sure both copies are kept in sync.
--
jlr
http://jlamas.blogspot.com/[^]
|
|
|
|
|
How do I use a Collection::Contains with a struct (The collection is full of structs)
When I try to pass the struct I get the error:
error C3627: Only a value type can be boxed
error C2664: 'System::Collections::Queue::Contains' : cannot convert parameter 1 from 'Point' to 'System::Object __gc *'
-Steven Hicks
CPACodeProjectAddict
|
|
|
|
|
|
Point is:
struct Point
{
int x, y;
}
How can structs inherit, does that make it pretty much a class.
-Steven Hicks
CPACodeProjectAddict
|
|
|
|
|
A struct IS a class. The only difference is that structs are default access public.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
|
A .NET struct is not a .NET class. I didn't read that bit, although I did check that I was not in the managed C++ forum, because I did think of that.
Christian Graus - Microsoft MVP - C++
|
|
|
|