|
I've created a unicode HeaderControl (window class name WC_HEADERW).
I'm adding items something like this:
HDITEMW headerItem;
memset( &headerItem, 0, sizeof(headerItem) );
headerItem.mask = HDI_LPARAM | HDI_WIDTH|HDI_FORMAT|HDI_TEXT;
headerItem.lParam = (LPARAM)j;
headerItem.pszText = LPSTR_TEXTCALLBACKW;
headerItem.cxy = 80;
headerItem.fmt = HDF_LEFT;
int err = SendMessage( headerWnd_, HDM_INSERTITEMW, (WPARAM)j, (LPARAM)&headerItem );
That works fine. I get a HDN_GETDISPINFOW notification. However the iItem in the NMHDDISPINFOW structure is always some bizarre number, i.e. it's not "0" or "1" etc, like one would expect. I googled a bit and didn't find much of a resolution to this. Has anyone else every gotten this to happen and how do you deal with it? Since I'm storing the index in the lParam I can see that is being sent correctly and work around this, but it's kind of silly to say the least.
¡El diablo está en mis pantalones! ¡Mire, mire!
Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)!
SELECT * FROM User WHERE Clue > 0
0 rows returned
Save an Orange - Use the VCF!
VCF Blog
|
|
|
|
|
Jim Crafton wrote: window class name WC_HEADERW
Isn't that a Macro? Isn't the class name "SysHeader32"?
led mike
|
|
|
|
|
Yeah but my understanding is that's what you're supposed to use (presumably in case our good buddies in redmond change the name). So there's one for unicode and one for ansi.
¡El diablo está en mis pantalones! ¡Mire, mire!
Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)!
SELECT * FROM User WHERE Clue > 0
0 rows returned
Save an Orange - Use the VCF!
VCF Blog
|
|
|
|
|
Why are you using the W versions? I mean theres W, A and Generic (or whatever) where Generic is defined by your compilation mode of UNICODE or ANSI. Why aren't you just using it that way?
led mike
|
|
|
|
|
What OS are you on? I find it suspicious that iItem is the first member after the NMHDR struct that might be different sizes on different WINVERSIONs
led mike
|
|
|
|
|
XP.
All the other members in the struct look OK. And it correctly uses the text I give it. It's as if the iItem is simply being ignored. I found a post from a few ago that someone else had apparently run into a problem like this, but no one ever replied back to him.
I used Spy++ and confirmed that the header was created as a Unicode wnd proc. It's correctly handling (and giving out) unicode messages, except for this oddity.
¡El diablo está en mis pantalones! ¡Mire, mire!
Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)!
SELECT * FROM User WHERE Clue > 0
0 rows returned
Save an Orange - Use the VCF!
VCF Blog
|
|
|
|
|
The final release of the Visual C++ 2008 Feature Pack is now available for download. This release provides several exciting features for C++ developers, such as a major update to MFC and an implementation of TR1. These features are fully covered under Microsoft’s standard support policies.
The Feature Pack is available free of charge to any Visual Studio 2008 Standard or above customer. The download can be found at Visual C++ 2008 Feature Pack Release.
Using the included MFC components, you can create applications with the “look & feel” of Microsoft’s most popular products – Microsoft Office, Visual Studio and Internet Explorer. Some of the interesting MFC components in the Feature Pack include:
- Office 2007 Ribbon Bar: Ribbon, Pearl, Quick Access Toolbar, Status Bar, etc.
- Office 2003 and XP look: Office-style toolbars and menus, Outlook-style shortcut bar, print preview, live font picker, color picker, etc.
- Visual Studio look: sophisticated docking functionality, auto hide windows, property grids, MDI tabs, tab groups, etc.
- Internet Explorer look: Rebars and task panes Vista theme support
- “On the fly” menus and toolbar customization: users can customize the running application through live drag and drop of menu items and toolbar buttons
- Shell management classes: use these classes to enumerate folders, drives and items, browse for folders and more
For more information on the new MFC support:
TR1 (“Technical Report 1”) is a set of proposed additions to the C++0x standard. Our implementation of TR1 contains a number of important features such as smart pointers, regular expression parsing, containers (tuple, array, unordered set, etc) and sophisticated random number generators.
More information on TR1 can be found at the sites below:
|
|
|
|
|
Hello to everyone,
I've written an application in VC++ 6 using MFC to connect to a database (access db). The application simply read and write data to the mdb file through CRecordset and ODBC drivers. The program works fine on XP (and also on 98) but it does not work in Vista. It seems like the program does not find the mdb.I receive an error as: .... odbc acces driver... c:\programma\database.mdb ..path is not valid. The path exists and the db is there but i still receive the error. may be something abiout permissions, UAC ecc...?
Can someone help me?
Thank you very much.
oko
|
|
|
|
|
I think you need to check your CRecordsetDerived::GetDefaultConnection() to see if you define an appropriate Connection String.
You shouldn't leave the default Connection String after AppWizard!
|
|
|
|
|
Hello,
In my application, I am creating a process in debug mode. I am wondering if there is any way I can detect if the process I created had generated any unhandled exception...
Thanks...
|
|
|
|
|
See the function SetUnhandledExceptionFilter
“Cannot find REALITY.SYS...Universe Halted.”
~ God on phone with Microsoft Customer Support
|
|
|
|
|
Hi there ,
i coded a small app. with an editbox in the toolbar.
When the user makes an input(some numbers) in this editbox i want to store this number in a variable after the user has pressed return (enter) for further calculations.
I'm tried this now for some houres without any success ;(
Idont want to post to much or to small code snippets, so i coded
a very small sample program (39 kb) only a toolbar and an editbox in it and the same problem !
You can download it here:
http://www.filehosting.at/files/download.php?file=f767c44c627cfdb696cb0cea5e24b8be
You have to copy the link in your browser
Only a click on it isn't enough
Pleeese help me, it's really important for me!
Thousand Thanx for yor help !
best regards
croc
|
|
|
|
|
CrocodileBuck wrote: ...without any success
So what's the problem?
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
You can subclass the edit control and look for the enter key press. When the enter key is pressed you can post
a message to another window to do the processing of the edit control contents.
See method II here: How To Use the ENTER Key from Edit Controls in a Dialog Box[^]
Also, a Google search on "enter key edit control" yields much info.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Thx for your quick reply !
The prob. ist that i don't know where i have to do what to get the datas after pressing return.
And i haven't got a Dlg, the EditControl is on a Toolbar !
Thanx a lot
best regards Croc
modified on Monday, April 7, 2008 1:24 PM
|
|
|
|
|
Subclassing a control is the same for a window as it is for a dialog.
You must have an HWND for the edit control if you put it there
Subclassing Controls[^]
If you're using MFC it's much simpler.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi Mr.Salsbery,
>>>If you're using MFC it's much simpler.<<<<br mode="hold" />
...but i am usin g the glory MFC *heut* i tried it for more than 4 hours and i think i couldn't findd my mistake !!!
best regards
hopefullx Croc
|
|
|
|
|
CrocodileBuck wrote: i am usin g the glory MFC
In that case...
Derive a class from CEdit
Create the edit control using your derived class
In the derived class, add a handler for WM_CHAR
In the WM_CHAR handler, look for the enter key (as shown in the first link I posted)
If the enter key was pressed - do whatever you need to do
For all other keys, pass the message on to the edit control (call Default();)
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Ok,
i'put this code in the newToolBar.cpp:
BOOL New_cToolBar::PreTranslateMessage(MSG* pMsg)<br />
{<br />
if (pMsg->message==WM_KEYDOWN && pMsg->wParam == VK_RETURN )<br />
{<br />
if (pMsg->message==WM_KEYDOWN && pMsg->wParam == VK_RETURN )<br />
{<br />
<br />
if ( ID_nEDIT )<br />
{<br />
MessageBox( _T("Got it!") );<br />
}<br />
}<br />
}<br />
return New_cToolBar::PreTranslateMessage( pMsg );<br />
}<br />
but int won't work ???
best regards Croc
|
|
|
|
|
That won't work because the message goes to the edit control, not to the toolbar
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Thx Mr. Salsbery,
are there any CodeSnippets out there ?
I think i couldn't manage it without ...
Best regards Croc
|
|
|
|
|
Perhaps you could have a look on my Code i posted !?
Thx
Best regards
croc
|
|
|
|
|
<font color="Green">
#pragma once
class CMyEdit : public CEdit
{
DECLARE_DYNAMIC(CMyEdit)
public:
CMyEdit();
virtual ~CMyEdit();
protected:
DECLARE_MESSAGE_MAP()
afx_msg void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags);
};
<font color="Green">
<font color="Green">
#include "stdafx.h"
#include "MyEdit.h"
IMPLEMENT_DYNAMIC(CMyEdit, CEdit)
CMyEdit::CMyEdit() : CEdit()
{
}
CMyEdit::~CMyEdit()
{
}
BEGIN_MESSAGE_MAP(CMyEdit, CEdit)
ON_WM_CHAR()
END_MESSAGE_MAP()
void CMyEdit::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags)
{
if (nChar == VK_RETURN)
{
<font color="Green">
return;
}
CEdit::OnChar(nChar, nRepCnt, nFlags);
}
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Many thx Mr. Salsbery,
this will work, but only in a seperate project!
Now i try to put your code in my code with the edit in the toolbar !
Where and how have i to implement it ???
I never did anything in the MFC that was as complicated like this !
Many Thanx
Croc
|
|
|
|
|
CrocodileBuck wrote: this will work, but only in a seperate project!
You can't add another class to your project?
How did you get the edit control on the toolbar (the code)?
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|