|
HI ,
How to check whether a string does not contain any data other that 'A' - 'Z' or '0' - '9'
is there any API available
|
|
|
|
|
You could use CString::SpanExcluding if you're using MFC.
Otherwise use the strcspn function.
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
pandit84 wrote: How to check whether a string does not contain any data other that 'A' - 'Z' or '0' - '9'
You can use _istalnum , _isalnum function...
bool IsValidAlNumStr( LPCTSTR lpctszStr )
{
while( *lpctszStr )
{
if( !_istalnum(*lpctszStr ))
return false;
++lpctszStr;
}
return true;
}
|
|
|
|
|
Hi,
How can i retrive console's code page information from a c++ application.
I need the similar information as we got from "chcp" command.
Thanks in advance.
birajendu
CyberG India
Delhi
India
|
|
|
|
|
The active code page can be retrieved using GetACP() function.
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
Thanks,
still i have some problem.
When i run the application on a japanese XP/Vista the GetACP() gave me 932 whichi is correct.
Than i changed the code page to 437 thru MOD CON CODEPAGE SELECT=437 command. after this command also GetACP() function returns 932 in both XP and Vista machines. Yes i am running the application in same console in which i have changed the code page.. Can you please suggest whre i am doing wrong..?
birajendu
CyberG India
Delhi
India
|
|
|
|
|
|
Following CLI resurns me a correct argc as 5 (1 name of exe and 4 parameters)
-targetpath "C:\tmp" -targetserver vm-w23-btk02\sql2k5
but if i add \ after tmp , argc is 3
-targetpath "C:\tmp\" -targetserver vm-w23-btk02\sql2k5
so main function ignores all the parameters after "C:\tmp\" and return always 3
but if i put a escape character as "C:\tmp\\" then argc is correct as 5
but since these command is entered by user on command prompt , it is not advisable to ask user to put escape character at the end so what is a soluation to get correct number of count.
Why \ at then end of c:\tmp ignores rest of the parameters ?
Without putting a escape character as "C:\tmp\\" , How can i get correct argc ?
Also if i removed double quotes , then its returns correct argc , Only if a path include quotes and ends with \ then argc is incorrect.
int cMyclass::Main(int argc, char **argv)
{
return 0
}
-Thanks
Sandeep
modified on Monday, June 1, 2009 2:20 AM
|
|
|
|
|
Are you giving that in code?
Try and print the contents of argv in the main function.
You would get a better understanding of the situation.
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
Why require a trailing backslash? Your code should be able to handle either form.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Hi,
Would anyone know what triggers CasyncSocket::OnSend
the first time after I issue ::connect
I get notification for ::OnSend
however I am not ready send any data that after it never gets called
|
|
|
|
|
This is an excerpt from MSDN.
Called by the framework to notify the socket that it can now send data by calling the Send member function.
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
How about
How About AsyncSelect(FD_Write)
right before you are ready to send
|
|
|
|
|
Called by the framework to notify the socket that it can now send data by calling the Send member function.
// As what msdn says, when the socket's send buffer has spaces and you can call send() function to
// send data, the framework will call this function to notify you.
// FYI, when you call send() function, it doesn't mean really sending data, it means puts data to
// the send buffer.
|
|
|
|
|
MFC dose so...
It is just time to be able to send data however your code is ready or not.
If you do not call ::connect(), ::OnSend() will never come up.
|
|
|
|
|
Hello Can anybody help me with a program in c for gsm or for chat between two computers?
|
|
|
|
|
agetina wrote: Hello Can anybody help me with a program in c for gsm or for chat between two computers?
Hello, I would first choose between the two projects and then ask.
BTW: see [^].
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
i have the following problm:SDI appliction based on CRichEditView, in the output window the Vertical scrollbar does not scroll auomatically till the last line in the output.
CRichEditView* ptrOutput;
ptrOutput->SetScrollRange(....);
ptrOutput->SetScrollPos(....);
the thumb goes down and then back again to the top of the window.
How can i solve this? Please help.
|
|
|
|
|
Please try this -
ptrOutput->GetRichEditCtrl().LineScroll(0x7FFFFFFF);
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
Thanks for your help it works but the text in the outputput window is hidden till i click the vertical scroll bar?? please help to fix this problem.
|
|
|
|
|
Please help me out of this as I am not able to get the output
|
|
|
|
|
Hello,
I have made dlls using VC++ of my classes which pure c++ . Will they be compatible with Turbo C and Borland C++
Priya
|
|
|
|
|
Seems unlikely if they resolve exports by name rather than ordinal - C++ exports are mangled, and most different compilers use different mangling schemes.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
I can't attach my code, so I linked my blog's post;
that post has attachment of my code
http://memolog.blog.naver.com/ytkim4558/176[^]
This source examples for my project
this is MFC source code.
When I dragged scrolling picture, It happened line...
sorry, I poor in English.
I thought this problem can solve with double buffering, but
all example, before I aleady saw, were have no component like edit box.
and under code is part of my code.
void CChild2::OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
{
// TODO: Add your message handler code here and/or call default
int yInc=0, yMove=0;
int nYCur=GetScrollPos(SB_VERT);
int nMin=0, nMax=0;
CRect crt;
switch (nSBCode)
{
case SB_LINEUP:
yInc=-1;
break;
case SB_LINEDOWN:
yInc=1;
break;
case SB_PAGEUP:
yInc=-20;
break;
case SB_PAGEDOWN:
yInc=20;
break;
case SB_THUMBTRACK:
case SB_THUMBPOSITION:
yInc=nPos-nYCur;
break;
default:
break;
}
GetClientRect(&crt);
GetScrollRange(SB_VERT, &nMin, &nMax);
nMax-=crt.bottom;
yMove=nYCur+yInc;
if (nYCur+yInc < nMin)
{
yInc=-nYCur;
}else if (nYCur+yInc > nMax)
{
yInc=nMax-nYCur;
}
nYCur=nYCur+yInc;
ScrollWindow(0, -yInc);
SetScrollPos(SB_VERT,nYCur);
// InvalidateRect(NULL);
CDialog::OnVScroll(nSBCode, nPos, pScrollBar);
}
void CChild2::OnSize(UINT nType, int cx, int cy)
{
CDialog::OnSize(nType, cx, cy);
// TODO: Add your message handler code here
SCROLLINFO si;
int nYCur=0;
if (bStartReSize==TRUE)
{
nYOrgHeight=cy;
bStartReSize=FALSE;
}
nYCur=GetScrollPos(SB_VERT);
si.cbSize=sizeof(SCROLLINFO);
si.fMask=SIF_ALL | SIF_DISABLENOSCROLL;
si.nMin=0;
si.nMax=nYOrgHeight;
si.nPage=cy;
si.nPos=nYCur;
SetScrollInfo(SB_VERT, &si, TRUE);
}
BOOL CChild2::OnEraseBkgnd(CDC* pDC)
{
// TODO: Add your message handler code here and/or call default
// 사용자가 정의한 배경 그리기 루틴이 CDialog::OnEraseBkgnd 함수보다 먼저
// 위치하면 기본 대화상자 그리기 루틴에 의해서 아무것도 나오지 않는다. 따라서
// 항상 자기가 표시하고 싶은 정보는 CDialog::OnEraseBkgnd 함수보다 아래쪽에
// 정의 해야한다.
BOOL ret = CDialog::OnEraseBkgnd(pDC);
CRect r;
// 대화상자의 크기를 얻는다.
GetClientRect(r);
// 현재 DC에 자신이 생성한 블러쉬를 사용하도록 설정한다.
CBrush *p_old_brush = pDC->SelectObject(&m_bk_brush);
// 대화상자의 크기보다 패턴블러쉬에 사용된 이미지가 작다면 Tile 형식으로
// 이미지가 채워진다.
pDC->Rectangle(r);
// 이전에 사용한던 블러쉬로 복구한다.
pDC->SelectObject(p_old_brush);
return ret;
}
BOOL CChild2::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
// 리소스 파일에서 비트맵을 읽어 들인다.
m_logo_bitmap.LoadBitmap(IDB_BITMAP3);//4
// 읽어 들인 비트맵을 이용하여 패턴 블러쉬를 생성한다.
m_bk_brush.CreatePatternBrush(&m_logo_bitmap);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
modified on Sunday, May 31, 2009 5:12 AM
|
|
|
|
|
Your blog is in Chinese, a language most of us don't speak.
From your code you ommitted the most important part, the OnPaint function.
Not knowing what you have there I can only give you general advises.
If you have a picture in the window, when you paint the background you delete the picture, and after that you paint it again. That will cause flickering.
Repaint the background only in the portions where there is no other graphics. Basically make sure that during a repaint of the window, every pixel is repainted only once.
Never clear anything from the window. Just overwrite.
Double buffering is the best, just don't forget, dont delete anything from the screen and don't repaint the background where it's not necessary. Only overwrite.
Do not use ScrollWindow to scroll the image, repaint everything to the nev position. If your window is partially covered by another window, the portion of the image scrolled out from under the other window will be black (or whatever the background color is).
If you're trying to scroll the controls form a dialog box, you don't need graphics processing.
Each control in the dialog is a window. Obtain a CWnd* pointer to each of them using GetDlgItem, then move the control using MoveWindow.
Frankly I think scrolling controls is a very unusual way to deal with dialogs. If you have too many controls you should consider using multiple dialog boxes, or maybe, a property page.
|
|
|
|