|
No. Its single threaded. I just had three TRACEs in this routine..
the problem is that the app behaves very erratically from run to run (always crashes due to the erratic behavior). What it should do is populate a few database columns with entries for all records, then proceed. I do this, and sometimes one column is filled. Sometimes 2...but never all. Often no columns that I need done are populated.
itNotIn1 = setNotInSet1.begin();
for (; itNotIn1 != setNotInSet1.end(); itNotIn1++)
{
TRACE("before pop1");
CString temp = *itNotIn1;
m_db1.PopulatedontCares(*itNotIn1);
TRACE("After pop1");
}
In my latest attempt with breakpoints it did go into PopulatedontCares and return successfully, but when I checked the database, the columns were still empty:
while (!rsDontCares->GetadoEOF ())
{
rsDontCares->Fields->GetItem(fldName0)->Value = xDontCare0;
rsDontCares->Update();
rsDontCares->MoveNext ();
}
I'd tried UpdateBatch as well...
Dont know if you can help....but thanks anyways...
Appreciate your help,
ns
|
|
|
|
|
The 'sometimes' part of problem suggests that you're using uninitialized data somewhere or overwriting memory blocks. Try to simplify PopulateDontcare - what happens if you don't write anything to database? Does program still crash?
Also, check the value of 'temp' variable inside the loop - add another TRACE, for example.
Tomasz Sowinski -- http://www.shooltz.com
*** Purgamentum init, exit purgamentum ***
|
|
|
|
|
For another operation (adding and filling one column)I use PopulateDontcares (BTW, it has to be the UPdate Batch function, and not update() in order for the routine to work). It adds a column and fills it with the values. That part works great!
I guess I'll go and look at my variables to see if any are at fault...and implement your sugestions.
Appreciate your help,
ns
|
|
|
|
|
hi..
compiler has error when I add OPENFILENAME in my code .where is the wrong?
|
|
|
|
|
|
yes..
(24)OPENFILENAME ofn;
EROORS:
20.cpp(24) : error C2065: 'OPENFILENAME' : undeclared identifier
20.cpp(24) : error C2146: syntax error : missing ';' before identifier 'ofn'
20.cpp(24) : error C2065: 'ofn' : undeclared identifier
|
|
|
|
|
If you want to keep WIN32_LEAN_AND_MEAN, include commdlg.h.
Tomasz Sowinski -- http://www.shooltz.com
*** Purgamentum init, exit purgamentum ***
|
|
|
|
|
|
no errors when I delete this
#define WIN32_LEAN_AND_MEA //in stdafx.h
|
|
|
|
|
Does anyone done an implementation of Layered Service Provider for Windows Sockets 2? Unfortuantely the only sample i've got (from MJN) doesn't work and the documentation isn't very clear.
|
|
|
|
|
(Using VC++ 6)
I need to obtain the full filename of a dll that is being instantiated as a COM interface.
I am aware of the "GetModuleFileName" procedure and the relevance of the first parameter: NULL gives you the calling exe file, right? Well, I still get the same filename if I use the Instance, so I must be doing something screwy?? I've resorted to hardcoding the dll filename as a constant at the moment, which gets me off the hook temporarily, but this approach won't work indefinitely, so any help is much appreciated.
Code snippet:
CWinApp* App = AfxGetApp ();<br />
HINSTANCE hInstance = App->m_hInstance;<br />
<br />
<br />
TCHAR cFileName[_MAX_PATH];<br />
GetModuleFileName (hInstance, cFileName, _MAX_PATH);<br />
Ta!
Debbie
|
|
|
|
|
HINSTANCE stored in your app may refer to .exe. Try to store/use HINSTANCE passed to DllMain.
Tomasz Sowinski -- http://www.shooltz.com
*** Purgamentum init, exit purgamentum ***
|
|
|
|
|
I did read about that in a google search. However (and I'm showing my ignorance here!) this is the first ever DLL I've created myself, and I generated it using the MFC dll wizard: I can't find that procedure *anywhere*! If someone could point me in the right direction it would be much appreciated.
Ta!
Debbie
|
|
|
|
|
There's a function called DllMain in your .dll project. It's called by Windows during initialization of your .dll and gets the right HINSTANCE. You can store HINSTANCe somewhere or call GetModuleFileName right in DllMain.
DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
{
char buf[1024];
GetModuleFileName(hInstance, buf, sizeof(buf));
...
}
To find DllMain, expand 'Globals' item in ClassView.
Tomasz Sowinski -- http://www.shooltz.com
*** Purgamentum init, exit purgamentum ***
|
|
|
|
|
Hi,
Thanks for the advice. My orignal probelm appears to be sorted, (see other post), but I would like to understand a bit more about it.
My Globals don't contain a DllMain function (unless I need new glasses , I did look, honest!).
It has 4 functions DLLCanUnloadNow; DLLGetClassObject; DllRegisterServer and DllUnregisterServer. This is a COM interface, maybe that makes a difference?
I'm afraid I'm very new to both DLLs and COM. It appears to be working (amazingly), but it's a bit like black magic atm. Maybe all will become clear in time. I do hope so!
Ta!
Debbie
|
|
|
|
|
I still haven't found the DllMain method, but I have sussed out that I can access the _Module directly (having had a look at the DllGetClassObject method. This does seem to do the trick in giving me the right filename. I'm not exactly sure that I fully understand it, yet, though!
<br />
HINSTANCE hMine = _Module.m_hInst;<br />
GetModuleFileName (hMine, cFileName, _MAX_PATH);<br />
|
|
|
|
|
hi,
I have a sizeable ListCtrl in a FromView.
The ListCtrl has a report style.
Additionally I want to size the column of the
ListCtrl when sizing.
But the scrollbars don't want what I want.
When the row count grows up and the horizontal
scrollbar is shown the vertical scrollbar
is shown, but it is not nessaray.
Second it is liable to run around. When the first
column width was changed the headerctrl
sends a WM_SIZE to the listctrl.
How can I avoid this.
<br />
MyFormView::OnSize(...)<br />
{<br />
m_ListCtrl.::MoveWindow(...,..., TRUE);<br />
}<br />
<br />
MyListCtrl::OnSize(UINT nType, int cx, int cy) <br />
{<br />
int iCol;<br />
int nCols =GetHeaderCtrl()->GetItemCount();<br />
int nWidth=0;<br />
RECT rect;<br />
float f;<br />
SCROLLINFO scrinfo={0};<br />
CHeaderCtrl* pHdr=GetHeaderCtrl();<br />
HDITEM hdi={0};<br />
<br />
CListCtrl::OnSize(nType, cx, cy);<br />
<br />
for(iCol=0;iCol<nCols;iCol++)<br />
{<br />
pHdr->GetItemRect(iCol,&rect);<br />
nWidth+=rect.right-rect.left;<br />
}<br />
<br />
GetScrollInfo(SB_VERT,&scrinfo);<br />
if(scrinfo.nPage<=scrinfo.nMax)<br />
{<br />
GetClientRect(&rect);<br />
cx=rect.right-GetSystemMetrics(SM_CXVSCROLL);<br />
}<br />
<br />
f=(float)(cx)/(float)(nWidth);<br />
<br />
<br />
hdi.mask=HDI_WIDTH;<br />
for(iCol=0;iCol<nCols;iCol++)<br />
{<br />
pHdr->GetItem(iCol,&hdi);<br />
hdi.cxy=f*hdi.cxy;<br />
pHdr->SetItem(iCol,&hdi);<br />
<br />
}<br />
}<br />
<br />
|
|
|
|
|
My app works fine as far as I know. But I just noticed that when I am in debug mode with breakpoints and it loads up until the UI appears, the output window says "First Chance Exception" in two places. Yet the app does fine (as far as I know I hasten to add). Do I need to worry and if so, how do I fix this problem?
Appreciate your help,
ns
|
|
|
|
|
Hi, first chance exceptions are generally c++ exceptions
like possibly in MFC, you can safely ignore them.
|
|
|
|
|
Ah! I was starting to get really despondent about this, my latest discovery (I have other stuff to do), and thought I'd done some horrendous thing somewhere which will show up sometime. I am so relieved!
Thanks,
Appreciate your help,
ns
|
|
|
|
|
Don't worry about 'first chance exceptions.' For more info, see KB article Q105675.
Tomasz Sowinski -- http://www.shooltz.com
*** Purgamentum init, exit purgamentum ***
|
|
|
|
|
when i compile, i all of the sudden get all these messages:
d:\90GIG\MP3ORGANIZER\FileTransfer\main.cpp(547): error C2143: syntax error : missing ')' before ';'
d:\90GIG\MP3ORGANIZER\FileTransfer\main.cpp(547): error C2059: syntax error : ')'
d:\90GIG\MP3ORGANIZER\FileTransfer\main.cpp(567): error C2143: syntax error : missing ')' before ';'
d:\90GIG\MP3ORGANIZER\FileTransfer\main.cpp(567): error C2660: 'ReadFile' : function does not take 3 parameters
d:\90GIG\MP3ORGANIZER\FileTransfer\main.cpp(567): error C2143: syntax error : missing ';' before ','
d:\90GIG\MP3ORGANIZER\FileTransfer\main.cpp(567): error C2059: syntax error : ')'
d:\90GIG\MP3ORGANIZER\FileTransfer\main.cpp(582): error C2143: syntax error : missing ')' before ';'
d:\90GIG\MP3ORGANIZER\FileTransfer\main.cpp(582): error C2143: syntax error : missing ')' before ';'
d:\90GIG\MP3ORGANIZER\FileTransfer\main.cpp(582): error C2059: syntax error : ')'
d:\90GIG\MP3ORGANIZER\FileTransfer\main.cpp(582): error C2143: syntax error : missing ';' before '&&'
d:\90GIG\MP3ORGANIZER\FileTransfer\main.cpp(582): error C2059: syntax error : ')'
d:\90GIG\MP3ORGANIZER\FileTransfer\main.cpp(614): error C2143: syntax error : missing ')' before ';'
d:\90GIG\MP3ORGANIZER\FileTransfer\main.cpp(614): error C2059: syntax error : ')'
d:\90GIG\MP3ORGANIZER\FileTransfer\main.cpp(632): error C2143: syntax error : missing ')' before ';'
d:\90GIG\MP3ORGANIZER\FileTransfer\main.cpp(632): error C2660: 'recv' : function does not take 3 parameters
d:\90GIG\MP3ORGANIZER\FileTransfer\main.cpp(632): error C2143: syntax error : missing ';' before ','
d:\90GIG\MP3ORGANIZER\FileTransfer\main.cpp(632): error C2059: syntax error : ')'
The first error message directs me to this line:
szFileBuffer = (char *)malloc(SEND_BUFFER_SIZE);
what is wrong with that? there's no ) missing
and the "ReadFile function does not take 3 parameters" directs me here:
ReadFile(hFile, szFileBuffer, SEND_BUFFER_SIZE, &dwBytesRead, NULL);
there isn't threee parameters there, there are five! i don't understand it... and all of the other error messages are wrong too, i'm not missing an ')' or an ';' in any of the places, what could be wrong?
thanks
-Rune Svendsen
|
|
|
|
|
Post the #define SEND_BUFFER_SIZE line.
Tomasz Sowinski -- http://www.shooltz.com
*** Purgamentum init, exit purgamentum ***
|
|
|
|
|
It's
#define SEND_BUFFER_SIZE 8192;
it's the ; that made the errors, thanks to both of you.
|
|
|
|
|
I suppose the SEND_BUFFER_SIZE looks like this
#define SEND_BUFFER_SIZE 100;
This would introduce errors of this kind.
I keep submitting “VB” as a Priority-1 bug, but apparently no one here knows how to fix it. Nick Hodapp, Semicolon
|
|
|
|