|
I draw some graph in the 'CView' with 'CDC', but I can't save it to file.
|
|
|
|
|
I use Imgsource from Chris Losinger
http://www.smalleranimals.com/isource.htm
saved me many hours
Happy programming!!
|
|
|
|
|
Read the FAQ.
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
"I'm somewhat suspicious of STL though. My (test,experimental) program worked first time. Whats that all about??!?!
- Jon Hulatt, 22/3/2002
|
|
|
|
|
I have compiled a single-document program and overload 'OnSize ' of CMainFrame,below is my code.
void CMainFrame::OnSize(UINT nType, int cx, int cy)
{
CFrameWnd::OnSize(nType, cx, cy);
CRect rect;
GetWindowRect(&rect);
if(rect.Height() < 200)
rect.bottom = rect.top + 200;
if(rect.Width() < 200)
rect.right = rect.left + 200;
MoveWindow(rect);
}
Though the length and width of the window are all greater than 200, it twinkles very much. How can I keep it from twinkling?
Still has , and how to make maximize , minimalize and the restore of window and system menu lose efficacy ?
|
|
|
|
|
I would try doing this in the OnSizing message instead. OnSize occurs after the window has been sized. OnSizing occurs right before the window will be resized.
If the effect that you are trying to create is to make sure that a window can be no less than a certain size, then you will actually want to handle the WM_GETMINMAXINFO message. This will allow you to set the max and min dimensions of you window. Then when the user tries to resize the window, they will not be able to drag the border past the dimensions that you have specified.
Checkout my Guide to Win32 Paint for Intermediates
|
|
|
|
|
How can I access a CD at the track level in Win32? I'm trying to access Redbook Audio information.
|
|
|
|
|
I have 2 text boxes, one for inputting numbers and the other is a read only box that reads in that number. Depending on whether that number is even or odd, the read only box changes its background to green(even) or red(odd). However, the text inside the read only box then flickers when it's displayed. How do I fix this?
This is what I have done:
HBRUSH CSmallDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
CEdit * pEditReadOnly = (CEdit *)GetDlgItem(IDC_EDIT_DISPLAY); //read only
HWND hWndReadOnly = pEditReadOnly->GetSafeHwnd();
if(m_brush)
DeleteObject(m_brush);
CString input_value;
m_INPUT_BOX_VALUE.GetWindowText(input_value); //get value from input
m_DISPLAY_BOX_VALUE.SetWindowText(input_value); //read box displays it
long int number = atoi(input_value); //convert input_value to integer
if(nCtlColor == CTLCOLOR_STATIC &&
hWndReadOnly == pWnd->GetSafeHwnd())
{
pDC->SetBkMode(TRANSPARENT);
if (number % 2 == 0) { // if even change background to green
m_brush = CreateSolidBrush(RGB(0,255,0)); // green background
pDC->SetTextColor(RGB(0,0,0)); // black text
}
else { // else it is odd (red)
m_brush = CreateSolidBrush(RGB(255,0,0)); // red background
pDC->SetTextColor(RGB(255,255,255)); // white text
}
hbr = m_brush;
}
return hbr;
}
|
|
|
|
|
Please use the <pre> tag when posting code samples; it's nice to see indentation
I don't know the answer off-hand, but i might try
pDC->SetBkMode(OPAQUE);
pDC->SetBkColor(RGB(0,255,0));
instead of
pDC->SetBkMode(TRANSPARENT);
Sometimes i only remember, The days when i was young Nowadays no one remembers when they were young and stupid... ADEMA, The Way You Like It
|
|
|
|
|
That doesn't get rid of the flicker.
Thanks though.
|
|
|
|
|
Are you setting the text each time you change the back color?
Nish
If I am awake and my eyes are closed, it does not necessarily mean that I am thinking of naked women.
|
|
|
|
|
Ignore the last post please.
I didnt read the head post. Just read the 3rd one and replied without thinking
If I am awake and my eyes are closed, it does not necessarily mean that I am thinking of naked women.
|
|
|
|
|
Nish [BusterBoy] wrote:
Ignore the last post please.
I didnt read the head post. Just read the 3rd one and replied without thinking
? i'm pretty sure you were right. It took me a while to figure it out though. If you're that good not thinking, then you must be scary when you think.
You'r apostrophe bug's me.
|
|
|
|
|
Shog9 wrote:
? i'm pretty sure you were right.
Yes
I was right.
He is setting the text each time
Man I am really absent minded today
Nish
If I am awake and my eyes are closed, it does not necessarily mean that I am thinking of naked women.
|
|
|
|
|
Nish [BusterBoy] wrote:
Man I am really absent minded today
Bah! It's Sunday. And Daylight Savings Time. With a double-whammy like that, who can blame you?
You'r apostrophe bug's me.
|
|
|
|
|
Ok, totally didn't pick up on this the first time through, but - You are setting the text for the control each time OnCtlColor() is called. Remember, OnCtlColor() is called for more than just static text controls - your edit box is triggering it also. A much better way (and one which will probably eliminate your flicker) is to synch the text within an EN_CHANGE handler for the edit box, and set only the color within the OnCtlColor() function.
You'r apostrophe bug's me.
|
|
|
|
|
Wow, thanks alot.
|
|
|
|
|
Suppose my ISP allows to give more information than normal ISPs does. Like it gives tells the user is their CLI number is wrong or they should connect at another number because this server is having a lot of load. I want my RAS dialer to recognize this stuff. Can I do without having to communicate directly with modem or terminal. What could be the possible way to workout this stuff.
Thanks in Advance.
In my dream, I was dorwning my §orrow§
But my §orrow§, they learned to §wim
|
|
|
|
|
How does it work when I want to send a file through my socket??
I guess I have one clue: I read each byte in the file and send it over to the client from the server. and the client will receive each byte and then make a file with a usual file creating function, such as fopen(...), and the save each byte in that file.
But I'm not sure my clue is working!
I'm NOT using MFC (which is VERY strange to be me! )
------------------------------------
Rickard Andersson, Suza Computing
ICQ#: 50302279
I'm from the winter country SWEDEN!
------------------------------------
|
|
|
|
|
Hey Rickard
Didn't you get my winsock sample to run yet?
Nish
If I am awake and my eyes are closed, it does not necessarily mean that I am thinking of naked women.
|
|
|
|
|
No
But I've figure it out how it works with multithreaded server anyway now...
------------------------------------
Rickard Andersson, Suza Computing
ICQ#: 50302279
I'm from the winter country SWEDEN!
------------------------------------
|
|
|
|
|
Basialy ur idea is corret..!! and you must care about stream/datagram and if u can handle the solution in such a way that the handshaking...that s better...if the client send a buffer and waiting for acknowledge and if the acknowledge get ,sene the next ,otherwiese resend the same...
|
|
|
|
|
Holy sh*t!
If you have the new PSDK you can use TransmitFile(...)
Nish
If I am awake and my eyes are closed, it does not necessarily mean that I am thinking of naked women.
|
|
|
|
|
Hi.
I am working on a program using the doc/view architecture. There is basically the program. There is a modeless dialog box where the user enters some information. When the user clicks "Apply" the dialog box sends a message to CMainFrame. From there, CMainFrame sends a message to CChildView. CChildView then draws the information as text inside its area.
I do not know how to send CChildView a message within CMainFrame. I am using the same technique Promises uses in Chapter 8 dialog 2 program (example of modeless). The only difference is he did not implement the program using doc/view. I am. In doc/view I do not know how to send a message from CMainFrame to CChildView because there is not CChildView object defined in CMainFrame:
CMyChildView cView;
cView.PostMessage(WM_MY_MESSAGE, 0, 0)
The code above does not work in doc/view.
I am using the same technique that Promises did. I am not sure if that is the prefer technique in the doc/view architecture. Please mention I should send the message directly from the dialog box to CChildView and how.
Thanks,
Kuphryn
|
|
|
|
|
|
My win32 program is exiting with code 3 (0x3). It seems to run fine, and last week (before I made numerous changes to the application) it was exiting with code 0. My program returns the wParam from a WM_QUIT message. I have dug through the VC++ documentation and came up dry. The only thing that I found was that WinMain (or the wParam value from WM_QUIT) is supposed to exit with 0 on success. Can someone help me decipher what exit code 3 means?
|
|
|
|