|
Use the ILC_MASK in addition to ILC_COLORxxx flag when creating the CImageList, and use the right Create method btw to pass the key color :
BOOL Create(
UINT nBitmapID,
int cx,
int nGrow,
COLORREF crMask
);
sometimes it helps to look at the IL generated code
a MS guy on develop.com "answering" .NET issues
|
|
|
|
|
I created my COM dll using MFC. Now i want to fire events from it. Can anyone tell me how. (i don't want to use ATL)
|
|
|
|
|
|
I'm having a problem getting a menu to display in a window.
This is a simple class assignment. I can get the thing to show up with Create but not CreateEx. Can someone tell me why? The debugger crashes when it reaches the m_btnAdd.Create function.
The error in the debugger window first show 0x00000579 which is an invalid menu handle.
The message that is displayed at crash is:
First-chance exception in CIS279_4.exe (MFC42D.DLL): 0xC0000005: Access Violation.
I have an .rc file where the menu is created and a header file with #define IDR_MAINMENU 3000.
CString strWndClass = AfxRegisterWndClass(CS_DBLCLKS, <br />
AfxGetApp()->LoadCursor(IDC_ARROW), <br />
(HBRUSH)(COLOR_3DFACE+1),<br />
AfxGetApp()->LoadIcon(IDI_ICON1));<br />
<br />
m_btnRect = CRect(0,0,80,30);
<br />
CreateEx(WS_EX_OVERLAPPEDWINDOW, strWndClass, _T("Jeff's Calculator"), <br />
WS_OVERLAPPEDWINDOW, m_rect, NULL, IDR_MAINMENU, NULL);<br />
<br />
m_btnRect.OffsetRect(85,100);<br />
m_btnAdd.Create(_T("&Add"), WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON, m_btnRect, this, ID_BTNADD);
My instructor has tried to help with no luck and the Prosise book and MSDN aren't specific enough. My instructor is accepting the assignment with the Create function instead so now I just have a burning desire to know.
Can anyone help?
Thanks
Jeff Patterson
Programmers speak in Code.
http://www.anti-dmca.org
|
|
|
|
|
It seems you've misinterpreted the 7th CreateEx argument. It isn't menu ID, it's menu *handle*. You need to create CMenu object, call CMenu::LoadMenu and pass the handle to CWnd::CreateEx.
In fact, the MSDN docs aren't clear on this, but quick loook at source reveals that nID parameter is cast to HMENU and passed to other CWnd::CreateEx overload, which in turn calls ::CreateWindowEx.
Tomasz Sowinski -- http://www.shooltz.com
*** Si fractum non sit, noli id reficere. ***
|
|
|
|
|
Thank you. After I figured out how to create that handle and changed the m_rect in the CreateEx to 0,0,640,480 it worked great.
This would have taken me many many hours to figure this out Thank you very much.
Jeff Patterson
Programmers speak in Code.
http://www.anti-dmca.org
|
|
|
|
|
i want to disable all those messages that are generated by the mouse and keyboard how to that untill my application is running?
and all those messages that my program send through
postmessage command must work ?
but the messages that are generated by mouse and keyboard should not work?
r00d0034@yahoo.com
|
|
|
|
|
Use a global hook
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
how to use it :
can u provide the linkk of any example where global hook is used?
or any helping metrial?
r00d0034@yahoo.com
|
|
|
|
|
I'm afraid all i've read about hooks has been from tiny numerous articles here and there across the NET and in some books I have.
In your MSDN look up the function SetWindowsHookEx
Cheers!
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
How do I add an MFC control (ie: CEdit) to a MDI child window? Note: I'm not using the Doc/View archictecture.
Thanks,
Dave
|
|
|
|
|
Use the controls Create() member function specifying your CView as the parent window.
If you have a lot of controls, consider using a CFormView .
CPUA 0x5041
Sonork 100.11743 Chicken Little
"So it can now be written in stone as a testament to humanities achievments "PJ did Pi at CP"." Colin Davies
Within you lies the power for good - Use it!
|
|
|
|
|
If I'm using the code below:
Connection CDataManDlg::CreateDBConnection()
{
Connection con (use_exceptions);
try {
con.connect ("fatapes", m_strHost, "root");
}
catch (BadQuery e) {
TRACE (_T ("Error in CreateDBConnect = %s"), e.error.c_str ());
MessageBox (_T ("Unable to create database connection"), _T ("Connection Error"));
}
return con;
} is the reason that I can't use the 'Connection' object after the return becuase it's destroyed? Doesn't the function return a copy of the object before it gets destoryed?
Thanks in advance.
- monrobot13
|
|
|
|
|
Modify your function to return a Connection* and remember to delete the pointer after usage, perhaps in a different member function named CloseDBConnection.
Or add a Connection member to your CDataManDlg class.
Regards,
Nish
Author of the romantic comedy
Summer Love and Some more Cricket [New Win]
Review by Shog9
Click here for review[NW]
|
|
|
|
|
Thanks for the help, it clarifies things for me.
- monrobot13
|
|
|
|
|
I have Windows XP with VC++ .NET. My program was using visual styles beautifully, until yesterday! Now my app looks like it does in Windows 98 I have absolutely no idea why it's not working, except that I was doing a little re-arranging in my resource.h. The xml file is still there, though. Could you walk me through the steps in enabling visual styles?
Thanks!
|
|
|
|
|
Do you still have the manifest file included in resources? If so, what's the ID of this resource?
Tomasz Sowinski -- http://www.shooltz.com
*** Si fractum non sit, noli id reficere. ***
|
|
|
|
|
If you are including the manifest as a resource, it must have resource ID 1.
"Think of it as evolution in action." - 'Oath of Fealty' by Larry Niven and Jerry Pournelle
|
|
|
|
|
AFAIR, there's an
#define CREATEPROCESS_MANIFEST_RESOURCE_ID 1
somewhere in SDK headers.
Tomasz Sowinski -- http://www.shooltz.com
*** Si fractum non sit, noli id reficere. ***
|
|
|
|
|
Thanks, that's probably my problem!
|
|
|
|
|
We have a big map here at work which is in a vector format, and we want to chop it up into subsections. The issue is that if a line intersects two crosssections, we'd like it to be drawn properly in both without any messing about.
Does anyone know of any tools/code that can easily do that ?
Thanks
Christian
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
During last 10 years, with invention of VB and similar programming environments, every ill-educated moron became able to develop software. - Alex E. - 12-Sept-2002
|
|
|
|
|
Is it the case that you simply need to cut larger lines
into smaller lines that cross no boundaries so that you
can easily assign lines to subsections?
Because of rendering considerations, a large line may
not be equivalent to a set of smaller lines. Does this
come into consideration?
|
|
|
|
|
I need to create accuracte subsections, including the subsections of a line that may not be entirely in the square I am creating.
Christian
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
During last 10 years, with invention of VB and similar programming environments, every ill-educated moron became able to develop software. - Alex E. - 12-Sept-2002
|
|
|
|
|
Can anyone recomend a good free WinHelp authoring tool?
Asim Hussain
e: asim@jawache.net
w: www.jawache.net
|
|
|
|
|