|
I am looking for information on using a USB port as a substitute for the RS232 comm port. Do Win98 and Win2000 already support that or will a device driver have to written? If so where is a good place to get info?
Happy programming!!
|
|
|
|
|
I've never programmed for NT/2000 before, and I kinda don't have an NT/2000 box at my immediate disposal. Can someone tell me if FindWindow works the same on both 98 and NT/2000? My app is giving me grief when i try to run on win2k.
Thanx,
Stephen Caldwell
|
|
|
|
|
Sorry, I'm not a native English speaker; what do you mean by "giving grief"?
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
It means that it's really getting on my nerves.
Stephen Caldwell
|
|
|
|
|
|
Stephen Caldwell,
don't you mean that it is 'upsetting you' ?
Regards
Ray
"Je Suis Mort De Rire"
|
|
|
|
|
As I remember the only difference is that Win98 version uses ASCII and WinNT version uses Unicode.
Regards
Ray
"Je Suis Mort De Rire"
|
|
|
|
|
In fact, NT has two versions of FindWindow (as well as other API functions). FindWindowW uses Unicode, FindWindowA uses ASCII.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
I've been having a problem recently that has really been bugging me; for some reason, when I use printf or cout, the output will not appear on the console - I assume this is because stdout is not being flushed. Any idea why this is? I don't want to have to call fflush(stdout) after every printf!
|
|
|
|
|
Stdout is normally line-buffered, so end your printfs with \n. When printing to cout, add a "cout << endl" to get a newline.
--Mike--
http://home.inreach.com/mdunn/
A recent survey reports that 1/4 of all internet users in England surf for porn.
The other 3/4 just didn't want to admit it.
|
|
|
|
|
I was already doing this - it's not working.
|
|
|
|
|
I am using CListBox::SetTopIndex() to make sure I can view the last entry in a list box. I would like the view to adjust so the last entry is shown about half way between the top of the bottom of the list box control. I created a quick formula to do this, however, I found that using SetTopIndex() will make the last entry visible, but no matter what I put as the index for SetTopIndex(), it always puts the last entry at the bottom of the list box control. Visible yes, what I want, no.
Any ideas?
Thanks
John
|
|
|
|
|
Do I understand correctly, you want the last item entered into a list box to be displayed centered vertically? There are no other entries in the list box below this one?
If this is what I understand then you can't. What you may have to do is add empty strings to pad the listbox and move the item up.
|
|
|
|
|
Dumb question.. If I have a dialog type application called "A".. and I create dialog box "B" within the same app. I then create a member variable for "B" in "A"s Class how can I update a control on "A" from "B".. for example lets say I have a listbox on dialog "A" and I input a string into an edit box on dialog "B" from "B" I want to add the item to the listbox on "A" with out actually pulling the string from "A" and inserting it.. can this done or do I have to update the variable and add it while in "A"?
Any help would be greatly appreciated.
Rob Jones
|
|
|
|
|
You could do that with ::SetDlgItemText(..)
Or eaven send a window message to a control
|
|
|
|
|
Hi,
I currently have a bitmap that is being held in a CDC and I would like to get a peice of that bitmap and save it to another bitmap. For instance, let's say that I have a bitmap that is 100 x 100 pixels. I want to select region 25, 25, 50, 50 copy it to another DC I guess? and then save it out to another .bmp file.
Does anyone know how to do this? I have the coordinates of what I want to copy to the new bitmap but don't know how to do it.
Thanks for any help you can provide,
Craig
|
|
|
|
|
Create a new CBitmap of the size you want, a new CDC to hold the CBitmap, and then use BitBlt to copy across the section you want.
Christian
Secrets of a happy marriage #27:
Never go to bed if you are mad at each other. It's more fun to stay up and fight.
|
|
|
|
|
Hi Christian,
Here is what I've got so far:
CDC dcMemory;
dcMemory.CreateCompatibleDC(&dc);
COXDIB imagePiece;
imagePiece.CreateEmptyDIB(1, 55, 50);
CBitmap* pOldBitmap = imagePiece.MakeBitmap(&imagePiece, &dcMemory, CSize(55, 50));
dc.BitBlt(0, 0, 55, 50, &dcMemory, x, y, SRCCOPY);
CFile imageFile("c:\\temp\\imageManip\\testResult.bmp", CFile::modeCreate|CFile::modeWrite);
imagePiece.Write(&imageFile);
dcMemory.SelectObject(pOldBitmap);
When I look at the image that I created it is just all black, nothing else.
Am I on the right track?
Thanks,
Craig
|
|
|
|
|
What is a C0XDIB ? I assume a DIBSection wrapper ? x and y are valid values ? I can't comment on what you're doing wrong, but as therest looks fine I'd assume it's in the section:
COXDIB imagePiece;
imagePiece.CreateEmptyDIB(1, 55, 50);
CBitmap* pOldBitmap = imagePiece.MakeBitmap(&imagePiece, &dcMemory, CSize(55, 50));
if x and y are good values, because I have no idea what the syntax for this class you're using is. I'd bet on the last line if I had to make a guess, but only because CreateEmtyDIB is obviously working ;0
Christian
Secrets of a happy marriage #27:
Never go to bed if you are mad at each other. It's more fun to stay up and fight.
|
|
|
|
|
ok, so let's say I try something like this:
CDC dcMemory;
dcMemory.CreateCompatibleDC(&dc);
dc.BitBlt(0, 0, 55, 50, &dcMemory, x, y, SRCCOPY);
CBitmap bitmap;
CFile imageFile("c:\\temp\\imageManip\\testResult.bmp", CFile::modeCreate|CFile::modeWrite);
imageFile.Close();
Given that, how would I copy the dcMemory into the new CBitmap? After that, how do I write out the CBitmap to a file?
Sorry for such basic questions,
Craig
|
|
|
|
|
The way you were trying - by calling CreateBitmap on the bitmap, with the bits per pixel of the old bitmap and the size you want. Select it into a new DC and call BitBlt, just like you were doing.
For saving, if you don't want to use GDI+, there is a recent submission to this site that saves bitmaps in multiple formats.
Christian
Secrets of a happy marriage #27:
Never go to bed if you are mad at each other. It's more fun to stay up and fight.
|
|
|
|
|
Thanks Christian, I'll give it a try.
|
|
|
|
|
Hi, in my program I have two classes, say A and B. In class A I need to use B's functions, while in B I need to use A's. If in A I include B.h and in B I include A.h the compiler will complain. How can I make it work?
|
|
|
|
|
Include the files in the .cpp file. Or, if you need to declare an instance of A in B and B in A, then in one of them include in the .cpp file and in the header just put a dummy declaration, for example in B.h you might put
class A();
A m_MyA;
and include the *real* A.h in B.cpp.
Christian
Secrets of a happy marriage #27:
Never go to bed if you are mad at each other. It's more fun to stay up and fight.
|
|
|
|
|
I would like to know, how to get the directory where the application is installed.
I tried to use _getcmd but this doesn't works correctly.
Thanks for your help!
|
|
|
|