|
How can I check if the text inside a CEdit is numeric? I mean:
"2355345" Yes
"3452fsgd" No
"fsdgsdg" No
"sds334" No
I usually use the IsNumeric () function but it seems that in Visual C++ is not available... Can somebody help me?
|
|
|
|
|
You can choose to let the user enter only the numbers . Right click the edit box and set the number property to true. So in this manner the user won't be able to enter any text in the edit box(except number)
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
If you just want to allow only numeric value in the Edit Box, Go to property window and Set the Number property to True.
Or
If you want to validate it after user have entered the character, use Dailog Data Exchange (DDX) and Dialog Data Validate (DDV) in
DoDataExchange(CDataExchange* pDX) function.
Else
Scan the text and use isdigit() for each char.
If any one have better solution, pls let me know.
Anurag Gandhi.
|
|
|
|
|
Gosh!! Thank you very mucho to both of you.
As _AnShUmAn_ says, "Some things are hard to do UNTIL WE KNOW HOW TO DO THEM".
That´s true...
|
|
|
|
|
Most Welcome. It's my pleasure.
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
Try to use CRT function isdigit() or Windows API GetStringTypeEx().
|
|
|
|
|
Hi every one,
now I want to build a module about download http file with mylti thread.
I create several threads.Following is my code:
DWORD CMyThread::Execute( )
{
CInternetSession session;
CHttpFile* phttpFile = (CHttpFile*)session.OpenURL( m_strHttpFile,1,INTERNET_FLAG_TRANSFER_BINARY
|INTERNET_FLAG_RELOAD );
phttpFile->Seek( m_beginPosition,0 );//m_beginPosition is the position of http file that this thread begin to read
CFile localFile;
if( FALSE == localFile.Open(szLocalFileName,CFile::modeCreate|CFile::modeWrite|CFile::typeBinary,NULL))
{
return 0;
}
int readlen = -1;
BYTE buffer[1024];
int nTotalReadLen = 0;
while( 1 )
{
readlen = phttpFile->Read( buffer,1024 );//the second thread can't be running here until the first thread finished.
localFile.Write( buffer,1024 );
nTotalReadLen += readlen;
if( nTotalReadLen == m_size )//finish download the part,m_size is the part of the total size
{
localFile.Close( );
phttpFile->Close();
session.Close();
m_pFileDownLoader->SendMessage( T_MESSAGE_READ_FINISHED );
break;
}
}
}
but only the first one can running smoothly.the second stop in "pHttpFile->Read( )".but It can retrieve running Until the first finished.
How can I make the threads running at the same time?I am a fresh man in web programe ,If you have the instance about this ,please give me.thanks a lot.
|
|
|
|
|
Dear all
Hi
is there any example which uses SendMessage routine.
Regards
Monhi
|
|
|
|
|
There is (of course) a lot of doumentation about (with related samples), see, for instance http://msdn2.microsoft.com/en-us/library/ms644950.aspx[^].
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.
|
|
|
|
|
CPallini wrote: There is (of course) a lot of doumentation about (with related samples), see, for instance http://msdn2.microsoft.com/en-us/library/ms644950.aspx[^].
I wonder how you find these things.
Nobody can give you wiser advice than yourself. - Cicero
|
|
|
|
|
I wonder how the OP cannot!
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.
|
|
|
|
|
CPallini wrote: I wonder how the OP cannot!
Maybe you are lucky.;P
|
|
|
|
|
//LRESULT SendMesage ( HWND hWnd , UINT message , WPARAM wParam , LPARAM lParam )
//hWnd : Handle to window
//message : WM_***** message ( eg:EM_CLOSE , WM_PAINT ... )
wParam & lParam : additional message specific arguments
//MFC
//---
void CMyDlg::OnBnClickedOk()
{
SendMessage( WM_CLOSE , (WPARAM)0 , (LPARAM)0 ) ; //close current window
//or
::SendMessage( HWND_BROADCAST , WM_CLOSE , (WPARAM)0 , (LPARAM)0 ) ; /*close desktop windows */
};
//WIN32
//
//#include<windows.h>
LRESULT OnAnyEvent( HWND hWnd )//invoked from windowproc
{
SendMessage( hWnd , WM_CLOSE , (WPARAM)0 , (LPARAM)0 ) ;
}
//Visit msdn for complete reference for Windows Messages
|
|
|
|
|
|
pls let me knowHow to block Alt+F4 for any dialogbox
There Is Nothing Right & Wrong
|
|
|
|
|
Do you *really* want to block the keys or you want to do something else when the [X] button is clicked? Blocking the ALT + F4 keys can be done by overriding PreTranslateMessage() . If you want to handle the [X] button too, handle the WM_CLOSE message.
found at bash.org
[kernx]|.|.|.|.|.|.|.|
[kernx]sorry, wrong window
[beox33]say me why in the f*ck will you type that in any window
|
|
|
|
|
Hi,
How can i remove temporary internet file programmatically, i get the Temporary internet files path by calling SHGetSpecialFolderPath function, but when i call the function remove by appending file name it is unable to delete that file, and GetLastError returns 123(The filename, directory name, or volume label syntax is incorrect.). Any Help regarding this
Warm Regards,
Mushq
|
|
|
|
|
|
Thanks a lot for the help, i have done my work
|
|
|
|
|
|
Hi All,
I am new to programming in VC++. I need to know whether there is any func available to convert text file from DOS mode to UNIX mode. I am using CStdioFile class for read and write of the file. Is it possible to convert the file. I need to modify a file in DOS based environment and then ftp it back to a UNIX environment. Is there anyway of doing it without using binary mode to read/write the file.
Thanks in advance!!!!!
|
|
|
|
|
If you are using a "standard" FTP client program, just use the text mode (as opposed to binary mode) for the FTP transfer.
Text mode will do the conversions for you.
Alcohol. The cause of, and the solution to, all of life's problems - Homer Simpson
|
|
|
|
|
Unfortunately, you have to use binary mode (though it's not such a pain).
Anyway others have already done what you are searching for (Google is you best friend), for instance http://www.bastet.com/[^].
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.
|
|
|
|
|
Hello everyone
I am making an application in VC++ 6.0 and MySQL my requirment is that I Want to save MS Word file in database how can i do it.
How i will be upload these file to database .
Actually I want save file in a folder (at local server) and want to save file name in database .
Please any one help me ...
If possible give some link of such type of application.
Regard's
Kaushik
|
|
|
|
|
Hi all,
For some or other reason I always receive this dame error: Linker Tools Error LNK2019
What I did was download the source code for the article "A set of ODBC Classes", and included it into my project. Complied it and received a linker error for every call to the ODBC class. Can someone please help me with this.
I.E
error LNK2019: unresolved external symbol "public: void __thiscall CODBCDatabase::Close(void)" (?Close@CODBCDatabase@@QAEXXZ) referenced in function _main
...
Many thanks.
Regards,
The only programmers that are better than C programmers are those who code in 1's and 0's.....
Programm3r
My Blog: ^_^
|
|
|
|