|
Whats your application type?
|
|
|
|
|
I'm using Visual Studio .NET 2003 Professional (C++). I've created a Windows Form.net that has fields and buttons on the form. I've created a data file and as records are read the TextBoxes on the form are populated. The cursor property of the Form is set to the "No" cursor. Before I open the data file the cursor displays as No everywhere on the form exept over the Open button where I have it display as the hand cursor. Whenever I move to another record the cursor changes to the arrow/default? cursor again. However if I click anywhere on any "empty" area of the form the cursor changes to No which is how I want it to be displayed unless the user clicks the Edit button.
The help or line of code I am looking for is one that simulates the user clicking somewhere on the form to change the cursor to display the No symbol.
I would insert that code after the record is read to change the cursor to No.
Thanking you in advance for your help and time.
|
|
|
|
|
I asked for application type because I wanted why you got this error but anyway see
See Mouse Input
[^] is helpfuls for you
|
|
|
|
|
Thanks for the suggestion of Mouse Input.
I incluced "windows.h" and I tried the following line of code without success.
MOUSEINPUT(0, 0, 0, MOUSEEVENTF_LEFTDOWN, 0, 0);
I find it difficult understanding Microsoft's documentation as I am a newbie.
Could you please help me out?
Thanking you in advance for your help and time.
|
|
|
|
|
|
Another way to do this is by using the mouse_event() API call. This is more useful if you want to synthesise some more complex mouse movements, and it takes these as parameters. Take a look at the documentation on MSDN for more.
MSDN also states that for Windows NT/2000/XP/Vista, mouse_event() has been superseded by SendInput() instead. Have a look at the MSDN documentation for this also.
Hope this helps!
--PerspX
|
|
|
|
|
Hello,
I was running just fine until I put on a support pack today. I don't know whether this error is related, since I am having the issue on two different computers.
When I attempt to compile a VC++ .exe, I am now getting this error:
general error c101008a: Failed to save the updated manifest to the file ".\release with tnc\xsupptray.exe.embed.manifest"
Anybody ever seen this error? Any idea what might be causing it?
BRC
Brc
|
|
|
|
|
Nothing like answering my own question.
I did a Clean on the projects in question, and the problem went away.
Just in case someone ever sees this. Now you know what to do.
BRC
|
|
|
|
|
|
i have a simple findfile program the problem i have is some files i have are very large 12 gig each anything under 4 gig and it has the right size over 4 gig and its wrong ive tryed everything i can think of but nothing is working i know it can be done im just doing something wrong can anyone help?
|
|
|
|
|
It's simple
for number > 4 Gb, you need a 64 bit integer, it consists of two 32 bit integer: low bit and high bit
DWORD GetFileSize(
HANDLE hFile, // handle of file to get size of
LPDWORD lpFileSizeHigh
// pointer to high-order word for file size
);
use this function to get file size, it returns the low word of file size. lpFileSizeHight will store the high bytes of file size.
|
|
|
|
|
I'm trying to make a MFC control that will show a pie graph. I've got most of the work done, but I don't know how to go from having a class to "creating" the control on the main window. I also keep getting debug assertions which I did not get when I implemented the same code in the main CFrameWnd class. I'm guessing that's because it won't give me access to the device contexts or something in a regular class. I don't know. Any help would be appreciated.
I'm using CWnd as a base class. Basically I have two bitmaps (m_pieBitmap and m_textBitmap) which are selected into two CDCs (PieMemDC and TextMemDC). When the pie graph and text need to be updated, they are redrawn onto the bitmaps. Both are blitted onto CPaintDC in OnPaint in the control's class.
Here is the header for CPieGraph (the control's class):
class CPieGraph : public CWnd
{
public:
CPieGraph();
~CPieGraph();
void InitPieChart();
void SetPieChart(PieGraphDisplayType & PieGraph);
void ResetPieChartAngle(int Angle);
protected:
private:
void InitDCObjects();
void RedrawPieChart();
void RedrawPieText();
PieGraphDisplayType MainPieGraph;
CDC PieMemDC;
CDC TextMemDC;
CBitmap* OldpieBitmap;
CBitmap* OldtextBitmap;
CBitmap m_pieBitmap;
CBitmap m_textBitmap;
CBrush CombinedBrush;
CBrush TargetBrush;
CPen BlackPen;
CFont OutputFont;
afx_msg void OnPaint();
afx_msg BOOL OnEraseBkgnd(CDC* pDC);
DECLARE_MESSAGE_MAP()
};
Some of the class code:
CPieGraph::CPieGraph()
{
InitPieChart();
InitDCObjects();
OldpieBitmap = PieMemDC.SelectObject(&m_pieBitmap);
OldtextBitmap = TextMemDC.SelectObject(&m_textBitmap);
}
CPieGraph::~CPieGraph()
{
PieMemDC.SelectObject(OldpieBitmap);
TextMemDC.SelectObject(OldtextBitmap);
m_pieBitmap.DeleteObject();
m_textBitmap.DeleteObject();
}
void CPieGraph::InitPieChart()
{
CRect ClientArea;
GetClientRect(&ClientArea);
MainPieGraph.origin.SetPoint(static_cast<int>(ClientArea.right / 1.5),
static_cast<int>(ClientArea.bottom / 2));
MainPieGraph.angle = 0;
MainPieGraph.PieGraphIsActive = false;
MainPieGraph.radius = 100;
MainPieGraph.data.denominator = 0.0;
MainPieGraph.data.numerator = 0.0;
MainPieGraph.data.ratio = 0.0;
}
void CPieGraph::InitDCObjects()
{
CDC pDC;
VERIFY(OutputFont.CreateFont(16, 0, 0, 0, FW_NORMAL, FALSE, FALSE, 0, ANSI_CHARSET,
OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY,
DEFAULT_PITCH | FF_SWISS, "Arial"));
BlackPen.CreatePen(PS_SOLID, 2, RGB(0, 0, 0));
TargetBrush.CreateSolidBrush(RGB(95, 158, 160));
CombinedBrush.CreateHatchBrush(HS_DIAGCROSS, RGB(47, 79, 79));
m_pieBitmap.CreateCompatibleBitmap(&pDC, 600, 600);
m_textBitmap.CreateCompatibleBitmap(&pDC, 100, 10);
}
void CPieGraph::RedrawPieChart()
{
ASSERT((MainPieGraph.radius * 2) < 600);
CBrush* OldBrush = NULL;
CPen* OldPen = NULL;
int Angle = 0;
if(MainPieGraph.PieGraphIsActive)
Angle = MainPieGraph.angle;
else
Angle = 0;
PieMemDC.BeginPath();
OldBrush = PieMemDC.SelectObject(&TargetBrush);
OldPen = PieMemDC.SelectObject(&BlackPen);
PieMemDC.MoveTo(MainPieGraph.radius, MainPieGraph.radius);
AngleArc(PieMemDC, MainPieGraph.radius, MainPieGraph.radius, MainPieGraph.radius, 0.0, static_cast<FLOAT>(Angle));
PieMemDC.LineTo(MainPieGraph.radius, MainPieGraph.radius);
PieMemDC.EndPath();
PieMemDC.StrokeAndFillPath();
PieMemDC.SelectObject(OldBrush);
PieMemDC.BeginPath();
OldBrush = PieMemDC.SelectObject(&CombinedBrush);
PieMemDC.MoveTo(MainPieGraph.radius, MainPieGraph.radius);
AngleArc(PieMemDC, MainPieGraph.radius, MainPieGraph.radius, MainPieGraph.radius, ((360-Angle)*-1), 360-Angle);
PieMemDC.LineTo(MainPieGraph.radius, MainPieGraph.radius);
PieMemDC.EndPath();
PieMemDC.StrokeAndFillPath();
PieMemDC.SelectObject(OldPen);
PieMemDC.SelectObject(OldBrush);
}
afx_msg void CPieGraph::OnPaint()
{
CPaintDC dc(this);
dc.BitBlt(MainPieGraph.origin.x - MainPieGraph.radius,
MainPieGraph.origin.y - MainPieGraph.radius - 10,
100, 10, &TextMemDC, 0, 0, SRCCOPY);
dc.BitBlt(MainPieGraph.origin.x - MainPieGraph.radius,
MainPieGraph.origin.y - MainPieGraph.radius,
MainPieGraph.radius * 2,
MainPieGraph.radius * 2, &PieMemDC, 0, 0, SRCCOPY);
}
afx_msg BOOL CPieGraph::OnEraseBkgnd(CDC* pDC)
{
return TRUE;
}
Class where CPieGraph is decleared:
class CRatiosWin : public CFrameWnd
{
public:
CRatiosWin();
~CRatiosWin();
...
protected:
private:
CRatiosNewSearchDialog NewSearchDialog;
CRatiosSearchTimeParameters TimeParametersDialog;
CStudentCourseLinkedList TestLinkedList;
CPieGraph PieGraph;
CDC logo_memDC;
CBitmap LogoOffScreenBmp;
CBitmap* OldLogoBitmap;
CEdit ResultsBox;
CPoint LogoOffSet;
CPoint TextOffSet;
...
}
|
|
|
|
|
Hi there,
did you actually create your PieChart control. If you did, can you post the location of your debug assertions?
Best regards
|
|
|
|
|
You haven't shown how you create your memory DCs. I'm assuming you haven't, so they are invalid
when you initialize them in your constructor.
CWnd window objects are created in two steps - 1 to create the C++ object, and the second to
create the associated window object (HWND). You can't do anything requiring an HWND until the
HWND is valid. Any time in or after the WM_CREATE notification is received is fine.
OnCreate() is where you should be doing the initialization you've shown in your constructor
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Dear All;
How can i convert a dll into a lib ?
Cheers
llp00na
|
|
|
|
|
llp00na wrote: How can i convert a dll into a lib ?
I think you can do it with the linker. Read the linker documenation in MSDN for the specifics
|
|
|
|
|
How can you do that? can you please supply a link because i tried looking for it and did not succeed.
LINK uses the following types of input files:
* .obj files
* .lib files
* .exp files
* .def files
* .pdb files
* .res files
* .exe files
* .txt files
* .ilk files
Thanx
llp00na
|
|
|
|
|
You can't create a static link library from a DLL. Do you mean create an import library from a
DLL? If so, if you have the source code to build the DLL, then you can set up your project to
create the lib when the dll is built. If you need an import library for a DLL that you DON'T
have the source for, try How To Create 32-bit Import Libraries Without .OBJs or Source[^]
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
I created a new project using the MSVS2005 wizard.
Modified my CView class to be able to print text, and it works all cool.
If I put in the CView class code to add lines to my array of strings, it will print it like I want on the screen.
I want to be able to access functions I wrote for my CView class, from my CWinApp class.
But when I try, it given an "... Access Violation reading location:...".
I understand that this happens because the CView class makes its own thread, and works in it, while the CWinApp is in another.
But I can't figure out what to change/add/remove to make it work...
Any ideas?
|
|
|
|
|
I understand that this happens because the CView class makes its own thread, and works in it, while the CWinApp is in another.
No. CView does not make its own thread. There is a single thread in a standard MFC application unless you specify your own threads. CWinApp makes the primary thread, so called UI thread and, particularly, CView object is created there.
Try the following code to access the view. Do not call this code before InitInstance method because InitInstace should have created the view (frame and doc as well) before any attept to use it [view].
CMyView *pView = (CMyView * ) ((CFrameWnd *)AfxGetMainWnd())->GetActiveView();
--
=====
Arman
|
|
|
|
|
I am using a small bitmap (10x15) on a dialog resource that shows up as a different color than black (a lighter shade of black, actually) on a different monitor. Both monitors have the same screen settings and both are running Windows 2000. Other resources on that dialog display as black on one monitor and the same on the other monitor. Anyone have any ideas how to possibly correct this anomaly?
Thanks.
John P.
|
|
|
|
|
Palette?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
If I look at the bitmap in a 'paint' program, the color looks fine (on the PC where the color on the dialog looks different). I don't believe the pallettes are different, but it's worth looking into I guess.
thanks.
John P.
|
|
|
|
|
As cpallini mentioned - a palette can be necessary depending on the pixel format/bit-depth of
the bitmap and how you are drawing it.
So, how is the bitmap being drawn and what format is it?
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
The bitmap is being used by other owner-drawn dialogs and the color is fine. The bitmap is 10x10 pixels and is suppose to represent a 'phillips screw'. I use this bitmap in a non-owner drawn dialog as a static resource placed in specific locations on the dialog. I can not find a specific palette withing the project. All colors have been defined withing include files. When viewed on my PC at my desk, there is no change in color on this bitmap when I use them as static controls on the dialog. On the PC where the application is actually used, this bitmap is displayed in a color that is not as deep a black color as found on the desk PC. And as previously mentioned, the screen attributes are the same on both PCs and both run Windows 2000. So, the confusion remains as to why the bitmap shows up as two different shades of black. Any ideas why?
Thanks.
John P.
|
|
|
|
|