|
Thank twing.
Why would you define the array data type as unsigned char?
But you still present me a heuristic idea.
The following method indeed works well.
int size= bm.bmHeight*bm.bmWidthBytes;
BYTE *px = new BYTE[size];
pBitmap->GetBitmapBits(size,px);
Then, the array px stores the pixel value RGB,
you can also use loop in +4 to get single R,G or B value,
and use forced transform method, int ( px[i]) to get an int type value.
Thanks,
Ninaming
|
|
|
|
|
I am taking C# class right and I am having a little trouble w/ my homework. I hope you guys can help me out.
a) Create a class named Game containing a string that holds the name of the game and an integer that holds the maximum number of players. Include get and set methods for each field. Also include tostring() method that overrides the object class's tostring(0) method and returns a string containing the name of the game along w/ the number of players.
b) Create a child class named GameWithTimeLimit that includes an integer time limit in minutes, and get and set methods for the field.
c) Write a program that instantiates an object of each class and demonstartes all the methods.
Thai Tran
|
|
|
|
|
This is a standard question and very basic, any one can read a book and learn how to do it.
My God is more powerfull Than Your God.
|
|
|
|
|
And where is your problem?
A student knows little about a lot.
A professor knows a lot about little.
I know everything about nothing.
|
|
|
|
|
How to check double for positive and negative
infinity? And what about Nan?
Thank You
Bo Hunter
|
|
|
|
|
_isnan
_finite
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
Hi,
I have a SDI Visual C++ 6 application with a CFormView.
In the CFormCiew, I have multiple dialogs that I can access by a CTabCtrl on the first view.
In one of the pages I have a ComboBox that I want to update the selection when I open a file for example.
Unfortunately, I can update this ComboBox even if I have add a member data of type CComboBox in the page class.
The only time that I can access the ComboBox is in the OnInitDialog() member function. But if I quit this page and I come back, I did not have acces again to the ComboBox control.
Does anyone has tips ?
Thanks,
Claude
|
|
|
|
|
Use OnSetActive() instead.
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
Hello all
I'm trying to program HID device. After fetching device name using SetupDiGetDeviceInterfaceDetail(), I'm trying to open it using the following.
CreateFile(DevicePath,GENERIC_READ,FILE_SHARE_READ,NULL,OPEN_EXISTING,NULL, NULL);
but I'm getting ERROR_ACCESS_DENIED. I'm using windows 2000.
Can anyone help me in this?
Thanks for your help
Hari.
|
|
|
|
|
Darn bugger gosh grrrr
in VC6.0 when i did a build and wanted to get rid of the output window i'd just push ESC and it'd obligingly bugger off
in VS studio .net it wont go AWAY
Is there a one step "bugger off output window" keyboard button?
Bryce
---
Publitor, making Pubmed easy.
http://www.sohocode.com/publitor
|
|
|
|
|
Fire up the macro explorer. Find a suitable module, or create a new one. Add this to the module:
Sub BuggerOff()
Dim i As Integer
For i = 1 To DTE.Windows.Count()
Dim w As Window
w = DTE.Windows.Item(i)
If w.Caption = "Output" Then
w.Close()
End If
Next
End Sub
Then customize a keystroke to call that function.
--
20 eyes in my head, they're all the same![^]
|
|
|
|
|
|
|
Hi,
I'm porting a Java app to C++ using MFC (I need C++ because I feel java too slow for my needs and I must perform some optimizations on memory management ) and am having serious troubles to create some dialog. Here is the Java/swing dialog I want to create with MFC: http://www.calodox.org/morbac/other/javaform.jpg
The scrollable field contains some groups of controls and the number of these groups may vary during execution time, so I must create them dynamically.
I've already solved the problem of the scrollbar with the tutorial "How to implement a Scrollable Child Dialog" I found here at codeproject, but I can find any good way to put several "Comb pair" boxes together into a single placeholder.
I've tried using the CFormView and CPropertyPage without any success: I don't know how to use the CFormView (and I'm not sure it is a good idea to use it) and the elements of the CPropertyPage disapear when scrolling.
Any idea/advice how I can make it working ?
Thanks in advance
morbac
|
|
|
|
|
I'd put all the controls you needed onto the page at design time and hide/show them at run time.
I believe a form view is a normal window that uses a dialog template. It's probably the way to go, to get a scrolling dialog. You'd actually create an SDI project and use CFormView, then lay out the dialog on the form.
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
I recommend using a table view (i.e. a CListCtrl control with editable fields) to provide the same functionality. There's ample sample code @ CP to help you do this.
/ravi
Let's put "civil" back in "civilization"
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
ok, thanks for answers
I have finally chosen to use an option tree control: http://www.codeproject.com/treectrl/coptiontree.asp
This is a very cool and good looking library (maybe still needs some debug but is almost ok).
Thanks again
morbac
|
|
|
|
|
|
I need to first of all read a line of a file until a newling or '\n'. I would then store that to a string and put it into the first element in the array, then I will turn the previous string to empty then read the line until another newline '\n' and store that line to a string which will be stored at the next array element. I know that I have to allocate the array since I don't know how much lines will be in the array, could be hundreds to thousands of elements but I need to do this in win32. I will do the storing into the array elements until the end of the file is reached. I will be very happy if someone could help me, I so far have the following code:
int *p;<br />
int uc = 0;<br />
string all;<br />
cout <<"has something in it\n";<br />
try<br />
{<br />
p = new int;<br />
}<br />
catch(bad_alloc xa)<br />
{<br />
cout << "Allocation Failure\n";<br />
exit(1);<br />
}<br />
do<br />
{<br />
all = null;<br />
do<br />
{<br />
all = all + data.get(); <br />
} while(data.get != '\n');<br />
p[uc] = all;<br />
uc++;<br />
} while(data);<br />
delete []p;
Please help me, I would appreciate it if someone can make a similair but simpler program like this or help me with this or even an article about this if anyone know something like this.
|
|
|
|
|
Why not use a vector ? Why does it matter that you need to do it in Win32 ? Then use getline() to read the file.
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
I don't know how to use vectors and I have to do it in win32 is because I already started on a project with it and I can't go back and change its type... it would take too long. I also don't know how to use getline().
|
|
|
|
|
Snyp wrote:
I have to do it in win32 is because I already started on a project with it and I can't go back and change its type
What I asked is why does it *matter* that you're using Win32 ? The Microsoft libraries sit on top of the C++ language and should only be your first port of call if you're trying to do something OS specific, like throw up a window. Stuff C++ doesn't support.
Snyp wrote:
I don't know how to use vectors
Snyp wrote:
I also don't know how to use getline().
I have articles on this site on both, use the search box above.
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
Ok I think I know how I'm going to do this, first if I find the getline() function and how it works I will get the line store it to first element and then on and on until the end of file is reached. I will then use a sort to sort the big list.
|
|
|
|
|
Yes, exactly. One benefit of the STL is you get your sorting algorithms for free.
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
Thankyou very much, I don't use the stl alot to none but I think you made me 'cross over'
|
|
|
|