|
|
I'll try this..
Is it possible to create a window derived from CScrollView?
|
|
|
|
|
Hi,
I am trying to draw Ascending and Descending sort arrows in a ListView Control Header using the WIN32 API. I have handled the NM_CUSTOMDRAW message and everything works ok except for one situation. The first time I click on the header control the column data is sorted properly, but the sort arrow is drawn then immediately erased. If I swap to another window and come back the sort arrow appears in the display. If I click on the same column a second time the arrow is drawn and remains in the display. The problem occurs anytime I click on a column in the header for the first time.
I know there is something I am missing here but being new to WIN32 I don't have a clue what else to try.
Thanks!
|
|
|
|
|
How about doing it with a bitmap instead, so you don't have to worry about drawing the arrow yourself? Check the docs on HDITEM - there's a mask flag HDI_BITMAP and you store a bitmap in the hbm member. If you're on XP+, the header has built-in sorting arrow support - see the HDF_SORTDOWN and HDF_SORTUP flags.
--Mike--
Visual C++ MVP
LINKS~! Ericahist | 1ClickPicGrabber | NEW~! CP SearchBar v3.0 | C++ Forum FAQ
Come quietly or there will be... trouble.
|
|
|
|
|
Gentlefolk:
Has anyone out there done thid kind of thing?
I have been overloading "operator new" to create variable sized classes. I need to create millions of instances of these classes to be processed very rapidly and believe this technique avoids one allocation of data on the heap each invocation.
It seems to work pretty well, but ocassionally leaves stuff on the stack when I believe it has been deleted. I suspect this results when C++ creates temporaries when interpreting complicated statements, and may involve using this for a derived class. I have been not able to pin down exactly the what situation causes this.
I've tried to support "DEBUG_NEW" and that adds to the confusion.
Any help will be appreciated.
The following gives you the gist of what I'm doing.
class MyBase
{ public:
// whatever
};
class MyDerived : public MyBase
{ public:
// whatever
byte m_Data[];
MyDerived( const int &a_Size = *( int * )NULL )
{ memset( &m_Data, '\x00', a_Size ); }
virtual ~MyDerived() {}
#if !defined _DEBUG
void *operator new( size_t a_BaseSize, size_t a_AppendSize )
{ void *t_Memory = malloc( a_BaseSize + a_AppendSize ); return t_Memory; }
void operator delete( void *a_Memory )
{ free( a_Memory ); }
void operator delete( void *a_Memory, size_t a_AppendSize )
{ free( a_Memory ); }
#else
#undef new
void *operator new( size_t a_BaseSize, size_t a_AppendSize, LPCSTR a_File, int a_Line )
{ void *t_Memory = _malloc_dbg( a_BaseSize + a_AppendSize, _NORMAL_BLOCK, a_File, a_Line );
return t_Memory; }
void operator delete( void *a_Memory )
{ _free_dbg( a_Memory, _NORMAL_BLOCK ); }
void operator delete( void *a_Memory, size_t a_AppendSize, LPCSTR a_File, int a_Line )
{ _ASSERTE( false ); _free_dbg( a_Memory, _NORMAL_BLOCK ); }
#define new DEBUG_NEW
#endif
};
//MyProgram
...
int size = 100;
#if !defined _DEBUG
MyDerived &NewDerived = *new( size ) MyDerived( size );
#else
#undef new
MyDerived &NewDerived = *new( size , THIS_FILE, __LINE__ ) MyDerived( size );
#define new DEBUG_NEW
#endif
...
-Obi Wan 2
|
|
|
|
|
Hello,
Since you overloaded operator new, do you allow instances to be created in an other way? For example, did you make the constructors private?
I also see that operator new is global and not a member of your class. It should be a member of your class. See here[^] for more details.
Hope this helps
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
|
|
|
|
|
Bob:
Thanks...
The reference you send is helpful.
In actuality (not clear in my example), the new and delete overloads are not global. They are within the class definition brackets.
The constructors have not been declared private. It is unclear to me why this would be necessary or useful.
The example in the reference says that the source line "new( 'user_args' )" is expanded to "new( 'type_size', 'user_args' )", which seems to be the case. In that case, 'type_size' is the total object size; in my case, 'type_size' is the class size without any appended data and 'user_args' is the additional allocation. The problem is that the actual size of the class is 'type_size' + 'user_args'. I'm not sure how the compiler would know how to create a temporary object, being unaware of the total size.
-Obi Wan 2
|
|
|
|
|
Obi Wan 2 wrote: The constructors have not been declared private. It is unclear to me why this would be necessary or useful.
This is to protect other users of your class to mess up your memory allocation strategy. For example by deleting a pointer to a class on the stack or whatever. Makes your class a bit more dummy proof. When doing this, the compiler also has a hard time creating temporary objects..
Obi Wan 2 wrote: The problem is that the actual size of the class is 'type_size' + 'user_args'. I'm not sure how the compiler would know how to create a temporary object, being unaware of the total size.
You'll have to look at the generated assembly for that. You'll discover the problem there.
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
|
|
|
|
|
Using VC6
Solution must be compatible with Win98 and higher (can't use WH_KEYBOARD_LL for the hook)
----------------------
I've tried creating a global keyboard hook so that I can intercept keystrokes in a given application. However, it's not capturing every key combination. I can get X, Ctrl-X, or Alt-X, but not Ctrl-Alt-X.
Can anyone provide any insight?
------- sig starts
"I've heard some drivers saying, 'We're going too fast here...'. If you're not here to race, go the hell home - don't come here and grumble about going too fast. Why don't you tie a kerosene rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt
"...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
|
That's the first article i looked at. I get the same results.
------- sig starts
"I've heard some drivers saying, 'We're going too fast here...'. If you're not here to race, go the hell home - don't come here and grumble about going too fast. Why don't you tie a kerosene rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt
"...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
What OS? I just tried the demo and I got the Ctrl + Alt + X message.
"When you know you're going to eat crow, it's best to eat it while it's still warm." - Reader's Digest
|
|
|
|
|
On Win98, if you create both a hook and a hotkey for a given key combination then the hotkey wins in front of the hook event.
So, check your hot keys
Maybe this helps.
SkyWalker
-- modified at 15:14 Saturday 12th November, 2005
|
|
|
|
|
Deleted the accelerators before I tried it.
Maybe I missed something, I'll try it again...
------- sig starts
"I've heard some drivers saying, 'We're going too fast here...'. If you're not here to race, go the hell home - don't come here and grumble about going too fast. Why don't you tie a kerosene rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt
"...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
delete and then restart
SkyWalker
|
|
|
|
|
Just a guess, but is your system set to a language other than English? Some languages such as German have another shift key called AltGr, and if the keyboard doesn't have an AltGr key, Windows lets you use Ctrl+Alt instead to get in the AltGr shift state.
--Mike--
Visual C++ MVP
LINKS~! Ericahist | 1ClickPicGrabber | NEW~! CP SearchBar v3.0 | C++ Forum FAQ
Shots do not hurt other players... yet
|
|
|
|
|
Has any1 developed any kind of software capturing data from TV Tuner through AVICap window class. I need some help on it. I shall be very thankful to him/her.
|
|
|
|
|
Sir Khan...
Checkout the windows 98 and or XP Driver Development Kits.... search msdn.microsoft.com for Win98 DDK or WinXP DDK.... In the sample code you will find a project that is pretty much exactlly what your looking for... Infact, I once used this code to create a sort of TiVo ripoff a while back ago....
I know what your trying to do isn't really related to drivers, but there is an example there... The whole DDK thing is a pretty steep learning curve... well at least for me
-peace out yo
-dB0
|
|
|
|
|
I remember that a sample is called avicap. You may search it in MSDN.
|
|
|
|
|
I HAVE downloaded a important project file which has few
*.c and *.h files and other file as *.vcp(VCPROJ) do anyone
know what type of file is this and is it related to any MVStudio.
thank you
Vikas Amin
Embin Technology
Bombay
vikas.amin@embin.com
|
|
|
|
|
Visual C++ writes and uses a number of files during the build process.
.VCP is the Workspace (project) information file, which is the Visual C++ equivalent of the 16-bit version .WSP file.
If you build your program outside the IDE, you may use a makefile to invoke the command-line tools. If you build your program within the IDE, the embedded Visual C++ project system uses the project (.vcp) files to store thr make information.
SkyWalker
-- modified at 17:48 Saturday 12th November, 2005
|
|
|
|
|
.vcproj is the extension used for Visual Studio 2002 and 2003 project files.
Software Zen: delete this;
|
|
|
|
|
Thank you
Vikas Amin
Embin Technology
Bombay
vikas.amin@embin.com
|
|
|
|
|
I HAVE downloaded a important project file which has few
*.c and *.h files and other file as *.vcp(VCPROJ) do anyone
know what type of file is this and is it related to any MVStudio.
thank you
Vikas Amin
Embin Technology
Bombay
vikas.amin@embin.com
|
|
|
|
|
Hi everybody ::- ). I got an issue with some ATL thingy I'm working on. I made an ATL DLL which I use in Visual Basic 6. To set or get a string property I use BSTR, since Visual Basic uses this type. A value from VB6 successfully reaches VC++ 6. But not the other way around. Here's the VC++ code.
BSTR test;
STDMETHODIMP_(HRESULT) CASDINIFile::get_ASDOperator(BSTR *pVal)<br />
{<br />
AFX_MANAGE_STATE(AfxGetStaticModuleState())<br />
<br />
pVal = &test;<br />
<br />
return NULL;<br />
}<br />
<br />
STDMETHODIMP_(HRESULT) CASDINIFile::put_ASDOperator(BSTR newVal)<br />
{<br />
AFX_MANAGE_STATE(AfxGetStaticModuleState())<br />
<br />
test = newVal;<br />
<br />
return NULL;<br />
}
The VB code isn't of relevance. I say myatlobj.ASDOperator = "bla bla" and then try to query the value (and I get nothing). Of course, the problem lies in this line probably:
pVal = &test;
So the function REQUIRES me to give pVal a BSTR *. So I give the address of &test but obviously, it ain't working since probably VB 6 wants a simple BSTR. If I try to change the BSTR * to BSTR I this error from VC++:
error MIDL2121 : [out] only parameter must not derive from a top-level [unique] or [ptr] pointer/array : [ Type 'wireBSTR' ( Parameter 'pVal' ) ]
-= E C H Y S T T A S =-
The Greater Mind Balance
|
|
|
|