|
Correct. There are tons of implimentations of CString type classes if std::string does not do it for you though.
Christian
I am completely intolerant of stupidity. Stupidity is, of course, anything that doesn't conform to my way of thinking. - Jamie Hale - 29/05/2002
|
|
|
|
|
|
I use ShowWindow( SW_HIDE ) in my program and it flashes the frame of what would be the window but then it hides. I've tried commenting out a lot of stuff but nothing seems to work. How can I get rid of the flashing?
-Raffi
Why do today what can be put of until tommorrow?
|
|
|
|
|
Try using this instead:
::SetWindowPos(hWnd, NULL, 0,0,0,0, SWP_HIDEWINDOW | SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE);
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
G'day all!
I have been using CRichEditCtrl class and every 20ms or so, I add things on to the display using this class. So you can imagine there's a whole heap of lines in the display.
I have been trying very hard to make sure that the Vertical Scroll Bar is placed at the latest updated position. Could anyone help me with this one?
Any help will be appreciated!
This above all, to thine own self be TRUE.
William Shakespeare
|
|
|
|
|
I didn't try the following but I believe it should work:
1) Call long GetTextLength() to get number character
2) Call long LineFromChar( long nIndex ) to get line index
3) You may want to call LineLength() to get line length
4) Call LineScroll() by removing the offset of the GetFirstVisibleLine( ) .
CRichEditCtrl ctrl;
int nLine = ctrl.LineFromChar(ctrl.GetTextLength());
ctrl.LineScroll(nLine-ctrl.GetFirsVisibleLine());
Good luck!
One good thing about getting older, you don't lose the ages you've been!
|
|
|
|
|
Thank you Ernest!
It works great, thanks!
Life is like fishing. We are all waiting for a bite
|
|
|
|
|
I'm trying to programmatically size columns of a MSFlexGrid, but I don't understand, and have not been able to find documented, the proper way to do this.
In my case, I have a grid control on a dialog (it happens to be a tabbed dialog, but I don't know that that matters) and it will have 5 columns. I've put the following code in the OnInitDialog() function:
CRect rc;
GetClientRect(rc);
int Width = rc.Width();
Width /= (CellsPerRow + 1);
for ( int i=0; i < CellsPerRow+1; i++ )
{
m_TheGrid.SetColWidth(i, Width );
}
When this code executes, all the columns are tiny, scrunched up on the left side of the control.
The docs for SetColWidth indicate that the argument is in "twips".
I have not been able to figure out what the units of CRect are.
So one question is: How do I convert from the CRect unit to twips. Presumably this is screen resolution dependent.
Another question/problem that I'm sure I'll have to face is: how to I account for the width of the vertical scroll bar on the right of the control. I have the scroll bar enabled, and I'm betting that the GetClientRect probably includes the scroll bar in its area.
Ron
|
|
|
|
|
How do you work with _variant_t variables?
I had a few variables in my ADO code which were declared as VARIANTS.
I changed them to _variant_t, and now the function crashes.
Essentially this is what I used to do:
VARIANT var;
VariantInit(&ar);
var.vt = VT_BSTR;
///set the var.bstrval to some string value
::SysFreeString(&var);
Now, I want to do the same thing with _variant_t, but it doesn't work!
How do you handle this simple scenario using _vairant_t?
|
|
|
|
|
_variant_t is a wrapper. It will free the contents for you, that is what it is for.
Christian
I am completely intolerant of stupidity. Stupidity is, of course, anything that doesn't conform to my way of thinking. - Jamie Hale - 29/05/2002
|
|
|
|
|
You can change the code that you have to this:
variant_t var;
var = ::SysAllocString(L"HelloWorld");
that is it. No initialization, it contains casting operators, and it will clean up the mess.
BTW, If you use variant_t, you will want to use _bstr_t as well for your BSTRs.
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
Hi,
I have problems converting a bitmap to buffer
and displaying it
I create my hdc,
I use CreateCompatibleBitmap(),
I FillRect() with a color,
I use the function GetDIBits(...)?
GetDIBits(
MemDC,
SaveBitmap,
0,
(WORD) pvi->bmiHeader.biHeight,
pData,
pbi,
DIB_RGB_COLORS);
to put the bit map into my buffer (BYTE pData) and i'm
missing something to display it to screen
I know i can display a red colored background
using :
prgb = (RGBTRIPLE*) pData;
for (iPixel = 0; iPixel < numPixels; iPixel++, prgb++)
{
prgb->rgbtRed = 255;
prgb->rgbtGreen = 0;
prgb->rgbtBlue = 0;
}
but a non uniform bitmap????
Guibz
sguibord@aquadata.com
|
|
|
|
|
Create it as a DIBSECTION and you'll get access to the buffer by default. Chris has written a cool DIBSECTION wrapper here on CP.
Christian
I am completely intolerant of stupidity. Stupidity is, of course, anything that doesn't conform to my way of thinking. - Jamie Hale - 29/05/2002
|
|
|
|
|
I need to write a screen capture utility that runs as fast as possible. Because I'm dealing with notebook computers with relatively slow graphics hardware, I'd like to capture just the portion of the screen that has changed since the last time I did a capture (blt'ing the whole screen takes too long). Does anyone know how I can accumulate all the update regions on the screen that occur between successive screen captures? Thanks!
|
|
|
|
|
Most likely you will have to resort to a virtual video driver the same way that netmeeting does. There is a function called GetBoundsRect that will accumulate changes to a DC, but I have not been able to get it to work with a WindowsDC only memory DCs. So if you can get that to work more poer to you (and I would also like to know what you did to get it to work).
Besides that I have done quite a bit of work to capture the screen and the fastest that I could get my utility was about 800ms on a 1000Mhz machine. The bottleneck is sending the data from the video card memory to system memory.
Once again, look at how netmeeting accomplishes this, they incorporate a virtual video driver so all new screen updates are written to their buffer as well as the screen buffer.
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
You might want to have a look at the VNC source code. It's somewhere at AT&T research IIRC, but Google is your friend.
|
|
|
|
|
|
Try wrapping your string in a _bstr_t by including comutils.h. It converts between wide and narrow strings internally.
Christian
I am completely intolerant of stupidity. Stupidity is, of course, anything that doesn't conform to my way of thinking. - Jamie Hale - 29/05/2002
|
|
|
|
|
is this correct usage?:
_bstr_t test;
test = szCompletePath;
szCompletePath is a null terminated string (char szCompletePath[MAX_PATH]) and then pass test in a function that takes an LPOLESTR parameter?
thanks
|
|
|
|
|
That's fine, but
_bstr_t test(szCompletePath);
is better, because it is more efficient
Christian
I am completely intolerant of stupidity. Stupidity is, of course, anything that doesn't conform to my way of thinking. - Jamie Hale - 29/05/2002
|
|
|
|
|
But when i pass the test variable in the IShellFolder::ParseDisplayName function, it returns the error code -2147024809 which, accoring to the Error Lookup means "The parameter is incorrect.". Any ideas?
|
|
|
|
|
Dunno - it looks like it should be OK to me.
Christian
I am completely intolerant of stupidity. Stupidity is, of course, anything that doesn't conform to my way of thinking. - Jamie Hale - 29/05/2002
|
|
|
|
|
Try casting again the string to const WCHAR* (or const wchar_t*)
when calling ParseDisplayName , since that function need an OLE String.
Good luck!
One good thing about getting older, you don't lose the ages you've been!
|
|
|
|
|
Does anybody know of any articles describing the basics behind drawing lines between nodes. It would be a simple, general CAD tool which could be expanded to make programs for drawing flowcharts, electric circuitry diagrams, etc.
Haakon S.
|
|
|
|
|
are you talking about path-finding techniques to find the shortest path without crossing over your other components in your diagram?
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|