|
Does anybody know how to resize a tab control dynamicly?
|
|
|
|
|
SetWindowPos()??
---
It may be that your sole purpose in life is simply to serve as a warning to others.
|
|
|
|
|
I having a strange problem in an OpenGL data visualization project I am working on. My display scene has two alpha-blended planes above an opaque object. The upper plane has an alpha level of 0.8 and lower one is at 0.4. It works really well. Most of the time.
Here is where the weirdness comes in. I have tried this on a older Matrox card, a laptop with an ATI chip, a TNT2, a GF2 MX, and a GF3. It works great everywhere except for on the GF2 MX. I have even tried two versions of GF2 MX cards : an older one and a new MX 400. I have even tried the last two driver revs, 21.93 and 23.11. It also works fine in SW rendering mode on all cards.
What I am seeing is tearing where the lower translucent plane is showing through the upper plane in broad stripes when the object is zoomed far away from the camera.
Does anyone know of a work-around for this ?
|
|
|
|
|
I fixed the problem. I switched the order that the two planes are being drawn and it works just fine now.
I still think it is really weird that this problem only shows up on one kind of card. Oh well.
|
|
|
|
|
I've added an XML manifest to one of my programs so that dialog box controls are painted using the new Windows XP visual style. This works just fine. But, the program's toolbars don't get repainted properly. I am using the flat style with gripper, and the gripper doesn't appear correctly.
Has anybody figured out a solution to this problem? Does anybody know if it will be fixed in a service pack?
|
|
|
|
|
I'm loading font from the file( it's not binary image, but grayscale) So I'm building lists so I can dispaly messages with the font. If I disable blending, message is in the black square, but wiht blending I don't get a desired color. Is there a way to setup blanding so I'd get what I want? Thanks
Regards, Alexander.
|
|
|
|
|
NeHe's site has excellent OpenGL tutorials. One of which is on masking.
Christian
After all, there's nothing wrong with an elite as long as I'm allowed to be part of it!! - Mike Burston Oct 23, 2001
Sonork ID 100.10002:MeanManOzI live in Bob's HungOut now
|
|
|
|
|
Thanks, it does work! And I'm wondering if I need a negative image of the font and I have to create lists with negative letters, maybe there's the way to do it with only one set of lists? Or at least how can I invert an image in my program? I mean a neat way to do it?
|
|
|
|
|
I'm sorry, I really don't know. I've not found time to actually *do* the NeHe tutorials....
Christian
After all, there's nothing wrong with an elite as long as I'm allowed to be part of it!! - Mike Burston Oct 23, 2001
Sonork ID 100.10002:MeanManOzI live in Bob's HungOut now
|
|
|
|
|
It's ok, thanks for help, anyway it does work ))
|
|
|
|
|
Hi all, I have a CListCtrl that contains some only-text item, I want to move(pressing a button) the selected item up/down in the list but how?
I have to use "SetItemPosition"? There wasn't a method to move the item of only one position?
Help me please, and sorry for my english!
Thanks.
|
|
|
|
|
When you are in Report mode, something like this SwapRows function should help:
void CMyListCtrl::SwapRows(int row1, int row2)
{
// rowText will hold all column text for one row
CStringArray rowText;
LV_ITEM lvitemrow1, lvitemrow2;
int nColCount = GetColumnCount();
rowText.SetSize( nColCount );
int i;
for( i=0; i < nColCount; i++)
rowText[i] = GetItemText(row1, i);
lvitemrow1.mask = LVIF_IMAGE | LVIF_PARAM | LVIF_STATE;
lvitemrow1.iItem = row1;
lvitemrow1.iSubItem = 0;
lvitemrow1.stateMask = LVIS_CUT | LVIS_DROPHILITED |
LVIS_FOCUSED | LVIS_SELECTED |
LVIS_OVERLAYMASK | LVIS_STATEIMAGEMASK;
lvitemrow2 = lvitemrow1;
lvitemrow2.iItem = row2;
GetItem( &lvitemrow1 );
GetItem( &lvitemrow2 );
for( i=0; i< nColCount; i++)
SetItemText(row1, i, GetItemText(row2, i) );
lvitemrow2.iItem = row1;
SetItem( &lvitemrow2 );
for( i=0; i< nColCount; i++)
SetItemText(row2, i, rowText[i]);
lvitemrow1.iItem = row2;
SetItem( &lvitemrow1 );
}
WM_HOPEITHELPED
|
|
|
|
|
Thank you all for your help with my CreateProcess question. WaitForSingleObject was just what I was looking for!
Now I have just one more question for you. How can I wait for the process - and all processes it creates - complete? I am guessing I must somehow check the process periodically to see if it has any children, and then possibly use WaitForSingleObject on them? Any help would be nice, especially if you can explain how or why to do something (hey, I'm still learning).
Cheers,
Russell McCurly
Hobbiest Programmer
|
|
|
|
|
I'm assuming you are looking for a general solution. e.g. any process with any children, not something you wrote yourself or have access to the source for.
If the process you launched waits for its child processes, you don't need to do anything more than wait for it.
I don't know how to check a process for children. But, even if there is one, I don't think you can rely on it. Here is one of the creation flags available to create process:
CREATE_NEW_PROCESS_GROUP
Here's its description from MSDN:
The new process is the root process of a new process group. The process group includes all processes that are descendants of this root process. The process identifier of the new process group is the same as the process identifier, which is returned in the lpProcessInformation parameter. Process groups are used by the GenerateConsoleCtrlEvent function to enable sending a CTRL+C or CTRL+BREAK signal to a group of console processes
Hope this helps,
Bill
|
|
|
|
|
Thank you for the reply. I have tried various different ways of calling CreateProcess, including CREATE_NEW_PROCESS_GROUP as you suggested, and other flags and non-nulled parameters that mentioned some kind of inheritance, but WaitForSingleObject still say's it returns when the first process ends (rather than it's children).
Have you any further ideas?
Cheers,
Russell McCurly
Hobbiest Programmer
|
|
|
|
|
Hi, I have a string of RGB RGB RGB RGB bytes that makes up a image, and I'd like to display it onto the screen. Can someone please give me the road map for doing that? It's kinda confusing for someone w/ minium graphical background. Here's what I wanted to do:
1. Put the RGBRGBRGBRGB string into a CBitmap
2. Display the CBitmap onto my screenDC (where screen may have any color bit depth -32bit 24bits 16bits...)
My CBitmap image only displays properly when my monitor is set to 32bit/pixel. I believe I need to use DIB for these various bit depth compatability.
THANKS IN ADVANCE!
|
|
|
|
|
Yes, to get an image that will display on any screen, you need a DIBSECTION. There are some good DIBSECTION wrappers on this site. The good thing is having created on, you get a pointer to the image data, and can just move your byte array into it. There's a catch though - Windows stores images a BGR, not RGB. If indeed you have RGB ( not BGR ), you'll need to swap some values as you copy them in, otherwise memset will be fine.
If the wrapper you use does not have a draw method, you can just create a DC and select your image into it.
CDC memDC;
memDC.CreateCompatibleDC(NULL);
memDC.SelectObect(name of your image, dereferenced if it's a pointer, assuming it offers operator HBITMAP);
then you can just BitBlt it onto the screen.
Christian
After all, there's nothing wrong with an elite as long as I'm allowed to be part of it!! - Mike Burston Oct 23, 2001
Sonork ID 100.10002:MeanManOzI live in Bob's HungOut now
|
|
|
|
|
Thank you Christian for the tip. I found a DIBSection wrapper in Code Project, but the image still does not display properly with 16-bit color depth monitor setting.
I think it's because I am creating a bitmap wrong. Can you please take a look at the following:
*imageBuffer points to my image array BGRxBGRxBGRx...
<br />
bitmapBefore.CreateBitmap(sizeBefore.cx, sizeBefore.cy, 1, 32, imageBuffer);<br />
And then I display the bitmapBefore in my view.
This is what I did before in view:
<br />
CBitmap *bitmap = &(pDoc->bitmapBefore);<br />
dcTemp.CreateCompatibleDC(&cDC);<br />
dcTemp.SelectObject(bitmap);<br />
cDC.BitBlt(0,0, pDoc->sizeAfter.cx, pDoc->sizeBefore.cy,<br />
&dcTemp, 0, 0, SRCCOPY);<br />
<br />
and this is what I changed w/ DIBSection wrapper:
<br />
CBitmap *bitmap = &(pDoc->bitmapBefore);<br />
CDIBSectionLite dibsection;<br />
dibsection.SetBitmap(*bitmap);<br />
dibsection.Draw(&cDC, CPoint(0,0));<br />
They give the same results... Whenever I set my screen color depth to anything other than True Color (32bit), I get white surface. Can you spot what I'm doing wrong?
Thanks for your help!
Jerry
|
|
|
|
|
Having looked at the DIBSectionLite code, the draw function works one of two ways, depending on if hDrawDib is defined ( not NULL ).
I don't know anything about DibDrawDib, but if you comment out lines 636-649 of DibSectionLite, it will then act the way I was anticipating, and I see no reason for you to have any worries.
Christian
After all, there's nothing wrong with an elite as long as I'm allowed to be part of it!! - Mike Burston Oct 23, 2001
Sonork ID 100.10002:MeanManOzI live in Bob's HungOut now
|
|
|
|
|
Christian has already answered your question in an authoritative fashion, but I'd like to point out two more catches (apart from the BGR order) you should be aware of:- There's a padding issue, namely that all bitmap rows must occupy a number of bytes that is multiple of 4. For instance, if your image is 5 pixels wide, then the bitmap is stored as
/----row 1-----\/----row 2-----\/----row 3-----\
BGRBGRBGRBGRBGRXBGRBGRBGRBGRBGRXBGRBGRBGRBGRBGRX... Where the X is one padding byte that makes every row occupy 16 bytes (the value of this byte is irrelevant).
- The first row stored is at the bottom, and the last one at the top. The usual assumption is the other way around, but the MS guys decided on this order for some strange reason.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Really? I'm a bit confused... I experimented w/ byte ordering RGB values in my CBitmap, and it came out to be BGRxBGRxBGRx... which displayed properly in a 32-bit color depth monitor setting.
So, that must be what's wrong w/ my code then? I should create BGRBGRBGRBGRX... and how should I create this DIB? Is DIB a sub-catagory of CBitmap?
Also, since CreateDIBSection asks for pDC, how can I create an DIB image when I don't have a DC that goes with it... or can I?
Thanks man!
|
|
|
|
|
Yes, the bottom to top ordering and the BGR ordering are standard in windows, so if the image is coming in that way, then it's fine.
CBitmap is a DDB - a device dependant bitmap. A DIB is device INdependant, in other words it defines it's own colour depth instead of relying on the colour depth of a device. A DIB cannot be used to draw on, etc. using a CDC. A DIBSection is a hybrid creature - a DIB that has a HBITMAP which can be selected into a DC and used like any other HBITMAP ( which CBitmap is an extended wrapper for ).
CreateDIBSection can just be passed in a CDC created with CreateCompatibleDC(NULL); The code I pointed you to on the WDJ site does this.
Christian
After all, there's nothing wrong with an elite as long as I'm allowed to be part of it!! - Mike Burston Oct 23, 2001
Sonork ID 100.10002:MeanManOzI live in Bob's HungOut now
|
|
|
|
|
Thanks Christian for the explaination. Thanks Jouquin for your help also. PJ Arends sent me a really helpful section of the code using CreateDIBSection and SetDIBits. Just like you said. I am able to display images in different bit depths now Thanks so much.
|
|
|
|
|
I need some ideas. I have an encrypted executable file on disk. I decrypt the file to an array of bytes in memory. I would like to execute the file directly from memory without writing the decrypted file to disk. Anyone have an idea how to do this on Windows 2000?
|
|
|
|
|
Well, seems what you intend is feasible in principle. The idea is to create a virtual memory area allocated, commited and given execution access with VirtualAlloc(...,MEM_COMMIT,PAGE_EXECUTE_READWRITE) , copy the data there and jump into it (this last part might become tricky IMHO). Do a search on Usenet for "VirtualAlloc PAGE_EXECUTE", lots of information about this issue, though none conclusive.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|