|
hi,
I am drawing these engineering related drawings that need a lot of pre calculation for neat display before actually being rendered to the user.Every time.Zooming included.I (naturally) used CreateCompatibleDC() function,drew onto that, calculated stuff and continued from there.
The problem arises while scrolling.I set the scrolling sizes according to the bounds of the drawing plus spaces.The bound is calculated as said earlier.When i scroll, things get eaten away.However, moving the drawing slowly using the arrow keys works fine.
Why is this happening?Help.Drawing is the soul and life and ... of my sw
Kofi Ntini
|
|
|
|
|
It sounds like the scrolling is not invalidating the correct part of the window.
Software Zen: delete this;
|
|
|
|
|
Sir, I want to develop OutSmtp type application. For that it is necessary to find out MX Record for a particular domain. For example if the To: address is abc@xyz.com, first of all I have to find out the mail server of xyz.com.
How can I get the MX Record of a domain? Please help me....
C.R.Naik
|
|
|
|
|
You should get it from the DNS.
NSLookup might help.
|
|
|
|
|
Sir, is it possible with NSLookup to find MX Record programmatically? If so please send me any code if you have.
Regards.
C.R.Naik
|
|
|
|
|
Look at the DnsQuery and associated routines. Also, check the SMTP RFC for the proper fallback searches for when MX records don't exist.
One problem with DnsQuery is that it isn't support on 9x or NT4. I haven't found an alternative.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
Hi,
What is the diffrence between MultiByteToWideChar() and mbstowcs()?
Which API should we make a choice?
Thanks and Merry Xmas!
David
|
|
|
|
|
MultiByteToWideChar() belongs to the Platform SDK whereas mbstowcs is a C Runtime function.
If your application will be only for windows platforms use the first one. If your app may be ported to other platforms use the runtime function.
Gero
|
|
|
|
|
I see. Thank you very much.
|
|
|
|
|
Hi all,
how can I get the DOS environment variables and their substituted values? Microsoft suggests the function GetDOSEnvironment but even MSDN seems not to know this function...
I think I've seen an enumeration function somewhere but I don't know any more where it was.
Thank you in advance!
-Dominik
|
|
|
|
|
Try GetEnvironmentStrings() [^]. This function returns the entire environment block for the current process. The block is laid out as follows:
name1=value1\0
name2=value2\0
...
nameN=valueN\0
\0 where each name,value pair are separate by a zero character, and the block is terminated by a final zero character.
Software Zen: delete this;
|
|
|
|
|
Thank you very much!!!
|
|
|
|
|
Hi,
Merry Xmas!
I read some articles about Unicode in MSDN. But the sample code about Unicode function,mbstowcs(),in MSDN puzzled me.
The sample's URL:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore98/html/_crt_mbstowcs.asp
My questions are:
1.In the sample code, I think return value of wcstombs()
and mbstowcs all should not be 1.
I think string L"Hi" should has 4 bytes, and the
corresponding MBCS string, "Hi", should
be 2 bytes.
2.The first char of MBCS string after call wcstombs()
should be 'H', while the sample output was 0x0e1a.
3.Unicode byte pointer, pwc, was only allocted one Unicode
char room for. But it received Unicode char string,
which had 2 Unicode chars,in function call mbstowcs().
4.Suppose we have a Unicode string, which has an English
char 'a' and a Chinese char '人'...
int k;
CString strTest = "a人";
wchar_t strMsg[100];
memset(strMsg,L'\0',sizeof(strMsg));
k = mbstowcs(NULL,(LPCTSTR)strTest, MB_CUR_MAX);
k = mbstowcs(strMsg,(LPCTSTR)strTest, MB_CUR_MAX);
a."k" value after first call of mbstowcs() is 3.
Why not 4?
b."k" value after second call of mbstowcs() is 1.
Why not 4 or 2?
And now, the Unicode string, strMsg, only has one
Unicode char, 97!(Watch in VC6/Debug).
Why?
Thanks.
============================================================
/* MBSTOWCS.CPP illustrates the behavior of the mbstowcs function
*/
#include <stdlib.h>
#include <stdio.h>
void main( void )
{
int i;
char *pmbnull = NULL;
char *pmbhello = (char *)malloc( MB_CUR_MAX );
wchar_t *pwchello = L"Hi";
wchar_t *pwc = (wchar_t *)malloc( sizeof( wchar_t ));
printf( "Convert to multibyte string:\n" );
i = wcstombs( pmbhello, pwchello, MB_CUR_MAX );
printf( "\tCharacters converted: %u\n", i );
printf( "\tHex value of first" );
printf( " multibyte character: %#.4x\n\n", pmbhello );
printf( "Convert back to wide-character string:\n" );
i = mbstowcs( pwc, pmbhello, MB_CUR_MAX );
printf( "\tCharacters converted: %u\n", i );
printf( "\tHex value of first" );
printf( " wide character: %#.4x\n\n", pwc );
}
Output
Convert to multibyte string:
Characters converted: 1
Hex value of first multibyte character: 0x0e1a
Convert back to wide-character string:
Characters converted: 1
Hex value of first wide character: 0x0e1e
============================================================
|
|
|
|
|
Hi,
Merry Xmas!
I have a Unicode string variable, wcsMsg:
wchar_t wcsMsg[100];
Net API NetMessageBufferSend() needs a LPBYTE type variable to act as its third parameter.
May I transfer the third parameter as below:
NetMessageBufferSend(...,(LPBYTE)wcsMsg,...)
I am worry about if or not this behavoir will lead to missing data in that Unicode string while transfering parameter.
Thanks for your help!
|
|
|
|
|
It should work fine. The buffer parameter is specified as [in], so receiver uses the text as read-only field. As long as you correctly specify buffer length (next parameter, in bytes, not in chars), receiver should be able to handle the text correctly.
Вагиф Абилов
MCP (Visual C++)
Oslo, Norway
Hex is for sissies. Real men use binary. And the most hardcore types use only zeros - uppercase zeros and lowercase zeros.
Tomasz Sowinski
|
|
|
|
|
|
hi
i have some CWnd object on the main window. each of them should to be transparent. each CWnd object contain a little bitmap that i draw it with double buffer technique.
even i move one of them i have to Invalidate(); that window to stop being affected by another windows content.
but Invalidate() a window cause Flickers badly .
is there any way to stop these fickers ?
///////////////////////////
void CTESTView::OnMouseMove(UINT nFlags, CPoint point) {<br />
b.LoadBitmap(IDB_BITMAP1);<br />
BITMAP bm;<br />
<br />
b.GetObject(sizeof(BITMAP),&bm);<br />
CClientDC h1(cw[1]);<br />
<br />
CDC *dc=new CDC;<br />
dc->CreateCompatibleDC(&h1);<br />
dc->SelectObject(&b);<br />
h1.SelectObject(cf);<br />
<br />
h1.BitBlt(0,0,bm.bmWidth,bm.bmHeight,dc,0,0,SRCAND);
<br />
cw[1]->Invalidate();<br />
cw[1]->MoveWindow(point.x,point.y,26,26,true);<br />
}
///////////////////////////
|
|
|
|
|
HellShrimp4free wrote:
each CWnd object contain a little bitmap that i draw it with double buffer technique
Not according to your code.
Also, you might consider to create the CDC "dc" on the stack instead of on the heap, that way you won't forget to delete the object (your current code _will_ crash after n mouse moves). :->
For examples of ways you could improve speed (and in the end help remove the flicker):
- Only load the bitmap once, probably at construction of CTESTView.
- The same goes for GetObject for that bitmap.
- Only invalidate the source rect and the destination rect of your view within the window (InvalidateRect instead of Invalidate - but maybe your "cw[1]" is only for your view/HWND rect?). Maybe even prefer to only tell Windows to invalidate (and repaint) the background on the old rect. There's no need to invalidate the background on the dest rect - you are after all going to overwrite it (maybe this is also done - it's however not possible to judge by this code).
- Do use double buffering - in the window's WM_PAINT handler (set up a bitmap, create a compatible DC... Well, you know the drill) and only when the painting is done you Blt it onto the screen.
- If you are just dragging around some gfx object, you could consider to make a bitmap representation of it (in the Window, not in the view) and just blit around the representation until you finally drop the Window/View, and just then you let the Window/View start handling its own drawing, at the new position.
The way I once did something similar was to trap NC_HITTEST and tell Windows "yup, this is HT_CAPTION" and then let Windows handle the movement of the child window within the parent (let me tell you it surprised me to no end when I got it wrong at first, and instead of selecting text in an EDIT control, I started to drag it around inside its parent frame! ).
|
|
|
|
|
How can I get information about installed graphic card?Any specific API or anywhere in registery?
Mazy
"And the carpet needs a haircut, and the spotlight looks like a prison break
And the telephone's out of cigarettes, and the balcony is on the make
And the piano has been drinking, the piano has been drinking...not me...not me-Tom Waits
|
|
|
|
|
Take a look on DirectX (DirectDraw) ... I think you can get information about your installed graphic card with the DirectDraw - Interface.
Daniel
---------------------------
Never change a running system!
|
|
|
|
|
Hello everybody.
Once, I'm in need of catching even when a tab key is pressed. I've tried WM_KEYDOWN, WM_CHAR, MENU KEY, ... But it doesn't work. Can anyone help to catch the tab key even.
Thanks in advance.
NHH.
|
|
|
|
|
You should probably override PreTranslateMessage .
Merry XMas to you,
Bartosz Bien
|
|
|
|
|
Hello Bartosz Bien,
I've followed your help, and it works fine.
Thank you very much.
Have a good time.
|
|
|
|
|
just moved from a 266mhz to a 1.2g laptop
Will MS VC++ 6.0 with sp5 work and be stable on XP? That is the only licensed version I have.
Thanks
Joe
"You can't throw yourself a parade every time you win, and you can't bury yourselves when you lose."-Levon Kirkland Philadelphia Eagles
|
|
|
|
|
JoeSox wrote:
Will MS VC++ 6.0 with sp5 work and be stable on XP?
Work, yes. Stable, mostly. VC 6 crashes about once a day on my XP box at work, which is a shame because I've never had VC crash on non-XP. Thus I blame XP
--Mike--
If it doesn't move and it should: WD-40. If it moves and it shouldn't: duct tape.
1ClickPicGrabber - Grab & organize pictures from your favorite web pages, with 1 click!
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
|
|
|
|
|