|
the next time it happens try this...
comment out this block of code
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
at the beginning of whatever implementation file that you just changed. Then do a build. Then uncomment it and do it again.
Weird, huh? Isn't Microsoft grand?
Sef Tarbell
"A mind all logic is like a knife all blade, it makes the hand bleed that wields it." --Rabindranath Tagore
|
|
|
|
|
I have written a COMM object derrived from CmdTarget, which called from another application.
I would like to show an hour glass, have tried CHourglass and beginWaitCursor and endwaitcursor but nothing happens.
Can anyone offer any advice
Thanks
Rich
|
|
|
|
|
hello,
i made a class with all sorts of functions...
but i actually need to use it as an independant object (compiled) so i can give it to people and that they dont have the source. How can i easily do this?? For example make it a DLL or an Active-X component.. or perhaps something else i haven't heard of yet?? Or is there no easy way out and do i have to rewrite the entire thing so it can be compiled as a DLL??
Any help is appreciated
P.S.: yes, it probably was rather dumb to write it as a class when i needed it to be a DLL or something, lol...
Kuniva
--------------------------------------------
God gave man a penis and a brain but not enough blood to make both of 'em work at the same time.
|
|
|
|
|
Make it into a COM object. COM does exactly what you want. Buy "Developers workshop to COM and ATL 3.0", by Andrew Troelson. it's a mighty good book.
Sorry to dissapoint you all with my lack of a witty or poignant signature.
|
|
|
|
|
You can also make it a static library (.lib ) file, and give it away along with the header files. Please note this will only work in VC++. Also, you would need to release several versions depending on the C run-time library linked against: multithreaded/single-threaded, debug/release, static/dynamic. Fortunately, building this bunch of versions is as simple as having different subprojects with the appropriate C run-time settings.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
With the MFC class CEdit it is possible to receive notification messages for EN_UPDATE (for when the control is about to display altered text) and EN_CHANGE (for when the control has finished the display of altered text).
Can anyone tell me how I can get notification to my dialog when the user is simply moving the cursor caret around inside the edit control and the text is not changing?
I am using a single line version of the CEdit control.
Your help would be greatly appreciated. If you need further information about what I am doing or in order to answer my question please leave a reply post here and I will answer back.
Thanks
Mike
|
|
|
|
|
You'd have to handle a variety of messages. WM_CHAR for characters; i believe this message is sent even if it's only a system key like a cursor key being pressed. Also, you'd want some mouse button messages... WM_LBUTTONDOWN or UP , for example. Because the user can reposition the cursor with a mouse click.
Jon
Sorry to dissapoint you all with my lack of a witty or poignant signature.
|
|
|
|
|
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
|
|
|
|