|
A quick search of the MFC code shows that in the AFX function IsHelpKey, the system checks directly for F1. This function is only called in the default threadcore code (i think - not absolutely sure) when processing messages. My suggestion to get this to work for you would be to override the PreTranslateMessage function for the windows you need to use the F1 key for. Trap the F1 key yourself and then act on it directly to call the right code at that point yourself. To continue to get he help code to work for a different key, define an accellerator for e.g. Ctrl-H to map to ID_HELP command.
Some code written from memory that may help.
BOOL CMyWindow::PreTranslateMessage(MSG* pMsg)
{
if (pMSG->message == WM_KEYDOWN && pMsg->wParam == VK_F1)
{
return TRUE ;
}
return CBaseWindow::PreTranslateMessage(pMsg) ;
}
Roger Allen
Sonork 100.10016
If I'm not breathing, I'm either dead or holding my breath.
A fool jabbers, while a wise man listens. But is he so wise to listen to the fool?
Please step to the rear of the car and make room for more victims. - John Simmons the Outlaw programmer, 1st Feb 2002, in the lounge
|
|
|
|
|
This is no solution to your problem as Roger has already given one. What I'd like to do is recommend that you do not redefine the keys that have "standard" functionality in Win32 programs (e.g. F1, Alt-F4, F10). This will only confuse your user and make them think your program is complicated to use.
Cheers
Steen.
"To claim that computer games influence children is rediculous. If Pacman had influenced children born in the 80'ies we would see a lot of youngsters running around in dark rooms eating pills while listening to monotonous music"
|
|
|
|
|
Hi there,
Given the following piece of code; (which puts an icon in the system tray)
<br />
WNDCLASSEX l_Class;<br />
l_Class.cbSize = sizeof(l_Class);<br />
l_Class.style = 0;<br />
l_Class.lpszClassName = TEXT("SystemTrayHandlerClass");<br />
l_Class.lpfnWndProc = WndProc;<br />
l_Class.hbrBackground = NULL;<br />
l_Class.hCursor = NULL;<br />
l_Class.hIcon = NULL;<br />
l_Class.hIconSm = NULL;<br />
l_Class.lpszMenuName = NULL;<br />
l_Class.cbClsExtra = 0;<br />
l_Class.cbWndExtra = 0;<br />
l_Class.hInstance = NULL; <br />
<br />
if (!RegisterClassEx(&l_Class))<br />
return;<br />
<br />
m_window = CreateWindow<br />
(<br />
TEXT("SystemTrayHandlerClass"),<br />
TEXT("SystemTrayHandler"),<br />
WS_POPUP,<br />
0, 0, 0, 0,<br />
NULL,<br />
NULL,<br />
0,<br />
NULL<br />
);<br />
<br />
if (!m_window)<br />
return;<br />
<br />
DragAcceptFiles(m_window, TRUE);<br />
<br />
SetWindowLong(m_window, GWL_USERDATA, (LONG) this);<br />
<br />
NOTIFYICONDATA m_iconData;<br />
m_iconData.cbSize = sizeof(NOTIFYICONDATA);<br />
m_iconData.uFlags = NIF_MESSAGE | NIF_ICON | NIF_TIP;<br />
m_iconData.uCallbackMessage = WM_SYSTEMTRAYICON_CLICK;<br />
m_iconData.uID = 0;<br />
m_iconData.hWnd = m_window;<br />
m_iconData.hIcon = m_icon;<br />
strcpy(m_iconData.szTip, m_tooltip);<br />
<br />
Shell_NotifyIcon(NIM_ADD, &m_iconData);<br />
<br />
Given the line: DragAcceptFiles()
My question is can the icon now accept files?
Thanks
Rich
|
|
|
|
|
My guess is that, altough the window itself will accept dropped files, you won't be able to drag the files to the associated tray icon. But, why don't you just give it a try? Simply drag some file to the icon and check if your app receives the WM_DROPFILES message.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Joaquín M López Muñoz wrote:
But, why don't you just give it a try? Simply drag some file to the icon and check if your app receives the WM_DROPFILES message.
I have tried this but Iam not recieving any of the messages.
Any ideas on how to dow this?
Cheers
|
|
|
|
|
Hi there,
Given the following piece of code; (which puts an icon in the system tray)
<br />
WNDCLASSEX l_Class;<br />
l_Class.cbSize = sizeof(l_Class);<br />
l_Class.style = 0;<br />
l_Class.lpszClassName = TEXT("SystemTrayHandlerClass");<br />
l_Class.lpfnWndProc = WndProc;<br />
l_Class.hbrBackground = NULL;<br />
l_Class.hCursor = NULL;<br />
l_Class.hIcon = NULL;<br />
l_Class.hIconSm = NULL;<br />
l_Class.lpszMenuName = NULL;<br />
l_Class.cbClsExtra = 0;<br />
l_Class.cbWndExtra = 0;<br />
l_Class.hInstance = NULL; <br />
<br />
if (!RegisterClassEx(&l_Class))<br />
return;<br />
<br />
m_window = CreateWindow<br />
(<br />
TEXT("SystemTrayHandlerClass"),<br />
TEXT("SystemTrayHandler"),<br />
WS_POPUP,<br />
0, 0, 0, 0,<br />
NULL,<br />
NULL,<br />
0,<br />
NULL<br />
);<br />
<br />
if (!m_window)<br />
return;<br />
<br />
DragAcceptFiles(m_window, TRUE);<br />
<br />
SetWindowLong(m_window, GWL_USERDATA, (LONG) this);<br />
<br />
NOTIFYICONDATA m_iconData;<br />
m_iconData.cbSize = sizeof(NOTIFYICONDATA);<br />
m_iconData.uFlags = NIF_MESSAGE | NIF_ICON | NIF_TIP;<br />
m_iconData.uCallbackMessage = WM_SYSTEMTRAYICON_CLICK;<br />
m_iconData.uID = 0;<br />
m_iconData.hWnd = m_window;<br />
m_iconData.hIcon = m_icon;<br />
strcpy(m_iconData.szTip, m_tooltip);<br />
<br />
Shell_NotifyIcon(NIM_ADD, &m_iconData);<br />
<br />
Given the line: DragAcceptFiles().
My question is can the icon now accept files?
Thanks
Rich
|
|
|
|
|
Hi,
I have a table in oracle which hhas picture stored in it.I had used D2K forms to insert picture into the table. Now i want to display this picture from the database to my picture control in vc++ at runtime. How do we load a picture to the picture controlin the form at runtime.
Please help..
|
|
|
|
|
I'm not sure about it,cause I don't know about oracle.
You can first read file and put the string into your database,then if u want to reuse it ,read the string from database and put the string into a file with .jpg or .bmp extention.
Hope it helps
Mazy
"So,so you think you can tell,
Heaven from Hell,
Blue skies from pain,...
How I wish,how I wish you were here." Wish You Were Here-Pink Floyd-1975
|
|
|
|
|
Hey
First: I know how crate custom brush (logical or bitmap) but i don't know how make it transparent - please help me with it.
Second: I don't know how create a custom pen - from bitmap or logical - so if you know how to do it please tell me.
Thx for any answer.
PozdMIT
|
|
|
|
|
umm... to make the brush transparent i think you use CDC function SetBkMode and in the parameter put TRANSPARENT. (eg. SetBkMode(TRANSPARENT)). to create a pen you use CPen then instantiate it. like CPen mBluePen. then after that use mBluePen.CreatePen()... try check the stuff to put inside coz i kinda forgot. just try it out. i think thats right.
|
|
|
|
|
ok but this in not what I wont know
I create my own custom brush from bitmap - using CreatBrushPattern(&Bitmap). On this brush function SetBkMode doesn't work - I don't know why.
about pen - I know how create "normal pen" but I wont creaet my own pen - eg. from bitmap - I don't know how to do it - on online help I found only info that if must seek info about this on online documentation. But nothing I can't find.
|
|
|
|
|
Where would be the purpose of a transparent brush...?
Or do you mean semi-trans...?
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
ofcorse I mean semi-trasparent brush
eg.
color white transparent
other colors not
|
|
|
|
|
In that case you do NOT mean a semi transparent brush, and it's easy to say 'of course', but
a/ there IS such a thing as a transparent brush, and it has it's uses,
b/ why should we know what you mean if you don't say it ?
You can do a partly transparent brush by using a mask and doing three blt's, the details are in MSDN, on this site ( I think ) and in my WDJ article, which is online at www.wdj.com, in the Sept 2001 issue.
I think it's probably quicker to do it with direct pixel access, that is how I did it when I implimented the ability to draw an area freehand in an image and then use it as a brush in my paint program.
Christian
I have come to clean zee pooollll. - Michael Martin Dec 30, 2001
Picture the daffodil. And while you do that, I'll be over here going through your stuff.
|
|
|
|
|
thanks for answer
but for me this metod propobly will be to slow because I must show more then 20.000 regions with brush and it must be quick
with "system brush" it works fine - very fast
with my custom brush without trasparent works fine - very fast too
but i will try your metod maybe it will be fast enough
one more time thx for answer
|
|
|
|
|
sorry for anonymous
I forgot login
previous message was from me
|
|
|
|
|
Given that a transparent brush does nothing, I assume you mean how to have a brush with an alpha value ( partly transparent throughout ), or masked ( fully transparent in part ).
The answer to both is that it's easy with GDI+, but needs to be done by hand, pixel by pixel using only GDI. If you can't use GDI+, you'll need access to the bits of the image, preferably by using a DIBSection, and then write code to do your alpha merging by hand. You can do the blitting with a mask without direct pixel access, but I tend to think the direct access method is faster, having done it myself both ways.
Christian
I have come to clean zee pooollll. - Michael Martin Dec 30, 2001
Picture the daffodil. And while you do that, I'll be over here going through your stuff.
|
|
|
|
|
Hi,I want to monitor the actual downstream Bitrate, on Win 2k pro.
Thank you
|
|
|
|
|
I have a report view which I want to be able to sort.
I must have something wrong with the way I use
a pointer to a function. Here is the code:
- - - - - - - - - - - - -
This _should_ be in the global namespace, at least
when I start to enter "::" MSVC6++ offers me a list
of possible options and CompareFunc is listed there
and I can pick it
int CALLBACK CompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort)
{
if (lParam1 > lParam2) {
return -1; }
else {
return 0; }
}
- - - - - - - - - - - - -
This piece of code is inside a class derived from
ClistView
ListView_SortItems(
m_hWnd,
::CompareFunc,
0);
- - - - - - - - - - - - -
...and then I get error message:
error C2039: 'CompareFunc' : is not a member of '`global namespace''
|
|
|
|
|
MVH wrote:
at least
when I start to enter "::" MSVC6++ offers me a list
of possible options and CompareFunc is listed there
and I can pick it
Sometimes it gives you some stuff things.
Just guess:put your CompareFunc at the top of your CListView class,somewhere
before the place you use SortItems
Mazy
"So,so you think you can tell,
Heaven from Hell,
Blue skies from pain,...
How I wish,how I wish you were here." Wish You Were Here-Pink Floyd-1975
|
|
|
|
|
That is exacly how I have done that.
I've even changed the CompareFunc to
int CALLBACK ::CompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort)
and it still says the same. This ain't fun! *frown*
Any suggestions what to do or try?
|
|
|
|
|
This is sample code in MSDN:
static int CALLBACK
MyCompareProc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort)
{
CListCtrl* pListCtrl = (CListCtrl*) lParamSort;
CString strItem1 = pListCtrl->GetItemText(lParam1, 0);
CString strItem2 = pListCtrl->GetItemText(lParam2, 0);
return strcmp(strItem2, strItem1);
}
void snip_CListCtrl_SortItems()
{
extern CListCtrl* pmyListCtrl;
pmyListCtrl->SortItems(MyCompareProc, (LPARAM) pmyListCtrl);
}
I also check an example of CALLBACK,I put it after constructor of view class
and it work fine
Mazy
"So,so you think you can tell,
Heaven from Hell,
Blue skies from pain,...
How I wish,how I wish you were here." Wish You Were Here-Pink Floyd-1975
|
|
|
|
|
Are you by chance defining your CompareFunc function inside some namespace or class? I've tried to replicate your problem but everything works fine (i.e. CListCtrl::SortItems merrily accepts ::CompareFunc .) Could you post a little more code to see the thing in context?
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
I am getting a nagging feeling that I have misunderstood something totally wrong here...
This the file with the middle part snipped:
int CALLBACK CompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort)
{
// don't take this part seriously
if (lParam1 > lParam2) {
return -1; }
else {
return 0; }
}
// WsInfoView.cpp : implementation of the CWsInfoView class
//
#include "stdafx.h"
#include "WsInfo.h"
...yadda yadda yadda....
and then the ending of the file:
void CWsInfoView::DoFullList()
{
CListCtrl& ctlList = GetListCtrl();
ctlList.SetExtendedStyle(LVS_EX_GRIDLINES);
<snipped inserting="" items="" into="" the="" report="" view="">
ListView_SortItems(
m_hWnd,
::CompareFunc, 0);
}
CompareFunc is visible in MSVC6++ as "globals"
|
|
|
|
|
Ummm... You have defined CompareFunc at the very beginning of WsInfoView.cpp ? If so, please try moving it after the #include s.
I agree with you that the thing should work, but as it doesn't there's no option but to look for the unlikely.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|