|
Hi,
I am new to DB programming.
I get a dialog during the execution of programming when using Database
"Select Data Source" dialog.
I had already created a CDatabase object and initialized the DSN name, user name password in the OpenEx() call of it.
When I try to use the CRecordSet object to access the database, this dialog box pop up.
I cross checked the ODBC DSN name and it is set right. why this dialog box pops up in between..
Can someone help me out on this.
thanks,
|
|
|
|
|
What do your call(s) to CDatabase::OpenEx() and CRecordset::Open() look like?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Try opening the database using CDatabase::OpenEx and specifying the CDatabase::noOdbcDialog flag.
I have a feeling it's going to fail since the dialog is popping up because you haven't passed
enough info in your connection string. The flag will prevent the dialog from popping up
though!
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Hello Friends,
I converted Control Panel MFC Dll VC++ 6.0 project into MFC Dll VC++ 2005.The project build successfully and it is working fine on windows xp, but when i executed on windows 2003 on OK/Cancel button click it gives error of "An Exception occur when trying to run Shell32.dll, control_run.dll".
The root of this problem according to my observation is- CImageList by which an object created as---
ImageState.Create(IDB_SELECTED_STATE,32,0,0);
m_listPartition.SetImageList(&ImageState,LVSIL_STATE);
If i hide first line then code works fine...
I want to know it is the problem of VS 2005 or Windows Platform
or i have to put particular service pack on m/c for that
as currently my m/c win2003 + service pack 1
Any comments on this problem............
|
|
|
|
|
Dear all,
i must read ye tiff image and draw histogram for it without using classes how can i do it at C++
thnx alot
ndadashi
|
|
|
|
|
Please be more certain. You mean without not 3th part library support or with no classes at all [the later seems meaningless though]? And what kind of histogram? What is the relationship between the tiff image and the histogram?
--
=====
Arman
|
|
|
|
|
I am bigener at c++, I need a comand for reding a file byte by byte, I cant use image classes
thnx
neda
|
|
|
|
|
Use std::ifstream to open the file and then use ifstream::read method to read bytes from the file.
--
=====
Arman
|
|
|
|
|
Is it more urgent then this question? The double posting let me assume so, generally it's better to ask a specific programming question... instead of asking others to do your homework or find a solution for a work assignment.
|
|
|
|
|
I don't want to do my homework, I am a beginer and I have problem reading a file byte by byte I just ask for some help
thnx for advise
neda
|
|
|
|
|
Reading a file byte by byte as absolutely nothing to do with drawing an histogram. So, your question is totally unclear.
A previous post already answered how to read the file.
|
|
|
|
|
ndadashi wrote: I don't want to do my homework, I am a beginer and I have problem reading a file byte by byte I just ask for some help
Oh please be frank, you have asked for a complete solution not how to read a simple file... here what I would suggest: Brake down your problem and try to ask specific technical questions if you get stuck. Let's look at your task:
1) open file and read it into memory
2) analyse image file format and e.g. decompress it to raw RGB data (e.g. use a library that provides that)
3) use histogram algorithm (very likely out of scope for this forum)
4) create a user interface that can output your data. If you want a graph of the historgram you should browse for custom controls here at CodeProject or alternatively write your own owner-draw control to do that.
5) extend your user interface to modify the histogram.... and further functionality you may want add to your application.
With each subtask it may be possible to help, now go get coding!!
|
|
|
|
|
Hi !
In my application when i debug it. it gives me the the following result in the call stack.
> msvcr80d.dll!strlen(unsigned char * buf=0x0235b848) Line 81 Asm //crashed here msvcp80d.dll!std::char_traits<char>::length(const char * _First=0x00000000) Line 559 + 0x9 bytes C++
msvcp80d.dll!std::basic_string<char,std::char_traits<char>,std::allocator<char> >::assign(const char * _Ptr=0x00000000) Line 1042 + 0x9 bytes C++
msvcp80d.dll!std::basic_string<char,std::char_traits<char>,std::allocator<char> >::basic_string<char,std::char_traits<char>,std::allocator<char> >(const char * _Ptr=0x00000000) Line 644 C++
DRMClient.exe!openutils::WebForm::putVariable(const char * var_name=0x0047f694, const char * value=0x00000000) Line 142 + 0x12 bytes C++
DRMClient.exe!Package::GenerateConfigurePackageRequest(std::basic_string<char,std::char_traits<char>,std::allocator<char> > uid="", std::basic_string<char,std::char_traits<char>,std::allocator<char> > host="", std::basic_string<char,std::char_traits<char>,std::allocator<char> > scriptFile="", unsigned short port=1100, HWND__ * hwndParent=0x00230a58, std::basic_string<char,std::char_traits<char>,std::allocator<char> > sInitPackagingResponse="", wchar_t * w_KeyID=0x003c57b8, HWND__ * hList=0x00080e0c, TagEditor * _ProtectSet=0x00488ab0, HWND__ * hWndinoutfiledir=0x00040b72, wchar_t * pszOutFile=0x0012c91c) Line 872 C++
DRMClient.exe!Package::EncodeMediaContent(wchar_t * pszInFile=0x0012e7f0, wchar_t * pszOutFile=0x0012c91c, HWND__ * hwndParent=0x00230a58, std::basic_string<char,std::char_traits<char>,std::allocator<char> > Host="", std::basic_string<char,std::char_traits<char>,std::allocator<char> > UserID="", std::basic_string<char,std::char_traits<char>,std::allocator<char> > InitPackageRequest="", std::basic_string<char,std::char_traits<char>,std::allocator<char> > ScriptFile="", unsigned short Port=1100, HWND__ * hList=0x00080e0c, TagEditor * _ProtectSet=0x00488ab0, HWND__ * hWndinoutfiledir=0x00040b72, HWND__ * hwndEncrypt=0x00230a58) Line 964 + 0xfc bytes C++
DRMClient.exe!Thread(void * pArguments=0x0012c874) Line 145 + 0x12d bytes C++
msvcr80d.dll!_callthreadstartex() Line 348 + 0xf bytes C
msvcr80d.dll!_threadstartex(void * ptd=0x003c9fe0) Line 331 C
I didnt understad why I got the first thread value every time.
and then the application crashed !
"Success lies not in the result , But in the efforts !!!!!"
Amit Mistry - petlad -Gujarat-India
|
|
|
|
|
From the title I guess you have a multithreading app, isn't it? The errors say nothing valueable unless you describe at which conditions you got them. Here I suspect you have a problem with synchronization issues [particularly, your std::string object gets corrupted by concurrent accesses within the threads]..
--
=====
Arman
|
|
|
|
|
Arman Z. Sahakyan wrote: From the title I guess you have a multithreading app, isn't it? The errors say nothing valueable unless you describe at which conditions you got them.
ya!
Arman Z. Sahakyan wrote: Here I suspect you have a problem with synchronization issues [particularly, your std::string object gets corrupted by concurrent accesses within the threads]..
yes!
when I debug, some time i got some strange values which is actually related with some other thread.
"Success lies not in the result , But in the efforts !!!!!"
Amit Mistry - petlad -Gujarat-India
|
|
|
|
|
Are you doing proper syncronization? I know you do not.
You should prevent multiple accesses to your string data by giving the monopoly to a single thread at a given time period. std classes are not thread safe. This means you should yourself take care of synchronizing their usage.
See here[^] about synchronization issues.
--
=====
Arman
|
|
|
|
|
|
This is in response to your email to me. I have not worked too much on threads, but will surely help you if I could. My suggestion is that you post it at CP, and you will get plenty of us. Moreover, threads are not something that I've mastered.
|
|
|
|
|
I have tried out my way but not getting the proper result.
string problem is as remain as but even dw never goes in the any of the cas like
case WAIT_OBJECT_0 + 1: +2 or +3.
what should I do ?
how can i manage it ?
<code>
unsigned __stdcall Thread(void* pArguments )
{
HRESULT hr=NULL;
struct argument_list *Lparam= (argument_list *)pArguments ;
Package pkg;
DWORD dw=WaitForMultipleObjects(ListBoxItemCount,hThread,TRUE,5000 );
switch (dw)
{
case WAIT_OBJECT_0 + 0:
hr=pkg.EncodeMediaContent(Lparam->pszInFile,Lparam->pszOutFil,Lparam->hwndParent,Lparam->Host,Lparam->UserID,Lparam->InitPackageRequest,Lparam->ScriptFile,Lparam->Port,Lparam->hList,Lparam->_ProtectSet,Lparam->hWndinoutfiledir,Lparam->hwndEncrypt);
break;
case WAIT_OBJECT_0 + 1:
hr=pkg.EncodeMediaContent(Lparam->pszInFile,Lparam->pszOutFil,Lparam->hwndParent,Lparam->Host,Lparam->UserID,Lparam->InitPackageRequest,Lparam->ScriptFile,Lparam->Port,Lparam->hList,Lparam->_ProtectSet,Lparam->hWndinoutfiledir,Lparam->hwndEncrypt);
break;
case WAIT_OBJECT_0 + 2:
hr=pkg.EncodeMediaContent(Lparam->pszInFile,Lparam->pszOutFil,Lparam->hwndParent,Lparam->Host,Lparam->UserID,Lparam->InitPackageRequest,Lparam->ScriptFile,Lparam->Port,Lparam->hList,Lparam->_ProtectSet,Lparam->hWndinoutfiledir,Lparam->hwndEncrypt);
break;
case WAIT_FAILED:
break;
case WAIT_TIMEOUT:
break;
}
if(hr==S_OK)
{
MessageBox(0,L"thread gone finished" ,L"therad",0);
_endthreadex( 0 );
}
</code>
"Success lies not in the result , But in the efforts !!!!!"
Amit Mistry - petlad -Gujarat-India
|
|
|
|
|
Supposedly the case WAIT_FAILED works. Anyway ...
A couple of questions;
DWORD dw=WaitForMultipleObjects(ListBoxItemCount,hThread,TRUE,5000 );
What you want to do with this code? Where does LitBoxItemCount come from? Where does hThread come from?
How many threads do you have?
I need to know the answers of these questions before I can say the reasons of your problem.
--
=====
Arman
|
|
|
|
|
May I send you detail on your email?
because the proper format and written mail is ready.
May I ...?
"Success lies not in the result , But in the efforts !!!!!"
Amit Mistry - petlad -Gujarat-India
|
|
|
|
|
Ok, do it.
--
=====
Arman
|
|
|
|
|
have you got any idea or do you need any feed back?
"Success lies not in the result , But in the efforts !!!!!"
Amit Mistry - petlad -Gujarat-India
|
|
|
|
|
This is a multithreading issue and to overcome one needs a proper level of detailed information. What you have posted as code didn't cover all the details and thus you should provide more details. I've already asked about the questions that are not clear [at least to me].
--
=====
Arman
|
|
|
|
|
would you need any thing more specific information?
I am ready to provide you.
"Success lies not in the result , But in the efforts !!!!!"
Amit Mistry - petlad -Gujarat-India
|
|
|
|
|