|
I highly recommend that you master C++ before going into windows programming.
Kuphryn
|
|
|
|
|
kuphryn wrote:
master C++ before going into windows programming
Sounds Good! where do you recommend I start with C++ programming?
Borland C++? or which one.
Thanks
Tony
|
|
|
|
|
I recommend Visual C++ under windows platform and Borland Kylix under Linux. As for fundamental book, I recommend C++ How to Program by Deitel&Deitel.
Kuphryn
|
|
|
|
|
|
I'm trying to get tooltips working on my dialog. I have a toolbar on the dialog which fires tooltip notifications and the tooltips display fine, but tooltips 'inside' frames don't fire the notification and I don't get tooltips.
Anyone know why not?
Dan
|
|
|
|
|
How can I change the background color of a dialog ?
|
|
|
|
|
You can go to the WM_PAINT (OnPaint()) of the dialog and add the following code
CRect rect;
CBrush brush(RGB(100, 0, 0));
dc.GetWindow()->GetWindowRect(&rect);
ScreenToClient(&rect);
dc.FillRect(&rect, &brush);
dc is CPaint dc(this);
Harsha
----------------------------------
http://www.ece.arizona.edu/~hpg
----------------------------------
|
|
|
|
|
One way is to override OnCtlColor(), as follows:
(1) In your message map, add:
<br />
ON_WM_CTLCOLOR()<br />
(2) Then, add the following function to your Dialog class:
(replace CMyDialog with whatever is the proper name in your case)
<br />
HBRUSH CMyDialog::OnCtlColor(CDC *pDC,CWnd *pWnd,UINT nCtlColor)<br />
{<br />
HBRUSH hbr = CDialog::OnCtlColor(pDC,pWnd,nCtlColor);<br />
<br />
if(nCtlColor == CTLCOLOR_DLG)<br />
{<br />
hbr = CreateSolidBrush(RGB(0,0,255));<br />
return hbr;<br />
}<br />
<br />
return hbr;<br />
}<br />
You can use this method to change the color of pretty much any
element of your dialog.
|
|
|
|
|
Hi, I am going to write a tiff file viewer, but I don't know the format of the
tiff file. Here I ask my questions,
(1). I googled the format of tiff and didn't find any help information, anyone
can show me an URL to learn the tiff format?
(2) can somebody show me the source code of tiff viewer? How is a tiff file
compressed and displayed?
(3). WHAT I WANT TO DO IS: to display the result of a window moving(1024*768)
on a very large picture(8192*4096). My goal is to MINIMIZE the data to be
transfered over ethernet at each display frame.
Say, I want to have my viewer display 1024*768 pixels at a time, my mouse
move smoothly to change the position of the window. Thus intuitively, at each
time I only need a small ammount of new pixels to be loaded in the viewer,
because the other part should overlap with the former frame. Is ther any
clever method to minimize the data transfer?? (If it were bmp file, I can
expect this is doable.)
---------------------------
| |-------| moving |
| |Window | --> |
| |-------| |
| whole pic |
|-------------------------|
|
|
|
|
|
|
Forgot to mention, there's also libtiff[^], which is free and may be helpful.
- Mike
|
|
|
|
|
Yes. You do not want to implement TIFF from scratch unless you have 6 months extra time on your hands...
John
|
|
|
|
|
Any reason why you are using TIFF? Most developers stay away from TIFF because of the problems with the Unisys patent of LZW.
John
|
|
|
|
|
Because my advisor(in University) want to write a demo software to implement the senario I described above. We have lots of big tiff file(>22MB) on hands.
|
|
|
|
|
I work in a university and understand...
John
|
|
|
|
|
Thanks for the understand. I am a newer in image display
|
|
|
|
|
Also compression is probably not the way you want to go because it is too slow. If it takes 10 seconds to compress your file and 10 seconds to decompress it wouldn't it be faster if you just send the whole file in the first place. You want to send a lower resolution image to the screen. Magnify (by pixel replication) it so that it is the same size and while the user is viewing the image fill in the missing image information.
John
|
|
|
|
|
I agree with you, I think the compressed file is not similiar to the bmp file. I want to know what size it would be to store a same image in bmp(uncompressed image) for a 2048w x 1025h, true color image(which is 2.65MB in tiff format).
By the way, I am a newer in displaying image.
How to calculate the size of bmp for a given size image? could you give me a formula? thanks.
|
|
|
|
|
For 24 bit images:
2048 * 1025 * 3 = ~6.3MB
This is not exactly correct because lines must end on a DWORD boundry I think..
John
|
|
|
|
|
Hi, I am going to write a tiff file viewer, but I don't know the format of the
tiff file. Here I ask my questions,
(1). I googled the format of tiff and didn't find any help information, anyone
can show me an URL to learn the tiff format?
(2) can somebody show me the source code of tiff viewer? How is a tiff file
compressed and displayed?
(3). WHAT I WANT TO DO IS: to display the result of a window moving(1024*768)
on a very large picture(8192*4096). My goal is to MINIMIZE the data to be
transfered over ethernet at each display frame.
Say, I want to have my viewer display 1024*768 pixels at a time, my mouse
move smoothly to change the position of the window. Thus intuitively, at each
time I only need a small ammount of new pixels to be loaded in the viewer,
because the other part should overlap with the former frame. Is ther any
clever method to minimize the data transfer?? (If it were bmp file, I can
expect this is doable.)
---------------------------
| |-------| moving |
| |Window | --> |
| |-------| |
| whole pic |
|-------------------------|
|
|
|
|
|
Hi there. Does anyone know of any artcles that show how to create those Auto-Hide view that are featured in VS .net... the Toolbax, Server Expplorer, etc ?
Thanks for any help.
Mark Donkers
A witty saying proves nothing.
-- Voltaire
|
|
|
|
|
There's a Win32 API function called AnimateWindow() which provides this type of effect.
n!
|
|
|
|
|
I have some old perl code that I found in the book "Perl Database Programming" by Brent Michalski that I need to port to C++ for use with another project that needs in place array shuffling. I've analyzed the perl code back to front and am still not sure how implement the same thing in C++. For inspection, I have the full source for the perl subroutine with line by line comments verbatim from the book for those who don't have an understanding of perl following the source code:
<code>
1: sub fisher_yates_shuffle {
2: my $array = shift;
3: my $i;
4: for($i = @$array; --$i) {
5: my $j = int rand ($i+1);
6: next if $i == $j;
7: @$array[$i,$j] = @$array[$j,$i];
8: }
9: }
</code>
Line 1 begins the fisher_yates_shuffle subroutine. This subroutine is designed to take a reference to an array as the input, and it will randomize the items in the array in place. This means that we pass a reference to an array and the array gets randomized. This is a commonly used method for randomizing arrays, the "Fisher-Yates shuffle," named after Sir Ronald A. Fisher and Frank Yates, who introduced the algorithm in example 12 of their 1938 book Statistical Tables.
Line 2 declares a scalar variable named $array and shifts the value passed to the subroutine into it. This value should be a reference to an array.
Line 3 declares a scalar variable named $i
Line 4 begins a for loop that sets $i to the current value each time through the loop and also decrements $i. This has the effect of setting $i to the number of elements in the array @$array and then counting down one by one.
Line 5 declares a scalar variable named $j and sets it to a random integer between 1 and $i
Line 6 causes the for loop to skip to the next iteration if $i and $j are equal
Line 7 swaps the values at $array[$i] and $array[$j]
Line 8 ends the for loop that we began on Line 6
Line 9 ends this subroutine.
As I've said, I've been over this thing a dozen times, and a solution in C++ just isn't coming to me, so I'd appreciate any help that anyone woudl be will to provide. I think that the perl source I've included gives enough of a general idea of what needs to happen along with the source comments that a solution would be apparent to any seasoned programmer ( which when it comes to C I'm definately not ) Thanks in advance for any help that you folks can provide.
It's good to see kids turning their minds to wholesum activities such as programming, instead of wasting their lives in the hedonistic disciplines of Sex, Drugs, & Rock & Roll... or Sex with Drugs, or Sex with Rocks while Rolling in Drugs, or whatever new-fangled perversions you little monsters have thought up now...
[Shog9 on Kid Programmers]
|
|
|
|
|
template <class T>
inline void fisher_yates_shuffle(T* array, int size)
{
::srand(static_cast<unsigned int>(::time(0)));
//could be
for(int i = size - 1;i > -1;--i)
{
int j = ::rand() % i;//could be "::rand() % i + 1" I am not sure what "rand ($i+1)" stands for
if(i != j)
{
T temp = array[i];
array[i] = array[j];
array[j] = temp;
}
}
}
|
|
|
|
|
Almost...
The rand() % i should be rand() % (i+1) . Other than that, well done .
template <class T>
inline void fisher_yates_shuffle(T* array, int size)
{
srand(static_cast<unsigned int>(time(0)));
for(int i=size-1; i>-1; --i)
{
int j = rand() % (i + 1);
if(i != j)
{
T temp = array[i];
array[i] = array[j];
array[j] = temp;
}
}
}
Ryan
Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late - John Nichol "Point Of Impact"
|
|
|
|