|
Thanks Jon. Your idea gave me the encouragement to do what needed to be done. I subclassed the CEdit control with a class that has message handlers for all of the appropriate messages that potentially change the caret position in the edit box. These include WM_KEYDOWN, WM_KEYUP, the three left moouse button messages, the three right mouse button messages and the reflected CHANGE message. It turns out that WM_CHAR is not so very useful as this does not get sent except for typed characters that will be modifying the edit box text contents. One sees no response there except for the likes of the arrow keys that actually move the caret around.
Thanks again. Mike
|
|
|
|
|
Hi,
Is there any way to get the Driver name Assosiated with a DSN??What is the Function to be Used??
Pls Help
|
|
|
|
|
Help... i am trying to write a function for my program but i forgot how to change the font size for the string in the CDC function DrawText(). can anyone tell me how do i do that? i want to make my font bigger so when i use the DrawText function it will be bigger than the default font size.
oh the function parameters are for DrawText is...
int DrawText(Cstring &str, CRect rect, UINT format);
int DrawText(CString &str, int count, CRect rect, UINT format);
|
|
|
|
|
This may work:
CFont *pCurrent = pDC->GetCurrentFont() ;
LOGFONT lf ;
pCurrent->GetLogFont(&lf) ;
lf.lfHeight -= -4 ;
CFont local_font ;
local_font.CreateFontIndirect(&lf) ;
pDC->SelectObject(&local_font) ;
DrawText(...) ;
pDC->SelectObject(pCurrent) ;
VEROFY(local_font.DeleteObject()) ;
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
|
|
|
|
|
Hi,
I made a full ActiveX control using ATL ( so it inerhits form IDataObjectImpl as well).
I´m using the control in an MFC application ( well pasted on a Word automated instance...), and I would like to pass to that ActiveX control a Metafile from the Mfc app.
Somebody points me to use that IDataObject, but I don´t see it quite clear, How can I use that, using setdata/getdata ?, Should I have to implement an eventSink, or is there any easier way to do that ?
Thanks, Bye !
Braulio
|
|
|
|
|
In MFC help file, there is a paragrah: "The application’s accelerator table defines F1 for ID_HELP and SHIFT+F1 for ID_CONTEXT_HELP. You can change the keys used for these help functions by using Visual C++ to change the key values in the accelerator table."
I try to define the F1 key for some function in my project (it's interface needs all the keys F1 to F12). I define a new volue for ID_HELP. But when I hit the F1 key, my application activates my function and the Windows help file
Does anybody know how to fix this problem?
I do not want to remove the Windows help F1 key. Just want to change it to another name, say ALT+F1
Thank You Very Much!
Louis
|
|
|
|
|
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''
|
|
|
|
|