|
|
This may be overly simple, but the solution has eluded me and research has come up with nothing.
I have a CView derived class. This class's only job is to display nothing. I'd like to insert the text: "There is no data to display in this view" in the view. Centered, at the top.
I know I have to override OnDraw. I know I have to use TextOut. How do I get the text to use the system font, and center it?
Thanks!
Frank
"Keyboard Error - Press F1 to Continue"
|
|
|
|
|
CGdiObject * pOldFont = pDC->SelectStockObject(DEFAULT_GUI_FONT);
CString s;
s.LoadString(IDS_NOPICTURE);
CRect rcClient;
GetClientRect(rcClient);
CPoint center = rcClient.CenterPoint();
pDC->SetBkMode(TRANSPARENT);
pDC->SetTextAlign(TA_CENTER | TA_BASELINE);
pDC->TextOut(center.x, center.y, s);
if (pOldFont) pDC->SelectObject(pOldFont);
|
|
|
|
|
Yes! Thank you very much.
"Keyboard Error - Press F1 to Continue"
|
|
|
|
|
I have a derived CListCtrl in which I handle a double click event, but I need to find out which item was clicked on (if any).
From the function below is there any way I can get mouse coordinates from HMHDR??? I need to pass this info onto HitTest() but it doesn't appear likely I can get mouse coordinates from the parameters below???
CListCtrl::OnDblclk(NMHDR* pNMHDR, LRESULT* pResult)
Should I use PeekMessage and get the coordinates of the mouse when the last message was fired off???
What method should I use?
Thanks
Cheers
The word of the day is legs, let's go back to my house and spread the word
|
|
|
|
|
If you look closely in the MSDN docs, you'll see that NM_DBLCLK for listviews, actually sends a NMITEMACTIVATE*. NMITEMACTIVATE* info = (NMITEMACTIVATE*)pNMHDR
(There's a NMITEMACTIVATE::iItem that'll interest you, I'm sure... )
--
Summer breeze makes me feel fine. Blowing, through the jasmine in my mind.
|
|
|
|
|
Ok, I am stumped here. I have an ActiveX COM dll written in VB6 that is returning an array of doubles. I am using the Class Wizard to import the typelib. so I can call a series of methods one of which returns array of doubles. The class wizard writes out both the .h and .cpp files for me, however it comments out the one method that is returning the array doubles saying:
I found a kb article telling me to use the ITypeLib viewer so I can manually write the method into the header and cpp files. This is where I am stuck. The ITypeLib viewer shows the method as such:
[id(0x60030004)]<br />
HRESULT GetNum([out, retval] SAFEARRAY(double)* );
Any help for writing the guts to make the InvokeHelper call would be much appreciated.
This is what I was initially trying:
SAFEARRAY* _Moses::GetNum()
{
SAFEARRAY* result;
InvokeHelper(0x60030004, DISPATCH_METHOD, VT_R8, (void*)&result, NULL);
return result;
}
TIA.
- Nick Parker My Blog
|
|
|
|
|
just a wild suggestion
try returning SafeArray of VARIANT instead of doubles
Might do something
C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do, it blows away your whole leg
|
|
|
|
|
Can anyone post an example of the ReadProcessMemory function in action, let's say I want it to read at offset 0x6FB74910
Thanks,
Michael
|
|
|
|
|
How do I size and create two columns in a ListBox?
X str1
X2 str2
.
.
Xx strx
|
|
|
|
|
Use a multi-column listbox...which is very limiting or use a CListCtrl .
Cheers
The word of the day is legs, let's go back to my house and spread the word
|
|
|
|
|
Is there any way to check for 64-bit and fix compatibility issues in a large .NET solution without generating thousands of warnings?
If _WIN64 *is not* defined, the Windows headers define many function parameters and return types as 32 bits, so I get warnings for all integer/pointer conversions involving those functions. For example, consider the following header functions:
inline void* GetWindowUserData (HWND hwnd)
{
return (void*) GetWindowLongPtr(hwnd, GWLP_USERDATA);
}
inline void* SetWindowUserData (HWND hwnd, void* data)
{
return (void*) SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)data);
}
These two alone generate the following warnings in *every* source file that includes this header (which is most of them in the solution):
..\Viewapi\Vapidlg.h(155) : warning C4312: 'type cast' : conversion from 'LONG' to 'void *' of greater size
..\Viewapi\Vapidlg.h(161) : warning C4244: 'argument' : conversion from 'LONG_PTR' to 'LONG', possible loss of data
..\Viewapi\Vapidlg.h(161) : warning C4312: 'type cast' : conversion from 'LONG' to 'void *' of greater size
If _WIN64 *is* defined, a huge number of warnings are produced that I cannot tie to anything in my source code. For example:
C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\atlmfc\include\atlalloc.h(342) : warning C4244: 'argument' : conversion from 'SIZE_T' to 'size_t', possible loss of data
loss of data
C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\atlmfc\include\atlalloc.h(382) : warning C4244: 'argument' : conversion from 'SIZE_T' to 'size_t', possible loss of data
C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\atlmfc\include\atlalloc.h(381) : while compiling class-template member function 'void *ATL::_ATL_SAFE_ALLOCA_IMPL::CAtlSafeAllocBufferManager<Allocator>::Allocate(SIZE_T)'
with
[
Allocator=ATL::CCRTAllocator
]
C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\atlmfc\include\atlconv.h(778) : see reference to class template instantiation 'ATL::_ATL_SAFE_ALLOCA_IMPL::CAtlSafeAllocBufferManager<Allocator>' being compiled
with
[
Allocator=ATL::CCRTAllocator
]
How can I reduce the number of spurious warnings so that I can fix the real issues?
Thanks in advance...
|
|
|
|
|
Please help!
I have successfully debugged remote processes by changing the debug
properties for my projects. However, I can only do this when I launch the
remote process from my local copy of Visual C++ .NET 2003. I have not been
able to attach the debugger to an ongoing process launched at the remote
machine. My understanding is that I should select "Tools > Debug Process"
and then set the "Transport" value and set "Name" to my remote machine. However, "Transport"
is set to "Default" and "Name" is set to my local machine, and both fields
are shown as static labels, not as edit controls or drop-down selection
lists. It's impossible to change their values!
Does anyone know why this is happening? How can I fix this issue? I've tried reinstalling VC++ with all components selected and I still have the same problem.
Thanks,
Silvio
|
|
|
|
|
I am starting to add an email interface to the MFC application. How do I know if I have MAPI installed for Lotus Notes mail client?
Elizabeth
|
|
|
|
|
I need help implementing an interface to send email out from a MFC application using our Lotus Notes mail server. I tried running the sample application NPP came with the Visual Studio. It always came up with an Outlook dialog. But I want to use our Lotus Notes mail server. Can you tell me where to add the mail server information. By the way, I looked at the sample code, there was no custom code for OnFileSendMail.
Elizabeth
|
|
|
|
|
Are you implying the use the Lotus mail client as the default Windows e-mail client?
Kuphryn
|
|
|
|
|
Does anybody know of what APIs I can use to enumerate the configured 'Location's in Windows Dialup Networking? I also need to know how to set the active location programmatically before I invoke a RasDial call...
Does anyone know of the APIs that handle this?
--
Russell Morris
"So, broccoli, mother says you're good for me... but I'm afraid I'm no good for you!" - Stewy
|
|
|
|
|
Lookup up the source code for RasDial.
Kuphryn
|
|
|
|
|
hi
how can i compare time part of datetime field in SQL, for exaple :
time of datetimefield between '12:24:36' and '18:50:25'
thank you
|
|
|
|
|
SELECT xxx FROM xxx WHERE datetimefield BETWEEN #01/01/1970 12:24:36# AND #12/31/2038 18:50:25# I had to do the opposite once where I wanted rows for a particular day, regardless of the time. I used:
SELECT xxx FROM xxx WHERE datetimefield BETWEEN #02/13/2004 00:00:00# AND #02/13/2004 23:59:59#
A rich person is not the one who has the most, but the one that needs the least.
|
|
|
|
|
Is there any resource on how to write document on MDI?
|
|
|
|
|
Plenty. A good starting point would be to search for CMultiDocTemplate .
A rich person is not the one who has the most, but the one that needs the least.
|
|
|
|
|
Hello Sir,
I have a application need get image from IE,
I want to implement drag/drop in this file,
for example, I visit a website, got a webpage,
there are some images in this page,
If I need this image, I drag this image to my application,
then my application will show this image.
I have some question about this list at below:
1.what kind of DROPEFFECT I need to return in OnDropOver(...), DROPEFFECT_LINK or DROPEFFECT_COPY?
2.how to show this image in OnDrop()?
Thanks
Vistac
|
|
|
|
|
Hi All,
Does anyone else notice that the Visual Studio .NET "Add Member Function" and "Add Member Variable" wizards insist on adding an extra #include line to the .cpp file? Every time I delete it, but every time I use the wizard it just keeps putting it back.
Example:
Before I use the wizard, these are the only includes:
#include "stdafx.h"
#include "OtherDlg.h"
After I use the wizard, it places the extra one like this:
#include "stdafx.h"
#include "OtherDlg.h"
#include ".\otherdlg.h"
Notice that I already have OtherDlg.h included, but in a different case. I'm wondering if anyone else experiences this, because it does it for me *every* time! Does anyone know what's going on and how to fix it?
Thanks!
--
Edward Livingston
(aka ExtraLean)
--
"I still maintain that seeing a nipple is far less disturbing than seeing someone get their brains blown out." -- Chris Maunder
|
|
|
|
|
Hi!
Can anyone tell me why in all old functions like my GetYrkeKategoriPtr() the tooltip 'CDatabase *CRecordset::m_pDatabase' are shown when cursor is over the variable m_pDatabase, but in all my newly added function like GetSystemPtr() it is not shown?
CRSAYrkeKategori* CSysDoc::GetYrkeKategoriPtr()
{
m_YrkeKatSet.m_pDatabase = GetDeDUDB();
return &m_YrkeKatSet;
}
CRSASystem* CSysDoc::GetSystemPtr()
{
m_SystemSet.m_pDatabase = GetDeDUDB();
return &m_SystemSet;
}
MSc Bertil Morefält
|
|
|
|