|
|
Replacing it with a combo box, a date picker (for dates), etc.
|
|
|
|
|
late reply but anyhow...
this article tells how to something like that:
http://www.codeproject.com/treectrl/treeopt.asp
|
|
|
|
|
Hi there,
I'm doing a mfc dialog application.
I've a custom control with generic CWnd as it's base class. Now, i would like to create a splitter to separate it into 2 columns and the right column will have a scroll bar. The problem is that, I can't seem to find any info on how to do this.
Thanks for every single helping hand.
|
|
|
|
|
hi,
I have created a custom control with generic CWnd as it's based class. It's background is in black. However, i wan to allow a checkbox to determine whether or not to display a graphic(eg. a square drawn using CPen) in that custom control.May i know how to do this? Are there any example code i may refer to?
All help is much appreciated.
|
|
|
|
|
The WM_ERASEBKGRND message is the one you want - handle that, and in it, draw whatever background you want.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
i have other graphic also drawn using CPen in the custom control. How to use WM_ERASEBKGRND to only erase the desired graphic?
|
|
|
|
|
You can use getwindowrect to find out the size of the control and draw on that only.
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
can you explain more on how to use the WM_ERASEBKGND? I can't seem to get it to work.
|
|
|
|
|
Hi all
I always confused with the GetWindowRect and ScreenToClient.
What's the exact region when use the CWnd::GetWindowRect?
and what's the region of one control's(like a textbox) GetWindowRect?
and Why it always uses the ScreenToClient after using the control's GetWindowRect.
If possiable,show me with a graph.
Thanks.
Nothend
|
|
|
|
|
Nothend wrote: If possiable,show me with a graph.
Not sure how you expected that.
GetWindowRect gets the rectangle that the windows takes up. ScreenToClient takes co-ordinates that relate to the entire screen, and converts them to co-ordinates that are relative to the top left corner of the client program specified.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
|
Perhaps this[^] may be of some help.
Steve
|
|
|
|
|
i want to capture a window to a bitmap.
when the document size is bigger than current viewable rectangle, if using the document size to the captured image will has a big black block.
<br />
CSize size = GetTotalSize();<br />
CClientDC dc(this);<br />
CDC memDc;<br />
if(!memDc.CreateCompatibleDC(&dc))<br />
{<br />
return ;<br />
}<br />
CBitmap bitmap;<br />
if( !bitmap.CreateCompatibleBitmap(&dc, size.cx, size.cy) )<br />
{<br />
return ;<br />
}<br />
CBitmap* pOldBitmap = memDc.SelectObject(&bitmap);<br />
memDc.BitBlt(0, 0, size.cx, size.cy, &dc, 0, 0, SRCCOPY );<br />
if( OpenClipboard() )<br />
{<br />
EmptyClipboard();<br />
SetClipboardData(CF_BITMAP, bitmap.GetSafeHandle());<br />
CloseClipboard();<br />
}<br />
memDc.SelectObject(pOldBitmap);<br />
any suggestion or tips will be great help.
thank you in advance.
|
|
|
|
|
A window only renders if it's on the visible area. Grabbing outside your desktop just isn't going to do anything.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
You can use the PrintWindow function to do this I believe.
Steve
|
|
|
|
|
thank you, i will give it a try.
|
|
|
|
|
thank you! i know that, but i have to get the big one.
|
|
|
|
|
Hi all. I wrote two functions with void and int main calling them. Problem is only one function is working while the other is not. Here's my code:
<br />
#include <fstream><br />
#include <time.h><br />
#include <windows.h><br />
using namespace std;<br />
<br />
void time(void);<br />
void date(void);<br />
char olddate[9] = {0}; <br />
char oldtime[9] = {0};<br />
<br />
int main (){<br />
time();<br />
date();<br />
return 0;<br />
}<br />
<br />
<br />
void time(void){<br />
while(1){<br />
Sleep(300);<br />
char time [9];<br />
_strtime(time);<br />
bool fNewTime = strcmp(time, oldtime) != 0;<br />
if(fNewTime){<br />
ofstream file1;<br />
file1.open("time.txt",ios::app);<br />
file1 << "[Time]: " << time << endl;<br />
strcpy(oldtime, time);<br />
file1.close();<br />
}<br />
}<br />
}<br />
<br />
void date(void){<br />
while(1){<br />
Sleep(1);<br />
char date[9];<br />
_strdate(date);<br />
bool fNewDate=strcmp(date,olddate) !=0;<br />
if(fNewDate){<br />
ofstream out;<br />
out.open("time.txt",ios::app);<br />
out << "[Date]: " << date << endl;<br />
strcpy(olddate,date);<br />
out.close();<br />
}<br />
}<br />
}<br />
What i'd like for it to do is use both functions at the same time. At first i had them both set at Sleep(3000); So i changed one from 3000 to 4000 because i thought since their running both at same miliseconds that was causing the problem. But it didnt solve anything. Then i changed the main keyword from top to bottom. Bottom to top and still only one function works. Notice the time() and date() function call. If i put one on top of the other the one at the top of the keyword only activates. But the bottom stays idle. I've tried everything and now im coming to everyone here to see if they could lend a hand. Thanx in advance!
|
|
|
|
|
1. for the convenience of the other readers, please edit your message (not repost a new one) and surround the code sample with <pre></pre> tags. also, use < and > instead of < and & , otherwise, they will be interpreted as html tags and the formatting will be broken.
2. you'll need to solve your problem to use threads if you really need parallel execution.
|
|
|
|
|
Thanx for your reply toxcct, but i dont understand what you mean by "you'll need to solve your problem to use threads if you really need parallel execution."
Would anyone else like to add something to shed some light on what i should do to get both functions working together?
|
|
|
|
|
toxcct wrote: if you're not using MFC, use the corresponding Win32 API for starting a thread
This is bad advice. For official documentation on why this is note the following from here[^]:
<quote>A thread in an executable that calls the C run-time library (CRT) should use the _beginthreadex and _endthreadex functions for thread management rather than CreateThread and ExitThread; this requires the use of the multi-threaded version of the CRT. If a thread created using CreateThread calls the CRT, the CRT may terminate the process in low-memory conditions.
Steve
|
|
|
|
|
|
dellthinker wrote: time();
date();
I can't concieve of what would make you think these would run at the same time. I think you need to work through a few books, so you understand the basic principles of how your code is executed.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
I am trying to develop a MDI application in MFC. I am going thru different books "MFC with Visual C++ 6"-Mike Blaszczak, "Visual C++ MFC Programming by Example"-John Swanke and MSDN (ofcourse). But they are all like bits and pieces for me and I am not able to get a good idea on building an application from scratch.
Does anyone have a good resource on developing a MDI MFC application from scratch? My application is a BMP (mainly a 8bit gray scale BMP) viewer on which the user can select various points and highlight those points, the user should be also able to move/delete selected points and also perform some basic image processing techniques like brightness/contrast enhancement. I have the basic idea on how the interface should look like.
thanks,
-Pavan.
|
|
|
|