|
see article
http://www.mindcracker.com/mindcracker/c_cafe/dll.asp
this may help you.
cheers..
Himanshu
|
|
|
|
|
I'm using softice version 3.2.
I want to set history buffer size to 2048 KB.
I try to set it with that value, and then reboot my machine.
But softice keep the history only about 200 KB.
I don't know why? Can you tell me how to set history buffer size to 2048 KB?
Thanks.
|
|
|
|
|
Back in my BeOS days, I was exposed to a faster mutex implemenation which coupled an atomic_add with a semaphore. The implementation was (in pseudo code):
Mutex constructor:
int_avail_count = 1;
sem_avail_count = 0;
Lock:
atomic_add( &int_avail_count, -1 )
if int_avail_count was 1: return
else (someone else held the mutex): wait on semaphore; for first waiter, sem_avail_count goes to -1
Unlock:
atomic_add( &int_avail_count, 1 )
if int_avail_count was 0: return
else (someone else was or would soon be waiting on the semaphore): release the semaphore; for last waiter, sem_avail_count goes to 0 again
I just encountered a situation in a Win32 app where I have a body of data which must be protected by a critical section, but will be hit often from a high-priority thread. There will be very little if any contention for this data so it's a prime candidate for this construct, which saves a trip into the kernel for a mutex acquisition. I'm therefore looking into using InterlockedIncrement/InterlockedDecrement, CreateEvent/SetEvent/WaitForSingleObject to implement this design for windows. But... On BeOS, mutexes and events were implemented as generic semaphores involving a count. It was perfectly legitimate for a thread to release a semaphore even if it doesn't own it (that was the client's responsibility to enforce). But since ReleaseMutex is documented with: "The ReleaseMutex function fails if the calling thread does not own the mutex object" it requires the use of an event. To use this design on Windows requires an event, not a mutex, and would depend on a behavior, so now the question:
First, if multiple threads are blocked on an event and a single call is made to SetEvent, does one waiting thread unblock, or all? If all, this design is not feasible. If one, on to the next question...
Second, if multiple threads are blocked on an event, and a single call is made to SetEvent, are they released in FIFO order, or arbitrary? Hopefully FIFO, as the design also depends on that behavior.
|
|
|
|
|
Brian Tietz wrote:
First, if multiple threads are blocked on an event and a single call is made to SetEvent, does one waiting thread unblock, or all?
It depends on the type of event. For auto-reset events, only one. For manual-reset, all waiting threads are released. The SetEvent() docs explain it in more detail.
Second, if multiple threads are blocked on an event, and a single call is made to SetEvent, are they released in FIFO order, or arbitrary?
Arbitrary, there is no guarantee on which thread gets woken up.
--Mike--
I'm bored... Episode I bored.
1ClickPicGrabber - Grab & organize pictures from your favorite web pages, with 1 click!
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
|
|
|
|
|
Rereading the CreateEvent docs, I do see now the statement about a single thread being released, thanks. In the process I noticed something else that I'd overlooked: that there are semaphore functions at all. With windows I'd only used events and mutexes per se and hadn't noticed semaphores. Switched to the semaphore now, works great.
Thanks,
Brian
|
|
|
|
|
Hello,
I'm trying to arrange more than 100000 items in the listview with icon style. I use ListView_SetItemPosition32 and it works fine for fewers items but having problem to arrange more items. Some items (such as 3xxx - 5xxx) goes to the top of the first item I've inserted (index 0 item) and they got -y position in the view. I've never assign nagitave position value to any item but how come the y came out to be nagitave.
Any idea why? TIA!
thanks!
|
|
|
|
|
Can remember having read something like this in the forum. Can it be that you overflow any item position variable ? Also try to use only unsigned types for item positions in your code.
Hiusing wrote:
more than 100000
Will _really_ someone use this ? Seems quite a lot of data to work with in a listview!
~RaGE();
|
|
|
|
|
With so many items in a list view you should consider to use a
"virtual" list view[^]
Angels banished from heaven have no choice but to become demons
Cowboy Bebop
|
|
|
|
|
I have a problem with converting all serialized data of MFC Object such as COleClientItem, CDocItem and CObject to XML. I would appreciate it if someone could suggest me how to solve this problem.
Thank very much for your help.
|
|
|
|
|
If the item is text, then the easiest way I can think of is with a macro, because a macro can write a variables name in place, so you can turn int Size = 5 to <Size>5</Size> very easily.
Christian
No offense, but I don't really want to encourage the creation of another VB developer.
- Larry Antram 22 Oct 2002
C# will attract all comers, where VB is for IT Journalists and managers - Michael
P Butler 05-12-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not
as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
I finally figured out how to get my dlls setup properly and exported the functions and was able to import the functions into another project. When I did this I had to add the .lib file to my project and compile the project with the lib file to be able to access the exported functions.
What I would really like to do is link to the dll Explicitly using LoadLibrary and GetProcAddress. To explain why I need to ask another question. I am going to have a series of dlls that will all export the same functions but will have different data returned depending on the dll that is called. For example each dll might have a function exported call GetNames(). If dll1 is called in might return John, Jill, Jack and Joe. If dll2 is called it might return Amber, Ally, Allen and Ashely. Now what I really wanted to be able to do is not have to recompile the the main application when I add each dll. I need a way to be able to have my main application check to see which dlls are available and then call those functions for each dll. If I have to include the .lib file for each dll won't I have to recompile the project each time I add a new dll? Or will I have to recompile the project each time no matter which style I use?
Thanks for all the help from everyone with my relentless dll questions.
-Eric
|
|
|
|
|
VanHlebar wrote:
If I have to include the .lib file for each dll won't I have to recompile the project each time I add a new dll?
yes. since you're linking to the static lib, your app will have the DLL name encoded into it somewhere.
it sounds like you're doing a plug-in system. (click here to learn more! )
if that's the case, what you need to do (IMO) is to write an interface layer between the DLLs and the code that calls the DLL. this layer will act as a proxy between your DLLs and the caller. in addition to allowing a way to call the DLL functions, it will handle DLL loading and unloading. your app can just scan a folder (or whatever) and get a list of DLLs that support your interface (just GetProcAddr for all your calls; if they're all there, the DLL is good, add it to the list).
make that proxy layer a class and instantiate one per DLL. put them all in an array and you're all set
-c
I'm not the droid you're looking for.
|
|
|
|
|
Chris Losinger wrote:
it sounds like you're doing a plug-in system. (click here to learn more! )
Chris,
I clicked but didn't go anywhere Yes it is sort of a plug-in system. The user will be able to get the extra dlls and choose which ones they want to use and which ones not to use.
I like the idea of being able to instantiate one class per dll and having an array, but I guess I would need more information on how to do just that.
Thanks for the help,
-Eric
|
|
|
|
|
somethign like this:
class CMyProxy
{
public:
CMyProxy();
~CMyProxy();
bool Load(const char *pDLLName);
RetType MyFunc1(...) {return (m_pFunc1)(...);}
RetType MyFunc2(...) {return (m_pFunc2)(...);}
protected:
FuncType1 m_pFunc1;
FuncType2 m_pFunc2;
};
CMyProxy proxy;
if (proxy.Load(pDLLFileName))
{
RetType ret = proxy.MyFunc1(whatever, whatever);
}
so, the CMyProxy class loads the DLL, gets function pointers and lets you call DLL functions through its own function wrappers.
-c
I'm not the droid you're looking for.
|
|
|
|
|
This article Plug-In Architecture.asp[^] of mine does what Chris is suggesting. Its probably overkill for your current situation, but you should be able to cut out the bits you needs and modify them to what you require.
Roger Allen
Sonork 100.10016
This is a multiple choice question, choose wisely
Why did the hedgehog cross the road?
A: To show he had guts?
B: To see his flat mate?
|
|
|
|
|
Does anybody know a way to programmatically lock the computer's desktop or the user interface? Maybe system modal dialogs? Is there any way to use them in windows nt/9x?
/regards/
|
|
|
|
|
|
This isn't suitable. I need to lock the interface and unlock it programmatically, I don't want to let user to unlock the station by standard system means.
I think it could be possible by using system modal dialogs, but I'm not sure whether they are supported in Win32 or not and how to implement them.
/regards/
|
|
|
|
|
Hi,
I transferred a project from VC++ 6 to 7. This is a static library.
The library produced by VC++ 7 is twice bigger than with VC++ 6 (either in release or debug mode).
Is there something to tune there or is it normal ?
Thanks for your help. I really need to know the how and why because I release these libraries in a setup package and I don't want it to grow so much.
Nicolas
|
|
|
|
|
|
I have
double Total = 0;
Total += GetSubTotal(m_edit1);
Total += GetSubTotal(m_edit2);
...
sprintf(buf, "%.2f", Total); CString str = buf;
Lets say the total is a million. Then str
is 1.00e+006 which is bad. How can I get it
to display normal numbers and not this exponential?
Please, any response any one can give me will
be greatly appreciated.
Sincerely,
Danielle (an overworked graduate student)
|
|
|
|
|
try "%10.2f". with no width spec, its acting like g instaed of f.
Some ideas are so stupid that only an intellectual could have thought of them - George Orwell
|
|
|
|
|
You could format CString before as:
double Total;
str.Format(_T("%12.2f"), Total);
|
|
|
|
|
This might be an easy question for someone out there. I put together some code so that a user can go out and select a custom program (like WinAmp, WMP, solitaire, freecell, anything that is an .exe file) and it puts the icon for that program on a toolbar and when pressed, it calls the .exe file. What I would like to do is put the program name, up to 8 chars anyway, under the icon. I was wondering if anyone knew how to get the program name from the properties of the .exe file. Right now, I use the filename but in cases like solitaire, it just puts SOL. Does anyone know how to retrieve the properties so I can determine what the application name is?
If possible, I need help in 2 areas. This will go into 2 apps, one is written in C and the other in C++/MFC. Can you help???
|
|
|
|
|
I would like to embed a video clip into a MFC dialog -- basically, I would like to embed or wrap the "functionality" of Windows Media Player into my dialog. Can you help with this?
I have looked through the numerous pages/articles here at CP and have even used the example in CAnimateCtrl before, but I haven't found what I want.
My video clip may come in the form of:
1) AVI uncompressed
2) AVI compressed
3) MPEG file (mpeg4 ? for video???)
What I want is the effect of a "picture-in-picture". I want a few controls that work with the video clip (start/stop, pause). I would also like for the controls of the clip to work with the dialog itself. If I press "pause" on the Video's control, I want my dialog to recognize that "pause" command was issued -- this is for synchronizing activity from either the video clip to dialog or vice-versa.
Thank you for helping and pointing me in the right direction.
Johnny
|
|
|
|