|
Original post mentions that both .cpp and .h are parts of project.
Tomasz Sowinski -- http://www.shooltz.com
To some its a six-pack, to me it's a support group
|
|
|
|
|
No i mean in the header file you should
#include "poo.cpp",
Asim Hussain
e: asim@jawache.net
w: www.jawache.net
|
|
|
|
|
Now I got what do you mean. Yes, this may have been the problem
Tomasz Sowinski -- http://www.shooltz.com
To some its a six-pack, to me it's a support group
|
|
|
|
|
1) since CP forum code strips triangle brackets by default, use 'display this message as-is (no HTML) option. I'm not sure if your CDblyXXx classes are actually templates (probably they are).
2) you can't link DLL or EXE?
Tomasz Sowinski -- http://www.shooltz.com
To some its a six-pack, to me it's a support group
|
|
|
|
|
Anonymous wrote:
The declaration was in a .h file, and implementation was in a .cpp file.
That's the problem. Due to a limitation of templates, template code has to be visible in all CPP files, so move the code to your header file.
--Mike--
Just released - RightClick-Encrypt v1.4 - Adds fast & easy file encryption to Explorer
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
|
|
|
|
|
Sir, I want to make new CSocket object from SOCKET type variable. This SOCKET variable is associated with open socket connection. How can I do it?? would you please help me.......
C.R.Naik
|
|
|
|
|
|
Hi all,
I have a VC module that processing DB on SQL Server and will return a result (number, string,..). Can I rewrite that module so that it can be called from an ASP page on IIS as a function ? How will I do it?
Thanks for your help
|
|
|
|
|
Depends on the complexity of the module. You could write the code again in ASP using ADO to access the database. Or you could wrap your module as an ATL COM component.
Michael
Programming is great. First they pay you to introduce bugs into software. Then they pay you to remove them again.
|
|
|
|
|
I would like to load a bitmap file and print it.
I need also to view it in the print preview.
Can anyone send me a simple MFC sample for that?
Thanks,
Dudi
|
|
|
|
|
A lot of the code you need to do this can be found in my article PrintingTricksAndTips[^].
You will need to add the bitmap loading code from resources and convert it to a DIB in your OnBeginPrinting() and destroy it in your OnEndPrintig(). And StretchDIBBits() it in your OnPrint().
Roger Allen
Sonork 100.10016
I think I need a new quote, I am on the prowl, so look out for a soft cute furry looking animal, which is really a Hippo in disguise. Its probably me.
|
|
|
|
|
Has anyone noticed that the selecting values with a mouse from the Windows slider control is quite awkward?
In my opinion Microsoft implemented the right click action wrong. For example, if you have a slider control with 5 values and the ticks are marked 1,2,3,4,5, if the slider is currently at tick number 1 and you click on the "4" you would expect the slider thumb directly move to 4, right? Well, what happens is that it moves to "2". This is because it interprets the click as a "page down" command. While this is appropiate for a scrollbar, it certainly is not the right action for a slider. Look at any other non Microsoft slider control(for instance the volumn control in WinAmp) - the thumb moves directly where you have clicked behave in the correct way.
|
|
|
|
|
You COULD subclass and handle WM_(H/V)SCROLL, check for mouseclick and implement the behaviour yourself.
If you do, be sure to post your code here - I am greatly interested
|
|
|
|
|
In fact I already have done this. I just copied this from the round slider project (by Daniel Frey) and removed the drawing code...
class CNiceSliderCtrl : public CSliderCtrl
{
public:
DECLARE_DYNAMIC(CNiceSliderCtrl)
CNiceSliderCtrl() : m_bDragging(false), m_bDragChanged(false) {}
protected:
//{{AFX_MSG(CRoundSliderCtrl)
afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
afx_msg void OnMouseMove(UINT nFlags, CPoint point);
afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
private:
bool SetThumb(const CPoint& pt);
void PostMessageToParent(const int nTBCode) const;
bool m_bDragging;
bool m_bDragChanged;
};
#include "stdafx.h"
#include "NiceSlider.h"
IMPLEMENT_DYNAMIC(CNiceSliderCtrl, CSliderCtrl)
BEGIN_MESSAGE_MAP(CNiceSliderCtrl, CSliderCtrl)
//{{AFX_MSG_MAP(CNiceSliderCtrl)
ON_WM_LBUTTONDOWN()
ON_WM_MOUSEMOVE()
ON_WM_LBUTTONUP()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
void CNiceSliderCtrl::OnLButtonDown(UINT nFlags, CPoint point)
{
m_bDragging = true;
m_bDragChanged = false;
SetCapture();
SetFocus();
if (SetThumb(point))
{
m_bDragChanged = true;
PostMessageToParent(TB_THUMBTRACK);
}
}
void CNiceSliderCtrl::OnMouseMove(UINT nFlags, CPoint point)
{
if (m_bDragging)
{
if (SetThumb(point))
{
m_bDragChanged = true;
PostMessageToParent(TB_THUMBTRACK);
}
}
else
{
CSliderCtrl::OnMouseMove(nFlags, point);
}
}
void CNiceSliderCtrl::OnLButtonUp(UINT nFlags, CPoint point)
{
if(m_bDragging)
{
m_bDragging = false;
::ReleaseCapture();
if (SetThumb(point))
{
PostMessageToParent(TB_THUMBTRACK);
m_bDragChanged = true;
}
if (m_bDragChanged)
{
PostMessageToParent(TB_THUMBPOSITION);
m_bDragChanged = false;
}
}
else
{
CSliderCtrl::OnLButtonUp(nFlags, point);
}
}
bool CNiceSliderCtrl::SetThumb(const CPoint& point)
{
const int nMin = GetRangeMin();
const int nMax = GetRangeMax()+1;
CRect rc;
GetChannelRect(rc);
double dPos;
if (GetStyle() & TBS_VERT)
{
dPos = (double)(point.y - rc.top)/(rc.bottom - rc.top);
}
else
{
dPos = (double)(point.x - rc.left)/(rc.right - rc.left);
}
double dCorrectionFactor = 0.5 *(1-dPos) - 0.5 *dPos;
int nNewPos = nMin + (nMax-nMin)*dPos + dCorrectionFactor;
const bool bChanged = (nNewPos != GetPos());
if(bChanged)
{
SetPos(nNewPos);
}
return bChanged;
}
void CNiceSliderCtrl::PostMessageToParent(const int nTBCode) const
{
CWnd* pWnd = GetParent();
if(pWnd) pWnd->PostMessage(WM_HSCROLL, (WPARAM)((GetPos() << 16) | nTBCode), (LPARAM)GetSafeHwnd());
}
|
|
|
|
|
In the Windows Date/Time Properties dialog under the Time Zone tag, there is a list control with a bunch of time zones. I'm sure you've all seen it before.
Q: Is it possible to programmatically access and enumerate that list?
Thanks,
Jon Sagara
Red Swingline Staplers
|
|
|
|
|
Hi!
The timezones are in the registry. Unfortunally under different keys depending on which Windows version you are running. On NT it's under :
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones
On Windows 05/98:
On windows 2000 and windows XP I have no idea, but you could search for Time Zones in the registry ...
You can then use RegEnumKeyEx() to loop thru all subkeys.
Mike Eriksson
Sonork 100.21825
|
|
|
|
|
Of cause I let the message slip away to soon
On Win 95/98
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Time Zones
Mike Eriksson
Sonork 100.21825
|
|
|
|
|
|
I need to install a device driver (self-developed)
in order to allow all system user to use it.
Which is the way ?
Thanks a lot!!!
|
|
|
|
|
Hi
Does anyone know how to print from a VC++ program into a file (not to printer) without the user being required to enter the name of the file at print time
Thanks a lot
xxx
|
|
|
|
|
If you goto the code in ViewPrnt.cpp lines 131 onwards, you can get a copy of the default MFC OnFilePrint() function. Copy this and paste it into your overriden OnFilePrint() function of your view class. You can then mode the code so that it prints directly to a file and deosn't request a filename from the user.
Roger Allen
Sonork 100.10016
I think I need a new quote, I am on the prowl, so look out for a soft cute furry looking animal, which is really a Hippo in disguise. Its probably me.
|
|
|
|
|
I have added a menu to my Dialog based app. I wanted to be able to set check marks based on a bool. So what I did was Added functionality to UPDATE_COMMAND_UI. I then call pCmdUI->SetCheck( m_bTest ? 1 : 0 ). I expect that when the bool value changes the check comes and goes. But alas this is NOT the case. Whatever I am not doing also causes all other pCmdUI-> commands to fail. Is this something that cannot be done in a dialog app? I think not. I just don't know what I am forgetting. It looks like the second least talked about item is menues, second to printing. Oh, I know the functions are being called, at least the UPDATE_COMMAND_UI is, based on MessageBox(""); So what ever I am missing has something to do with updating the menu. I have looked at examples and cannot find anything wrong with my function calls. ANY help is apreciated.
Darroll Walsh
Not one person lives in the present. Only the past. I can prove it. Just ask.
|
|
|
|
|
UPDATE_COMMAND_UI is not working in dialogs by default. I can not think of why MS did disable their control updating system in dialogs, but well - there are a lot of weird design flaws in MFC.
What I do im my dialogs (modal in a Doc/view-application, but should also work for dialog-based app) is to handle WM_KIKIDLE:
//called by MFC if 'nothing else to do'.
//Used to send a UPDATE COMMAND_UI-Message to all controls
// thereby simulating the menu-update system via UPDATE_COMMAND_UI messages
// Reference: Paul DiLascia in C++Q&A column
LRESULT CAdvProcDlg::OnKickIdle(WPARAM, LPARAM)
{
UpdateDialogControls(this, false);
return 0;
}
This is working like a charm. Some people complain about using up the processor, but I cant see it.
Hope this helps
|
|
|
|
|
OK I handle the ON_KICKIDLE. But the pCmdUI functions still fail to do anything.
Can I handle a dialog app menu in UPDATE_COMMAND_UI or do I manually need to retrieve the menu with a CMenu class? I hope not.
Thanks for the help.
Darroll
|
|
|
|
|
Maybe you find better help here.[^]
|
|
|
|