|
ashtwin wrote:
. I want to use MFC object(view and MainFrame object) in my worker thread. Can anybody tell how to do this.
you will find this article intresting -
http://www.codeproject.com/threads/usingworkerthreads.asp[^]
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
I open the table and I search in it row by row as follows:
TableSet->Open();
TableSet->MoveFirst();
while(!TableSet->IsEOF()) {
if(TableSet->m_field1 == id) {
TableSet->Edit();
TableSet->m_field2 += 10;
TableSet->Update();
} else {
TableSet->MoveNext();
}
}
The problem is that when the program goes in the if statement (the row has been found), and it is the first row of the table, the update operation returns:
'No rows where affected by the update or delete operation'
If this is not the first row the update operation success.
Does anyone know why does this happen?
Thanks in advance
sirtimid
|
|
|
|
|
This seems very inefficient. Rather than iterate through each row of the table, why not use a WHERE clause so that the recordset only contains the row(s) that need(s) updating?
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
I have the need within my application to access a set of files, much like the MRU file option.
So what I need to do is store an integer and several strings in the registry, and retrive them when a particular dialog is displayed.
Can anyone point me in the right direction for some sample code as I have never used the registry before.
I will be deploying the aplication so can I test it within Visual Studio IDE and again when deployed.
Many thanks,
|
|
|
|
|
Search for the word registry in the search box, just below "THE CODE PROJECT" at the very top of page.
There are at least 10 different articles (in the VC++ section) here at CodeProject. You will find everything you need, I'm sure.
Good luck.
|
|
|
|
|
There are several registry articles inside codeproject that may explain the registry[^].
A good article is this one[^] that is a class that makes it easier.
Marc Soleda.
... she said you are the perfect stranger she said baby let's keep it like this... Tunnel of Love, Dire Straits.
|
|
|
|
|
If you are using MFC, check out the CWinApp::LoadStdProfileSettings() method. You can either use it directly, or look at how it is coded and do something similar. In a key named Recent File List, it creates REG_SZ values named File# where # is a number starting at 1. Those values are then assigned the absolute path of a file.
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
Can anyone tell me where WITH_ZLIB is hidden in my visual studio 7 project? I know it is being used but I can’t find where it is in order to turn it off.
There is a CMakeLists.txt file, cut and paste from which shows:
# openssl support
OPTION(WITH_OPENSSL "Turn support for openssl on/off" OFF)
FIND_PATH(WITH_OPENSSLINC "include/openssl/ssl.h" ${dcmtk_SOURCE_DIR}/../openssl-0.9.7d)
# zlib support
OPTION(WITH_ZLIB "Turn support for zlib on/off" OFF)
FIND_PATH(WITH_ZLIBINC "include/zlib.h" ${dcmtk_SOURCE_DIR}/../zlib-1.2.1)
(The WITH_ZLIB was turned ON, but I changed it to OFF and this had no effect.)
I know it is being used because I see it in BuildLog.htm, (see below “WITH_ZLIB”):
Creating temporary file "c:\Ilan\dcmtk-3.5.3\dcmdata\libsrc\Debug\RSP000001.rsp" with contents
[
/Od /I "../../config\include" /I "../../dcmdata\include" /I "../../ofstd\include" /I "../../../zlib-1.2.1\include" /D "_DEBUG" /D "WIN32" /D "_LIB" /D "_REENTRANT" /D "WITH_LIBPNG" /D "WITH_LIBTIFF" /D "WITH_ZLIB" /D "dcmdata_EXPORTS" /D "CMAKE_INTDIR=\"Debug\"" /D "_MBCS" /FD /EHsc /RTC1 /MTd /GS /YX"stdafx.h" /Fp".\Debug/dcmdata.pch" /Fo".\Debug/dcxfer1.obj" /Fd".\Debug/" /W3 /c /Z7
".\dcxfer.cc"
]
Creating command line "cl.exe @"c:\Ilan\dcmtk-3.5.3\dcmdata\libsrc\Debug\RSP000001.rsp" /nologo"
I looked at the Properties window and the Options, but I simply can’t find who is defining this variable.
Can anyone tell me what I’m missing?
Thanks,
Ilan
|
|
|
|
|
Hi folks,
I am working on an application that cross-links path names and keywords.
Currently I am using two maps that hold the information:
map<string, set<string> > m_path2keywords;
map<string, set<string> > m_keyword2paths;
While I am filling these maps with information they allocate much more memory than I expected (20.000 files -> more than 200MB of RAM). After minimizing and restoring the window that presents the data the allocated memory drops to less than 5MB!?!
I guess the previous waste of RAM is related to the map container.
So, would it be better to deal with one big map than to use two ?
How big is the organizational overhead of the map container ?
Are there any memory saving alternatives to the STL map container ?
Thanks in advance,
Achim Klein
We can do no great things, only small things with great love. - Mother Theresa
|
|
|
|
|
The problem must reside in the layout of your data. What are those keywords and how many of those have you got for each path, on average? The overhead from the containers should be minimal, but the amount of (duplicate) data in there could be huge.
|
|
|
|
|
Hi Niklas,
thank you for your feedback.
What are those keywords
For example
Path = C:\My Files\Sun.jpg
Keywords:
how many of those have you got for each path
Hard to say, but to give you a number, each path has about 10 keywords on average.
The problem must reside in the layout of your data.
Are there any more sophisticated ways to 'cross-link' data ?
Regards
We can do no great things, only small things with great love. - Mother Theresa
|
|
|
|
|
...coming to think of it, this layout is really expensive. One solution would be to use four containers instead of two.
set<string> allMyKeyWords;<br />
set<string> allMyPaths;<br />
map< set<string>::iterator, set< set<string>::iterator > > m_path2keywords;<br />
map< set<string>::iterator, set< set<string>::iterator > > m_keyword2paths;<br /> Thus, in the maps you will only store iterators to the external sets (pointers to strings) rather then storing all strings hundreds (?) of times.
|
|
|
|
|
Aargh, formating formating
set<string> allMyKeyWords;<br />
set<string> allMyPaths;<br />
map< set<string>::iterator, set< set<string>::iterator > > m_path2keywords;<br />
map< set<string>::iterator, set< set<string>::iterator > > m_keyword2paths;<br />
|
|
|
|
|
Yes, this is really an interesting alternative.
What happens if I delete any items from these two sets ?
Are the remaining iterators (that are stored in the maps) still valid ?
We can do no great things, only small things with great love. - Mother Theresa
|
|
|
|
|
What happens if I delete any items from these two sets ?
Are the remaining iterators (that are stored in the maps) still valid ?
Nope. They are NOT. There are at least two ways to go here:
1. When removing let say a keyword, you will have to look up that entry in both maps (this is really not different from what you probably would have done with your original datastructure.) Removing items this way could be a lengthy operation on huge sets.
2. Depending on how you use the data, when removing a keyword, you could just set the actual keyword string to something that is invalid as a keyword, maybe an empty string? If you keep these structures as long as your app is running you will eventually get a lot of 'holes'. But the removal process is as fast as it could get, leaving (minor) performance penalties for other operations where you have to determine if an entry is valid or not. You could even run a clean-up pass to remove those holes whenever the app has nothing else to do.
|
|
|
|
|
Sorry for the delay, I had visitors.
I think I can get along with 'holes' very well, so I'll try to realize the 'iterator solution'.
Thanks for your ideas.
Regards,
Achim Klein
We can do no great things, only small things with great love. - Mother Theresa
|
|
|
|
|
hi guys.
i am trying to use pointers to functions in my dll to call a function in my .exe
i am storing my pointer in a global variable, so it can be called by any function.
the trouble is, i am finding that it can be only called by my addeventCallback function
i.e.
Code:
#include "dll.h"
EVENTCALLBACK evtcb = NULL;
BOOL WINAPI AddEventCallback(EVENTCALLBACK ptr) {
evtcb = ptr;
evtcb("pass on the message!");
evtcb("pass on the message!");
}
LRESULT CALLBACK GetMsgProc(int nCode, WPARAM wParam, LPARAM lParam) {
if(nCode < 0)
return CallNextHookEx(0, nCode, wParam, lParam);
evtcb("pass on the message!");
this displays "pass on the message" twicein the console, but when i try to cal evtcb() from GetMsgProc, it does not show again, meaning it has failed somewhere.
i know my GetMsgProc is fine as i have used other indicators such as MessageBepp(0) to show it is working.
what is the problem here?
cheers.
-- modified at 8:50 Thursday 8th September, 2005
|
|
|
|
|
How to create a wizard based project .
Plz send me a simple application to create a wizard based program
Praveen Chowdam Kumar
|
|
|
|
|
|
how can I retrieve the text from windows text editors using the keyboard cursor position
thank u
|
|
|
|
|
Samik Karmakar wrote:
windows text editors
What do you mean by that ? You mean Microsoft Word ? If yes you have to look for 'Word automation'. Otherwise be more specific.
|
|
|
|
|
i want to retrieve the text from any text editors notepad, wordpad.
i want to retrive the text when the cursor is over the letter.
example: say i have the word : text and my cursor is on 't'. so i want to retrieve 't' . now if i move the cursor from t to 'x' then i want to get 'x' retrieved say in a message box .
thank u
|
|
|
|
|
You'll need to use the EM_CHARFROMPOS message.
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
I have a pattern brush I would like to modify. The brush itself is to be used by windows internals.
My question is if it's at all possible to do something like
<br />
LOGBRUSH lb;<br />
::GetObject(hBrush, sizeof(LOGBRUSH), &lb);<br />
hbm = (HBITMAP) lb.lbHatch;<br />
::SelectObject(hdc, hbm);<br />
and the draw to the dc? If I already sent the hBrush to a win API function, will it be the very same I am trying to modify, or is windows using a copy of it (which means there's no point in doing the above)?
The win func is SetMenuInfo() but I doubt that matter.
|
|
|
|
|
To play mp3, I use MCIWndPlay macro. I want to make the tune to be played repeatedly until user wants a stop. Does anyone know how to do it?
|
|
|
|