|
Christian Graus wrote:
If so, could you click on Tools/Macro and tell me if OneTimeInclude is in the list of macros?
It's empty, as I would expect. I'd expect this to include macros as in UI sequences I recorded, not macros as in #define BLAH blah
After several days of messing around with this macro deal, I finally figured it out. If you're interested, with no files open in VC++6 click on Tools\Macro, then click on Options/Loaded Files, and the "Add ins and Macro files" tab should be selected(if not select it). There is a macro called Sample which you should enable by clicking on the check box. Then click on Close. From then on when the Macro dialog box appears after you click on Tools\Macros, you can select Sample as the "Macro file:", and from the list you can choose OneTimeInclude. When you click on Run, the macro will add your preprocessor directives for you. There are also other sample macros that are probably useful.
Thanks for your help.
|
|
|
|
|
I have derived a dialog from CPropertyPage, then I have included a Groupbox control. Inside that control I have placed three Radio Buttons. I have enabled the GROUP option for the first one and leave the rest two as is. Now I want to to set and get the values of those Radio Buttons on runtime. For this I am reading some values from a File and setting the Radio Buttons based on those values.
The problem which I am getting is that, I could not find how to set the values of those remaining two Radio Buttons which were not set as GROUP. Because ClassWizard only maps the variable for the Radio Button for which I have set the GROUP option.
Anybody knows how to solve this and where I am lacking.
Thanks
The Phantom is Tracking Bullets.
|
|
|
|
|
when DDX goes to get the value for you, it will scan from the start of the Group to the control before the next control with the group flag set. so, only one radio button in a group needs the group flag set (and it must be the first button). so, even though they aren't included in the DDX statement, the DDX code will include them when it does its processing.
-c
When history comes, it always takes you by surprise.
|
|
|
|
|
Busisoft,
If the value of your variable is:
-1 then no buttons are selected.
0 then first radio button is selected.
1 then second radio button is selected.
2 then third radio button is selected.
It all happens automatically.
Art
|
|
|
|
|
Hi,
I'm programming some years, but I just started with the MFC. So I downloaded the Undo/Redo Demo, which helped me a lot. Now I tried to implement Scroll Bars. The vertical one does exactly what it should, but the horizontal one, em
In debug Mode (VC++ 6.0) the following happens:
At first everything works fine, both scroll bars work. When I try to create a new, or to open an existing document I get an "Debug Assertion Failed!" Error for File: wincore.cpp Line: 628
If I compile this as release I am able to create a new, or to open an existing document, but the horizontal scroll bar gets invisible.
I know its there; when I drag it it is visible. When I resize the window it gets visible,too. But after the next repaint of the window it disappears. The code for the vertical and the horizontal bar is exactly the same, but one bar works and the other...
I used the following code:
8< out of my View class definition
...
CScrollBar m_wndVScrollBar;
CScrollBar m_wndHScrollBar;
...
>8
8< And these are my scrlling functions
void CUndo_Redo_DemoView::OnInitialUpdate()
{
m_wndVScrollBar.Create(WS_CHILD|SBS_VERT,CRect(0,0,0,0),this,0x0000);
m_wndHScrollBar.Create(WS_CHILD|SBS_HORZ,CRect(0,0,0,0),this,0x0000);
CRect rc;
GetClientRect(rc);
// Fake a size message
OnSize(0,rc.Width(),rc.Height());
};
void CUndo_Redo_DemoView::OnSize(UINT nType, int cx, int cy)
{
CView::OnSize(nType, cx, cy);
if (::IsWindow(m_wndVScrollBar.m_hWnd))
{
RECT tmpRect;
CWnd::GetClientRect(&tmpRect);
int nLeft = cx - 20;
int nTop = 0;
int nRight = cx;
int nBottom = tmpRect.bottom-20;
SCROLLINFO si;
si.cbSize = sizeof(si);
si.fMask = SIF_RANGE | SIF_PAGE;
si.nMin = 0;
si.nMax = 1000;
si.nPage = 50;
// Position Scroll Bar
CRect rect(nLeft, nTop, nRight, nBottom);
m_wndVScrollBar.SetScrollInfo(&si,TRUE);
m_wndVScrollBar.MoveWindow(rect);
if (UINT(si.nMax) < si.nPage)
m_wndVScrollBar.ShowScrollBar(FALSE);
else
m_wndVScrollBar.ShowScrollBar(TRUE);
}
if (::IsWindow(m_wndHScrollBar.m_hWnd))
{
RECT tmpRect;
CWnd::GetClientRect(&tmpRect);
int nLeft = 0;
int nTop = tmpRect.bottom-20;
int nRight = cx-20;
int nBottom = tmpRect.bottom;
SCROLLINFO si;
si.cbSize = sizeof(si);
si.fMask = SIF_RANGE | SIF_PAGE;
si.nMin = 0;
si.nMax = 1000;
si.nPage = 50;
// Position Scroll Bar
CRect rect(nLeft, nTop, nRight, nBottom);
m_wndHScrollBar.SetScrollInfo(&si,TRUE);
m_wndHScrollBar.MoveWindow(rect);
if (UINT(si.nMax) < si.nPage)
m_wndHScrollBar.ShowScrollBar(FALSE);
else
m_wndHScrollBar.ShowScrollBar(TRUE);
}
}
int CUndo_Redo_DemoView::OnMouseWheel(UINT nFlags, short zDelta, CPoint pt)
{
if (zDelta > 0)
SendMessage(WM_VSCROLL,SB_PAGEUP,0);
if (zDelta < 0)
SendMessage(WM_VSCROLL,SB_PAGEDOWN,0);
return CView::OnMouseWheel(nFlags, zDelta, pt);
}
void CUndo_Redo_DemoView::OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
{
SCROLLINFO si;
si.cbSize = sizeof(si);
si.fMask = SIF_ALL;
m_wndVScrollBar.GetScrollInfo(&si);
switch (nSBCode)
{
case SB_TOP:
si.nPos = si.nMin;
break;
case SB_BOTTOM:
si.nPos = si.nMax;
break;
case SB_LINEDOWN:
si.nPos += 1;
break;
case SB_LINEUP:
si.nPos -= 1;
break;
case SB_PAGEUP:
si.nPos -= si.nPage;
break;
case SB_PAGEDOWN:
si.nPos += si.nPage;
break;
case SB_THUMBTRACK:
si.nPos = si.nTrackPos;
break;
}
si.fMask = SIF_POS;
m_wndVScrollBar.SetScrollInfo(&si,TRUE);
Invalidate();
CView::OnVScroll(nSBCode, nPos, pScrollBar);
}
void CUndo_Redo_DemoView::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
{
SCROLLINFO si;
si.cbSize = sizeof(si);
si.fMask = SIF_ALL;
m_wndHScrollBar.GetScrollInfo(&si);
switch (nSBCode)
{
case SB_LEFT:
si.nPos = si.nMin;
break;
case SB_RIGHT:
si.nPos = si.nMax;
break;
case SB_LINERIGHT:
si.nPos += 1;
break;
case SB_LINELEFT:
si.nPos -= 1;
break;
case SB_PAGERIGHT:
si.nPos -= si.nPage;
break;
case SB_PAGELEFT:
si.nPos += si.nPage;
break;
case SB_THUMBTRACK:
si.nPos = si.nTrackPos;
break;
}
si.fMask = SIF_POS;
m_wndHScrollBar.SetScrollInfo(&si,TRUE);
Invalidate();
CView::OnHScroll(nSBCode, nPos, pScrollBar);
}
>8
Thank you for reading this, I'm sure it's all my fault, but I'm just learning
Greetings,
Jakob Bysewski
Build a system that even a fool can use, and only a fool will use it.
|
|
|
|
|
Jakob Bysewski wrote:
When I try to create a new, or to open an existing document I get an "Debug Assertion Failed!" Error for File: wincore.cpp Line: 628
void AFXAPI AfxHookWindowCreate(CWnd* pWnd)
{
...
<font color="009900">628=></font> ASSERT(pWnd->m_hWnd == NULL);
This tells you that you are trying to recreate a window that already exists. The reason it appears to work, and then not work, in release builds is because a release build does not do any of the ASSERT() checks. It just continues on it's merry way assuming everything is valid.
It may be alot easier for you if you use a CScrollView derived view class. CScrollView has all the scrolling functionality already built in.
Sonork 100.11743 Chicken Little
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
Within you lies the power for good - Use it!
|
|
|
|
|
Thank you,
I really did not realize what this meant. Mmh, CScrollView, seems nice, I'll try it.
Build a system that even a fool can use, and only a fool will use it.
|
|
|
|
|
I'm new to VC and I was wondering if you can draw a CEdit control wich at first would be disabled, until the user pushes a button. I know I can set the disable state when I draw the control in the dialog, but after this how can i undisable it in, say a fuction OnButton1, considering there is no such member function in the CEdit class? Can it be done same way for a button?
Thanks for your time reading this!
|
|
|
|
|
GetDlgItem(IDC_EDIT)->EnableWindow(FALSE);
GetDlgItem(IDC_BUTTON)->EnableWindow(FALSE);
|
|
|
|
|
I have Visual C++.net standard edition.
Kann everyone tell me where I can find the Add-In Wizard?
At MSDN I can download a Wizard-Sample, but there was
no Wizard-HTML-Files (Templates) in the package.
I want to create a Toolbar and need sample sources!
|
|
|
|
|
Hi
I've already read a few times on this board the the MFC CSocket is bad and should not be used. Why is that so? I used it a few times in some smaller client/server apps and had no problems with it. And if it's really bad, what should I use instead? I am not familiar with pure Berkeley sockets
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Pure Winsock is flexible. You could implement any I/O model including OVERLAPPED I/O and IOCP you want and even design your own I/O model.
Kuphryn
|
|
|
|
|
Hello,
Is there a mean to draw a text in a rect, but I want the text fully fill the rect (bottom of the text == bottom of the rect).
For now,
I draw the text in a path.
I get path data, and I map all points to a rect of (1.f, 1.f).
And I fill the rect using matrix transformation.
My problem is that this method don't preserve anti-aliasing So I want to draw my text directly with GDI to fill the rect.
any suggestions
|
|
|
|
|
|
Those functions don't fill all the rect with the text.
I want for example do -> MyDrawText(10, 30, 50, 1000) to draw a text of width = 50-10 = 40 pixels and height of 970 pixels.
Not using font height and width.
Is it possible with GDI ? not GDI+
|
|
|
|
|
The easiest solution would probably be to draw the text into a memory DC, then use StretchBlt() to copy it to the screen and stretch it as tall as you want. The result probably won't look too pretty, though.
--Mike--
PROCRASTINATION: Hard work often pays off after time, but laziness always pays off now.
BUY MY SOFTWARE!! (please?) RightClick-Encrypt | 1ClickPicGrabber
My IntarWeb Homepgae!!!11
|
|
|
|
|
> The result probably won't look too pretty, though.
Yes
|
|
|
|
|
Use GDI+ with double buffering. I tried the following code in an SDI app and it looked pretty good to me.
void CTestView::OnDraw(CDC *pDC)
{
CRect rc;
GetClientRect(&rc);
Graphics g(*pDC);
Bitmap bmp(107, 15, &g);
Graphics memg(&bmp);
Font f(L"Arial", 16);
SolidBrush br(Color(255, 0, 0, 0));
memg.DrawString(L"Hello World", 11, &f, PointF(-3.0, -3.0), &br);
g.DrawImage(&bmp, 0, 0, rc.Width(), rc.Height());
}
While the antialiasing wasn't perfect, it definitely wasn't the blockness you get with straight GDI.
HTH
Sonork 100.11743 Chicken Little
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
Within you lies the power for good - Use it!
|
|
|
|
|
Addendum to my original reply
If you use a large font size, and a larger memory bitmap, the effect is even better.
ie, use a 72 point font, on a 600 x 100 memory bitmap
Bitmap bmp(600, 100, &g);
Graphics memg(&bmp);
Font f(L"Arial", 72);
Sonork 100.11743 Chicken Little
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
Within you lies the power for good - Use it!
|
|
|
|
|
Hello,
I wanna draw alti-aliased line in my application, but I don't know how to do it with GDI.
I'm pretty sure someone in the world has write this function for GDI. Do you know where to find it ?
Or just a method to smooth drawing routines of GDI..?
Thanks in advance for your help,
|
|
|
|
|
You can do it with GDI+.
There are several articles here on CodeProject about GDI+.
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
and without GDI+ ???
I've started my project without GDI+ and I don't want to use it now.
|
|
|
|
|
|
Hello Freinds
I have a question. Is it possible that I have an external variable(#extern) in my extension dll? I would be very glad if anyone help me.
Mohsen Kokabi
|
|
|
|
|
Hello, i tried making this app that sends a GET or POST command to a forum server to post a message.
Normally you would use the POST command since thats just what you use to post stuff. But i had made a program before that used the GET command to post things instead of the POST command like this:
Normally:
POST http://www.<theforum>.com/cgi/addmessage HTTP/1.0
Referer: blablabla
Host: blablabla
Content-length: blablabla
Cookie: blablabla
(these are not important)
fid=31613&name=me&subject=hello&message=mymessage // <--- the actual data
So thats what a normal POST command would look like, but you could also use GET for this like this:
GET http://www.<theforum>.com/cgi/addmessage?fid=31613&name=me&subject=hello&message=mymessage HTTP/1.0 // So basically just add a "?" to the url and put the data behind it //
Referer: blablabla
Host: blablabla
Cookie: blablabla
(the normal stuff again, not important, i know how to work this)
Now the problem is, i tried both these methods to post something, no cookies were involved and yes i do have a proxy but i just posted it there and that should work, because it does for the other application i wrote once, but it just doesnt seem to work for this one, now does anyone have any idea of what could be the cause, i was thinking maybe its the server, because you see, what i do is i build up a socket, i connect to my proxy, send the GET or POST header and i disconnect. Now this worked fine for my other program (where i used the GET to post data by the way) but it doesnt work here, so i thought maybe its because the server needs to terminate the connection and not me or otherwise it wont process the data sent? So i would have to receive on the socket i used for sending first and put it in a buffer? Or does this have nothing to do with it? Any ideas what might be causing it to fail?
Thanks for your help
Kuniva
--------------------------------------------
|
|
|
|
|