|
hi!
try pretranslatemessage function...
BOOL CDlg::PreTranslateMessage(MSG* pMsg)
{
if(pMsg->wParam == VK_RETURN) // if enter key pressed return true
return TRUE;
return CDialog::PreTranslateMessage(pMsg);
}
hope it helps...
newbie
|
|
|
|
|
This is a good idea Newbie,
But it will block Enter Key through out the dialog box. Not only for Some Buttons.
Anurag Gandhi.
|
|
|
|
|
THANK YOU!!!
THIS IS THE BEST FORUM I´VE EVER VISITED. That worked!
Thank you ginjikun.
|
|
|
|
|
It is not recommended to override PreTranslateMessage() for this purpose.
The reply in This thread is fine.
Nobody can give you wiser advice than yourself. - Cicero
|
|
|
|
|
In this case, Check if your Ok Button is your Default Button.
If not Make it, Then only it will work.
Anurag Gandhi.
|
|
|
|
|
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
|
|
|
|
|
Y_Kaushik wrote: I Want to save MS Word file in database how can i do it.
This should get you started. Loading image files from a database, using ADO[^]
Y_Kaushik wrote: Actually I want save file in a folder (at local server) and want to save file name in database .
That's a better way of handling it I think. If the folder on the server is shared copy the image there and save the image name / location in the db.
|
|
|
|
|
hi!
i would like to ask what is the best way to store and sort (e.g. priority queue,multimap,sorted vector, etc) my date which consist of 2 criterias.
first is the priority, then according to group.
sample is...
priority 1, group1
data 1
data 2
priority 1, group 2
data 1
data 2
data 3
priority 2, group 4
data 1
group 5
data 1
...
each group may consist of 1 or more data
i was thinking of priority_queue however some of the data are stored til the end of the application. i am not sure if queue have somekind of peek method.
and vector using sort method, but the data are added throughout the lifetime of the application indefinitely and not just 1 time... sort may be too expensive to be called many times.
thanks for any help!
newbie
|
|
|
|
|
Explain in deatail.... What is your actual requirment
I thnink your question is incomplete
Regard's
Kaushik
|
|
|
|
|
Hi Kaushik
thanks for the response!
the requirement is to store according to priority and group each of the data that are received.... receiving of data happens indefinitely (e.g. every 1 second/5seconds)
each data as mentioned should be arranged according to their priority and group they belong. thus the list should look something like below
priority 1
group 1
data 1
data 2
group 2
data 1
group 3
data 1
data 2
priority 2
group 4
data 1
group 5
data 1
data 2
...
the group number is unique, thus there can only be a single group 1 in the entire list... and so on...
the question is how to efficiently implement this. keeping in mind that the data coming in may occur every second or maybe less... also the data are stored indefinitely depending on the priority.. e.g. priority 1 may be removed after processing but priority 2 after processing will stil remain in the list...
sorry for the lenghty explanation...
thanks again for any response!
newbie
|
|
|
|
|
Perhaps this will give you some ideas:
--------------------------------------
// Console.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <iostream>
#include <ostream>
#include <deque>
#include <set>
#include <iterator>
class CData
{
public:
CData(int priority, int group)
: priority_(priority)
, group_(group)
{}
// Define the sorting criteria.
friend bool operator<(const CData &l, const CData &r)
{
if (l.priority_<r.priority_)
{
return true;
}
else
{
return l.priority_==r.priority_ && l.group_<r.group_;
}
}
int priority_;
int group_;
};
// So we can output the data to the console.
template <typename CH, typename TR>
inline std::basic_ostream<CH, TR>& operator<<(std::basic_ostream<CH, TR> &os, const CData &d)
{
os << "Priority: " << d.priority_ << std::endl;
os << "Group: " << d.group_ << std::endl;
return os;
}
typedef std::set<CData> DataCollecton_t;
int main(int arvc, char* argv[])
{
// Populate the collection.
DataCollecton_t coll;
coll.insert(CData(3, 2));
coll.insert(CData(3, 3));
coll.insert(CData(2, 2));
coll.insert(CData(1, 1));
coll.insert(CData(2, 3));
coll.insert(CData(1, 2));
coll.insert(CData(2, 1));
coll.insert(CData(1, 3));
coll.insert(CData(3, 1));
// Print the results.
std::copy(coll.begin(), coll.end(), std::ostream_iterator<CData>(std::cout));
return 0;
}
Steve
|
|
|
|
|
Hi Steve!
thanks for the reply!
im sure your post will give me some idea and help me great deal.
thanks again!
newbie
|
|
|
|
|
I have to create uninstall software which can uninstall any software installed in my pc.
Can anyone help me?
Mazhar
|
|
|
|
|
|
Hi every one,
now I want to build a module about download http file with multi 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.
|
|
|
|
|
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
|
|
|
|