|
I write these below program to draw a rectangle which have black frame. In the rectangle have 4 red points and I draw the line between 2 point. So I get the result as this picture
http://www.geocities.com/ooosawaddee3/pic/PointPicture.jpg
In the picture the red point is very small and the line between point is not exactly straight. I want the larger red point and straight line. Do you know how to do that?
pDC->SetMapMode(MM_TEXT);<br />
<br />
pDC->FillSolidRect(origin.x, origin.y, 2000, 2000, RGB(255,255,255));<br />
<br />
int cx = 5;<br />
int cy = 5; <br />
<br />
CPen pen, pen2;<br />
pen.CreatePen(PS_SOLID,2, RGB(0,0,0));<br />
<br />
pDC->SelectObject(&pen);<br />
<br />
pDC->Rectangle(cx,cy,(cx +256), (cy + 192));<br />
pDC->SetPixel(45,10, RGB(255,0,0));<br />
pDC->SetPixel(47,9, RGB(255,0,0));<br />
pDC->SetPixel(79,45, RGB(255,0,0));<br />
pDC->SetPixel(46,120, RGB(255,0,0));<br />
<br />
pen2.CreatePen(PS_SOLID,1, RGB(0,0,255));<br />
<br />
pDC->SelectObject(&pen2);<br />
pDC->MoveTo(45,10);<br />
pDC->LineTo(79,45);
|
|
|
|
|
The image link is 404.
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
ooosawaddee3 wrote:
pDC->SelectObject(&pen2);
pDC->MoveTo(45,10);
pDC->LineTo(79,45);
This won't draw a straight line, for a straight line, either the x or y needs to stay the same.
Your rectangle is straight - it has to be.
Christian
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
hi, just want to capture WM_KEYDOWN for my editbox. yes, it doesnt support WM_KEYDOWN...
so, i guess the only way for this to work is to subclass a editbox control, inherit from both editbox and dialog class?
is this feasible? is there better alternative?
thanks a bunch.
norm
|
|
|
|
|
Hi..
1. Subclass CEdit class. Say CMyEdit.
2. Now map the message WM_GETDLGCODE (OnGetDlgCode())
3. Return DLGC_WANTALLKEYS for the mapped function.
4. Now u will get the key down messages.
Regards,
Rejeesh
|
|
|
|
|
class TaskInfoBase {
....
virtual void setSize(int) = 0;
};
class NewTaskInfo : public TaskInfoBase {
NewTaskInfo() { InitializeCriticalSection(&m_cs); }
~NewTaskInfo() { DeleteCriticalSection(&m_cs); }
void setSize(int);
static CRITICAL_SECTION m_cs;
};
class NewTask : public NewTaskInfo, pubic NewTaskBase {
};
class HttpDownload : public DownData , public CHttpDown {
public:
HttpDownload():NewTaskInfo() {}
void write();
NewTask *m_pTask;
};
//******************************************************************************
// Implement
CRITICAL_SECTION NewTaskInfo::m_cs;
void NewTaskInfo::setSize(int i)
{
EnterCriticalSection(&m_cs); // Exception here .
m_nSize = i;
LeaveCriticalSection(&m_cs);
}
void HttpDown::write()
{
....
m_pTask->setSize(20002); // Enter NewTaskInfo::setSize();
}
|
|
|
|
|
I would guess that the m_pTask pointer doesn't point to a valid NewTaskInfo object. If that's the case, the this pointer on entry to the setSize function isn't valid, and the resulting m_cs member passed to the EnterCriticalSection function doesn't represent a valid critical section.
Software Zen: delete this;
|
|
|
|
|
I cannot remember how to implement the code in a program that I am writing over here, to check the machine to see if the correct amount of RAM is installed and available in order for my program to run.
Basically, what I am after is something such as this:
1. To check to see if there is enough memory for my program to run.
2. If there is not enough memory available, or installed for it to return with an error saying, "not enough memory, please upgrade your memory or close existing applications that are running".
3. Then close if the program can not be initialized.
I've done this with I believe, 7 lines of code previously. I am using Visual C++ 6.0 and Visual C++ .NET; rarely Visual C++ 4.0 -- but I think this could be used on all three of these suites.
I would greatly appreciate any help and response to this message and helping me out with my problem.
|
|
|
|
|
Try
GlobalMemoryStatus()
or
GlobalMemoryStatusEx()
Gero
|
|
|
|
|
I'm looking for something more along the lines of having the program check to see if there is a certain amount of RAM available, say I want the program to have 64 MB of ram available for it to run, it will -- otherwise, anything lesser it would terminate. I would like this to be hard coded; but I cannot remember it though. I'll check out what you sent me and see what I can get out of that.
|
|
|
|
|
The MEMORYSTATUS structure you pass to GlobalMemoryStatus() contains dwTotalPhys and dwAvailPhys. dwTotalPhys contains the total amount of physical RAM and dwAvailPhys should contain the amount of FREE physical RAM. You can also use dwMemoryLoad to query the memory load in percent.
Hope this helps,
Gero
|
|
|
|
|
i am writing a small program that uninstall a com server i wrote earlier.
cleaning the registry is no problem. The problem lies in the start menu. One item on my application's start menu is "Uninstall.exe".
launch "Uninstall.exe" cleans the registry. But how can it delete itself to remove all items from start menu?
do i have to put uninstall in a different directory besides start menu?
thanks.
norm
|
|
|
|
|
|
does "InstallShield" does UN-installation for you? I did read up a little on InstallShield. Didnt know that it does uninstallation for u...
I figured it's pretty simple matter of registering a server, a few entries in registry and copying a few files to the client machines.
anyway, INstallation is done.
It's UN-installation where i'm having problem now.
Thanks.
norm
|
|
|
|
|
|
anyway, my installer/uninstaller has just been completed =)
well, at least the beta version. the licening module is missing, but the baby is ready for beta testing.
since i am pretty much the guy responsible for this part, any suggestion will be greatly appreciated
as for licencing, it's pretty standard architecture. user enter a number at the installer. the installer writes the licence number (encrypted-symmetric key) in registry. Everytime the COM server runs, it loads a licence list from disk - content of which is also encrypted. Then the COM server compare the entry in registry (user entered it to registry earlier) and search the list and see if can find a match. if it does, bingo. if it doesnt, the COM server will refuse any call.
the one big problem is: u have a static licence list sitting on the disk drive. it's encrypted. but the fact that it's static means that at one point u may run out of licence number from the list.
thanks!
norm
|
|
|
|
|
Hi, new to the C++ language, and trying to write a small program that will allow for a number input and be able to tell if it is numeric or something else. IE input number 1 - will accept, input a letter B will bomb out. Got the if then statement, but cannot figure out the rest. If someone can give me a hit it would be appreciated!
Thanks a bunch.
|
|
|
|
|
|
Cool - I did not know that. I've been using isalpha and isalnum to figure it out.
Christian
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
Christian Graus wrote:
Cool - I did not know that. I've been using isalpha and isalnum to figure it out.
I am absolutely ecstatic and delighted about the fact that I now belong to that sparsely populated club of people who can lay claim to having taught Christian Graus something about the C/C++ run time library.
Nish
Author of the romantic comedy
Summer Love and Some more Cricket [New Win]
Review by Shog9
Click here for review[NW]
|
|
|
|
|
*grin* It's not that sparse, especially when it comes to the C run time library.
Christian
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
Dear Everyone,
First of all,I would like to apologize for posting question
that may not be related to this forum.
I have been working on PocketPC email client software for quite
along time.Eventhough there are many examples on SMTP classes for Windows
(Visual C++) but until now, I still can't find a SMTP class for PocketPC(Embedded Visual C++ 3.0).Besides that, I heard that PockePC doesn't suppport
smtp feature.Is that true?However, there is a software which I think, uses smtp to send email.Please refer to
http://www.talksender.com/product/download/index.html
for details.
I am thinking of creating my own mailing software(just for sending only)
on PocketPC.Does anyone have any idea or suggestion on this topic?
I would be glad to hear anything for all of you.
Thanks you very much.
From Joji.
Joji
|
|
|
|
|
You can use sockets on the Pocket PC, and then you can also make a SMTP program, because it uses sockets to talk to a SMTP server.
If you don't wanna write all the SMTP stuff yourself, I guess that a lot of the samples you can find also works in eMbedded Visual C++.
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
I have a class which manages byte buffers and TCHAR buffers. The class has an Initialize method which is used to allocate a new buffer (or use an existing one of suffecient size) of bytes or TCHARs. The buffer it allocates is always at least as big as the size requested. What I want to do is insure that the buffer allocated is allocated page and byte aligned.
What is the page size for x86 platform? Is it 4K??? Is this the correct way to deal with this?
int CMyBuffer::Initialize(const long lRequestedSize)
{
int iReturn = NO_ERROR;
long lAllocSize = (lRequestedSize + (lRequestedSize % 4000));
.. bla bla bla ...
return iReturn;
}
|
|
|
|
|
The page size if usually 4KB, though you can get 4MB (8MB?) pages also.
The way you deal with this is often a combination of VirtualAlloc , and common sense.
Besides, your faulty assumption that 4KB == 4000 bytes displays you don't really know computers yet. I (in a friendly way) suggest you study some more binary arithmetics, and perhaps CS in general.
|
|
|
|
|